2

I am conducting a multi-level, mixed-effects meta-analysis where effect sizes are clustered within studies. In the R package metafor, I specify my model like this:

rma.mv(data = df,
       yi = g ~ 1,
       V = varG,
       random = ~ 1 | studyID) %>%
  robust(cluster = df$studyID) #To calculate robust standard errors

My outcome vector is g, its variance is varG, and my intercept is a random variable clustered within studyID. When I add a moderator to this model, should that also be specified as a random effect? Or is it a fixed effect? So far I haven't found a way to specify a moderator as a random effect using metafor. Instead, this is what I use:

rma.mv(data = df,
       yi = g ~ 1 + mod, #This is the same as adding the `mods` argument
       V = varG,
       random = ~ 1 | studyID) %>%
  robust(cluster = df$studyID) #To calculate robust standard errors

I would think that the moderator should be a random variable for the same reason that the intercept is; it depends on the cluster (study), and so if we treat it as fixed we will end up with non-independent residuals. But I'm also new to both meta-analysis and fixed-/random-variables, so I could be approaching this totally wrong.

ila
  • 221
  • Why not try adding random = ~ mod | studyID and see if the sky falls in? There are vvarious examples of this sort of model on the metafor project pages https://metafor-project.org/doku.php/analyses for instance. – mdewey May 28 '21 at 12:43
  • I looked into that, but that seems to be a way to specify inner & outer grouping variables, not additional random variables - see https://www.rdocumentation.org/packages/metafor/versions/2.4-0/topics/rma.mv, the paragraph starting "In addition or alternatively to specifying" – ila May 28 '21 at 13:55
  • 1
    If you would like to add random slopes for a predictor, you can use random = ~ mod | studyID, struct="GEN" (this is currently undocumented, but works as intended). – Wolfgang Jun 01 '21 at 15:39
  • Excellent, thank you! – ila Jun 01 '21 at 19:52

0 Answers0