2
$\begingroup$

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.

$\endgroup$

1 Answer 1

3
$\begingroup$

When you write "score ~ (1|school/trial/service)" this treats service as a random effect, nested within trial, nested within school.

From your description, it sounds like service may actually be a fixed effect? If so, then I think you would want "score ~ service + (1|school/trial) + (1|school/trail:service)" - that gives you a fixed main effect for service, and a random effect for the interaction of service with trial-nested-within-school.

The answer above assumes service is categorical. If service is continuous, you will need a random slope for the interaction instead of random intercepts, eg. "score ~ service + (1|school/trial) + (service|school/trail)". This is not an interaction in the sense that you'll get an output value, but it does account for differing effects of service (as a continuous variable) in different trial-nested-within-school groups.

For more information on interactions with lmer, these slides may be helpful.

$\endgroup$

Your Answer

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

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