Closed VanioLjrAntunes closed 5 months ago
Thank you for pointing out this inconsistency.
The problem with subgroup random effects meta-analysis is that two sets of random effects weights exist if separate estimates are allowed for the between-study variance in subgroups:
meta.subgroups$tau2
meta.isolated$tau2
for subgroup AIn your Scenario 1, weights based on the overall tau2 had been printed. This makes sense if the random effects estimate is shown (which is not the case in your Scenario 1).
Now, the subgroup-specific tau2s are used to calculate the percentage weights if argument overall = FALSE
.
Thank you for your response! However, in both scenarios I used the overall = FALSE. Shouldn't both scenarios use the subgroup-specific tau2?
The subgroup estimates (diamonds for subgroup results in the forest plot) use the subgroup-specific tau2.
However, list element w.random
of a meta-analysis object always contains the weights of the overall analysis. This is due to always storing the overall random effects estimate in a meta-analysis object, i.e., list elements TE.random
, seTE.random
, ...; regardless whether argument random = FALSE
or overall = FALSE
was used in the creation of the meta-analysis object.
It makes sense! So what would be the name of the variable which storage the "w.random" version of subgroup-specific tau2?
There is no variable with this information.
You could calculate this information with the following R code (w.separate = weight; p.separate = percentage contribution to subgroup estimate).
set.seed(1909)
subgr <- as.numeric(sample(100, 10) > 40) + 1
m <- metagen(1:10, runif(10, 0.8, 1.2), subgroup = LETTERS[subgr])
m
w.separate <- rep(NA, length(m$w.random))
p.separate <- rep("", length(m$w.random))
w.separate.w <- rep(NA, length(m$w.random.w))
names(w.separate.w) <- names(m$w.random.w)
for (i in unique(m$subgroup)) {
sel.i <- m$subgroup == i
w.separate[sel.i] <- 1 / (m$seTE[sel.i]^2 + replaceNA(m$tau.w[i]^2, 0))
w.separate.w[i] <- sum(w.separate[sel.i])
p.separate[sel.i] <- paste0(round(100 * w.separate[sel.i] / w.separate.w[i], 1), "%")
}
data.frame(p.separate, w.separate,
p.overall = paste0(round(100 * m$w.random / sum(m$w.random), 1), "%"),
w.overall = m$w.random)
m$w.random.w
w.separate.w
sum(w.separate)
sum(w.separate.w)
sum(m$w.random)
sum(m$w.random.w)
Perfect! I will implement right away in my scripts. Thank so much, Dr. Schwarzer!
Note: for support questions on R package meta, please use the R-sig-meta-analysis mailing list. This repository's issues are reserved for feature requests and bug reports.
Classification of issue
Please indicate whether you want to submit a
Summary
I have encountered an inconsistency with the metabin function while conducting a recent meta-analysis involving subgroups. Specifically, I have observed a discrepancy in the weights of individual studies within subgroup A under different scenarios.
Despite the overall results being identical, the weights of the individual studies in subgroup A differ between the two situations.
Additional information
Here is the data used in this example data_example.xlsx
Here is the script used
Here we have the summary of the meta.objects
I saved the forest plots as png to ilustrate better the problem Screenshot A: Scenario 1
Screenshot B: Scenario 2
Environment