My goal is to specify two different covariance matrices for two different random intercepts.
Briefly, this is my dataset.
Outcome is continuous (school test scores)
13 Schools in my study. Random students selected for testing. All students who were selected were tested. Students nested within Schools.
I am interested in estimating the random intercept for each School
and each Student
.
So this is my model.
lme( y ~ SchoolName + Age + Sex, random = ~1 | SchoolName/StudentID, data= df)
I am interested in
- Schools following unstructured covariance matrix
- Students , ar1.
I have another variable time, which is a discreate variable that takes values either 10,11,12,13 . So I specified the model like this
`lme( y ~ SchoolName + Age + Sex,
random = ~1 | SchoolName/StudentID,
correlation = corAR1(form = ~1 | time/StudentID,
data= df)`
I am seeing an error, "Incompatible formulas in random and correlation", How to resolve this error. Please help.