guido-s / meta

Official Git repository of R package meta
http://cran.r-project.org/web/packages/meta/index.html
GNU General Public License v2.0
82 stars 32 forks source link

forest(...,bysort=TRUE,...) mixes subgroup effects #28

Closed eisber closed 3 years ago

eisber commented 3 years ago

I think I’m facing a bug when using forest(…, bysort=TRUE). The subgroup p-values don’t seem to match up anymore…

Version: 'meta' package (version 4.15-1).

bysort=FALSE

image

bysort=TRUE

image

Bysort=TRUE, the z=14.05 is now w/ a different group

image

options(repr.plot.width=20, repr.plot.height=60, repr.plot.res = 200)

m.bin <- metacont(InterventionN, IntensityofPainInterventionMean, IntensityofPainInterventionSD, ControlN, IntensityofPainControlMean, IntensityofPainControlSD, data = data, studlab = paste(str_pad(Study, max(sapply(Study, str_length)), 'right'), # Pad it str_pad(InterventionContinuousvsSingleshotvsLiposomalBupivacaine, max(sapply(InterventionContinuousvsSingleshotvsLiposomalBupivacaine, str_length)), 'right'), ComparatorControl, sep=" | "), comb.fixed = TRUE, comb.random = FALSE, byvar=paste(TypeofSurgery, outcome, ComparatorControlClean, sep=" | "), hakn = TRUE, prediction = TRUE)

pdf(file = 'Pain Comparison sort.pdf', width=18, height=40)

forest(m.bin, sortvar=-Year, #paste(ComparatorControl, InterventionContinuousvsSingleshotvsLiposomalBupivacaine, Study), bysort=TRUE, fontfamily="mono", lab.e = "Intervention", pooled.totals = TRUE, pooled.events = TRUE, overall = TRUE, bylab = "", # Label before the subgroup print.tau2 = FALSE, col.diamond = "blue", col.diamond.lines = "black", col.predict = "black", print.I2.ci = TRUE, digits.sd = 2, test.overall = TRUE, test.subgroup = TRUE, print.stat = TRUE, test.effect.subgroup = TRUE )

dev.off()

guido-s commented 3 years ago

Thank you for reporting this bug (which should be fixed now).