2
$\begingroup$

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.

$\endgroup$
4
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ This is exactly what I have been looking for!! Thank you so much, @Wolfgang. I hope you have a great day today. $\endgroup$ – user8460166 Jan 25 '18 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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