Skip to content
Prev 2584 / 5636 Next

[R-meta] metafor: Interaction between a factor and a continous variable

Dear Ute,

Please see my responses below.

Best,
Wolfgang
Just as a sidenote: It is better to post code/output as text and not as an inline image.
Correct.
Correct.
Correct, but to be precise, the coefficient is the one for men.
Assuming that this is what 'beta' reflects, this is also correct.
Correct.
This is all correct.
You can use predict() and anova() to also obtain these results:

predict(df, newmods = c(0,0,0))
predict(df, newmods = c(0,1,0))
predict(df, newmods = c(1,0,0), intercept=FALSE)
predict(df, newmods = c(1,0,1), intercept=FALSE)

anova(df, L=c(1,0,0,0))
anova(df, L=c(1,0,1,0))
anova(df, L=c(0,1,0,0))
anova(df, L=c(0,1,0,1))

Sidenote: This shows a bit of an inconsistency in how predict() and anova() works in metafor. For the former, the intercept is included in the linear combination by default (if the model actually has an intercept term) and its inclusion/exclusion is not controlled via the 'newmods' argument but by the 'intercept' argument, while in anova() one needs to specify a linear combination that also pertains to the intercept term.
There is also a way to specify the model such that it gives the intercept and slope for both groups directly. Use:

mods = ~ factor(sex) + factor(sex):moderator - 1