6

I am conducting meta-analysis using metafor in R. I would like to compare among 7 levels in a factor (i.e. different types of treatments).

fit <- rma (yi, vi, mods = type_of_treatment - 1, data = dat)
fit

I found several websites explaining how to compare among levels by using anova() (e.g., Post hoc analysis after meta regression & http://www.metafor-project.org/doku.php/tips:testing_factors_lincoms?s[]=anova); however, because I have seven levels (i.e. seven different types of treatments), doing comparisons by myself is pretty trouble same.

I tried glht() in the multcomp package, but the following command provides error.

summary(glht(fit, linfct = mcp(~type_of_treatment = "Tukey"))

I would really appreciate if you could let me know if there is any easy way to conduct a pairwise comparison among levels, like the glht() or emmeans() for lm.

user8460166
  • 596
  • 4
  • 15

1 Answers1

8

You could use the contrMat() function. Something like this should work:

summary(glht(fit, linfct=cbind(contrMat(rep(1,7), type="Tukey"))), test=adjusted("none"))

You might want to consider an adjustment for multiple testing though. See help(summary.glht) for some options.

Wolfgang
  • 15,542
  • 1
  • 47
  • 74
  • This is exactly what I have been looking for!! Thank you so much, @Wolfgang. I hope you have a great day today. – user8460166 Jan 25 '18 at 01:23
  • The results for post-hoc testing appear to depend on which factor level I set as the reference level. For example, I am conducting post-hoc testing for an meta-analysis with "continent" as the moderator. When the reference level is North America (as compared to Asia, for example), I get different results for the comparisons that involve the intercept. This makes sense, as the intercept estimate is the meta-analytic estimate at the reference level, while the predictor estimates are beta weights. – E. Wade Sep 10 '21 at 15:19
  • It doesn't seem correct to run a post-hoc comparison between an intercept and a beta weight, yet that's what glht is doing here. Shouldn't the test be between the the meta-analytic estimate for each factor level (i.e., intercept + factor level 2 beta weight vs. intercept + factor level 3 beta weight)? @Wolfgang – E. Wade Sep 10 '21 at 15:20
  • 1
    Did you remove the intercept like the OP did? – Wolfgang Sep 10 '21 at 16:53
  • @Wolfgang Ah, I missed it. That makes so much more sense. Thank you! – E. Wade Sep 11 '21 at 19:47