I'm facing a problem similar to the following.

There are 8 schools and each one contains a certain number of students. For each student I have a set of continuous variable (one of which is the dependent variable Y while the other are covariates). In addition, each student was assigned one of 4 possible interventions. My goal is to study the effect of the 4 different interventions on Y keeping into account the nested structure of the data.

If the interventions were randomly assigned to the students I would have used a mixed effects linear regression using the grouping variable "school" as a random effect (imagine a model with only the random intercept for simplicity), and intervention and other patient level covariates as fixed effects.

My problem is that the four interventions are randomly assigned at the school level: the interventions are applied to individual students, but students from the same school undergo the same intervention. So I have students nested within 8 schools nested within 4 interventions (2 schools per intervention).

Can I still calculate the effect of intervention on Y (treating it as a fixed effect) accounting for the effect of the school? Which model would you use?


1 Answer 1


This appears to be a "cluster randomised" design. There should be no problem using a mixed effects model, with random intercepts for school. The intervention is a fixed effect so it doesn't make sense to think of schools being nested within the intervention. Nesting is only relevant for random effects. So your model will be something like

Y ~ intervention + covariates + (1 | schoolID)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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