I am running into two issues.
- As such, I am not confident in my interpretation of summary estimates from the Random Effects part of
lme
function. - I used the
tab_model
function from SjPlot and the estimates from thelme
model appears incorrectly after exporting the results usingtab_model
function. This further complicates the situation.
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)
The results are like this.
Fixed Effects:
Estimates C.I P
Intercept 44.12 39; 52.12 <0.05
.
.
.
.
Random Effects:
Formula: ~ 1 | SchoolName
Intercept
StdDEV : 1.0849
Formula: ~ 1 | StudentID %in% SchoolName
Intercept Residual
StdDEV : 8.0771 6.92993
When I export this to a csv file using tab_model
from SjPlot
So I like to get some advise.
Is my model setup correct , for a nested dataset like this where the goal is to estimate random intercept for both School and Students, Students nested within School.
My interpretation of random effects is that the a) one can expect a variation of 1.0849 points in test scores from different schools. b) There is a variation of around 8.07 points in test scores among students.
I am not sure what residual StDev is and I dont know why
tab_model
function has switched these random effects estimates.
Highly appreciate any advice. Thanks in advance.
SchoolName
) is a random factor, it doesn't make sense to include it as a fixed effect also:lme( y ~ Age + Sex, random = ~1 | SchoolName/StudentID)
. Do you have data on classes also? In such education setting the nested random effect is oftenSchool/Class/StudentId
. $\endgroup$