We are conducting an individual participant level meta-analysis on a series of clustered randomised controlled trials, where we are mainly interested in an interaction effect with a characteristic (whether students have had contact with a particular kind of service). In essence, there are two things we need a multilevel model for:
- Dealing with the nested clustering - in this case schools within trials
- Producing an interaction effect with the random effects for the trials
The data is unfortunately protected from being shared but the structure is:
- Outcome variable - test scores (score)
- Trial - which trial a person appears in
- School - this is the level the trials were randomised on, so it is nested below trial
- Service - another individual-level characteristic that we want to interact trial with
If we had a fixed effects model then this would look something like:
lm(score ~ trial*service, ...)
if we just ignored the nested clustering (where trial is a factor variable for the treatment arm and which trial it is in).
If I could ignore the interaction then in lme4 it would be something like:
lmer(score ~ (1|school/trial), ...)
but what I would like to see is how to interact that with service, which maybe I could do by setting:
lmer(score ~ (1|school/trial/service), ...)
but feel this is wrong as service is an individual-level characteristic, so its weird to put it "above" school or trial in the clustering.