I'm following a tutorial on mixed effects models. The tutorial uses egsingle dataset from mlmRev package. As part of the tutorial, the author uses groupedData() as:
egsingle <- groupedData(math ~ year | schoolid/childid, data = egsingle)
Could someone help me understand what "schoolid/childid" refers to?
Please note that schoolid and childid are both factors!
Also, later in the tutorial, the author takes a sample of size 50 and uses lmList() to fit OLS regression for each subject by using:
egsingle <- groupedData(math ~ year | schoolid/childid, data = egsingle)
samp <- sample(levels(egsingle$childid), 50)
level2.subgroup <- subset(egsingle, childid %in% samp)
# fitting a separate OLS regression line to each student
level2 <- lmList(math ~ year | childid, data = level2.subgroup)
plot(augPred(level2))
when I run lmList command above, I get these errors:
Error in eval(expr, envir, enclos) : object 'childid' not found
In addition: Warning messages:
1: In lmList(math ~ year | childid, data = level2.subgroup) :
lmList does not (yet) work correctly on groupedData objects
2: In Ops.factor(schoolid, childid) : ‘/’ not meaningful for factors
Could anyone help me figure out why I get these errors?