Okay, I have students in classrooms in schools. I want to know if test score number depends on your school.
my basic model is:
basemodel <- lmer(test ~ schoolnumber +
(1 | schoolnumber/classnumber), data=mydata)
Do I want to try and add in the student level?
Doesn't work:
model1 <- lmer(test ~ schoolnumber +
(1 | schoolnumber/classnumber/ studentID), data=ED)
Doesn't work:
model2 <- lmer(test ~ schoolnumber +
(1 | schoolnumber/classnumber) +( 1 |studentID), data=ED)
Doesn't work:
model3 <- lmer(test ~ schoolnumber +
(1 + studentID | schoolnumber/classnumber), data=ED)
model4 <- lmer(test ~ schoolnumber + studentID +
(1 | schoolnumber/classnumber), data=ED)
When I add student ID it says
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Also my current test
score is a standardised score taken from raw scores, then z scores then linear transformation (standard scores); 100 + 15(z)
.
Am I okay to use these linear transformed scores or should I be using something else? I've seen code elsewhere saying to use scale()?
As Roland says, if schoolnumber
is categorical/a factor variable, then your first model should fail:
~ schoolnumber + (1 | schoolnumber/classnumber)
includes schoolnumber
as both a fixed categorical predictor and as a random effects grouping variable. ~ (1|schoolnumber/classnumber)
would make more sense.
If you get rid of schoolnumber
as a fixed effect predictor, then
~ (1 | schoolnumber/classnumber) + (1|studentID)
should work. I wouldn't recommend adding studentID
as a fixed effect.
I'm assuming that students are labeled uniquely, ie that there isn't a student 1A57
in school number 1 and a different student 1A57
in school number 2 ...
How large is your data set at each level (observations, students, classes, schools)? I'm guessing that students are nested within schools but crossed among classes, ie each student is in only one school but in more than one class. As long as you have students labeled uniquely, it won't matter as much how you specify the model.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.