# Treatment at level 2 in 3-level mixed-effects models

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!

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.