2
$\begingroup$

I am having a dataset with three levels. The top level was school, the middle level was class, and the bottom level was student.

Each school has three types of classes. I want to understand the effect of class type on the measurement of students. I am not sure whether my model is correct:

lmer(DV_at_level3 ~ class type + (1|school_id) + (1 | school_id:class_id))

In addition, what the models would be like if the treatment is at the school level? What about if I want to add covariates at different levels to the models?

Thank you! Any readings/textbook/etc. would be appreciated!

$\endgroup$

1 Answer 1

1
$\begingroup$

Your model:

lmer(DV_at_level3 ~ class type + (1|school_id) + (1 | school_id:class_id))

specifies that class_id is nested within school_id, as per your description. This model makes sense to me.

As for the questions about the level at which a variable varies, all the mixed effects software that I know of, such as lme4 that you are using, does not care about the level at which a variable varies. You just add them to the fixed part of the model. So you can go ahead and add whatever variables you want, but as always pay attention to the causal structure so as not to include mediators and colliders.

As for references, one of my favourite books is "Multilevel Analysis" by Snijders and Bosker. Another good one is "Multilevel Analysis: Techniques and Applications" by Hox.

$\endgroup$
2
  • $\begingroup$ Thanks for your recommendation! While I was researching this topic I did find some posts about dealing with variables at different levels, e.g. data.princeton.edu/pop510/egm . $\endgroup$
    – Affozhizhi
    Jun 4, 2021 at 11:40
  • $\begingroup$ You're welcome. That looks like a good article, thanks ! But notice how, also with Stata, it doesn't matter at which level a variable varies. $\endgroup$ Jun 4, 2021 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.