I want to study the relationship between y and x in a linear mixed model with subjects as a random effect (including both random intercept and slope terms). I fit two models,fit1 and fit2 as follows:
fit1_linear mixed model
fit1<-lme(y~x,random = ~ 1 + x | subjects, data=TT)
fit2_segmented mixed model with null left slope constraint
fit1_1<-lme(y~1,random = ~ 1 + 1 | subjects,data=TT)
fit2<-segmented(fit1_1,seg.Z = ~x,
random=list(subjects=pdDiag(~1+DAMAGE+U+G0)),psi = 0.40)
I use AIC to compare fit1 and fit2, the second one was better. When I used the “slope ()” to get the right slope of segmented mixed model, it showed that:
Error in V[final.names, final.names] : subscript out of bounds.
how can get the right slope of the mixed model?
I use AIC to compare fit1 and fit2, the second one was better. When I used the “slope ()” to get the right slope of segmented mixed model, it showed that:
Error in V[final.names, final.names] : subscript out of bounds.
how can get the right slope of the mixed model?
jinlong is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.