What exactly constitutes a "level" in mixed models? In most texts I have read levels seem to be synonym with random variables (student ID, classroom, school, etc). But can predictors also be levels? For example, if I'm interested in math scores, family income, and IQ, can I say these are levels nested within students?
As an example consider this data set:
df = data.frame(ID=rep(c("ID1","ID2","ID3","ID4","ID5","ID6"),each=4), scores=floor(runif(24, min=0, max=100)), age=rep(c(14,17,14,16,18,12),each=4), test=rep(c(1,2),times=12), day=rep(c("day1","day2"),each=2,times=6),school=rep(c("A","B"),each=12))
I'd read it as school
as the upper level (level 1), then pupil ID
nested within schools (level 2), then day
nested within pupil ID? (level 3), then test
nested within day (level 4). Is that correct? What about age
, can that be considered a separate level as well?