[R-meta] DECOMPOSING RESIDUAL HETEROGENEITY

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Fri Jan 20 15:55:04 CET 2023


Dear Segun,

To obtain these Q-statistics, you have to add the interaction between the study 'design' variable and the treatment variables to the model (and use a model without random effects). Here is code to illustrate this.

###################################################

library(metafor)

dat <- dat.senn2013

dat <- dat[c(1,4:2,5:6)] # reorder variables first
dat <- to.wide(dat, study="study", grp="treatment", ref="placebo", grpvars=4:6)
dat

### calculate mean difference and corresponding sampling variance for each treatment comparison
dat <- escalc(measure="MD", m1i=mi.1, sd1i=sdi.1, n1i=ni.1,
                            m2i=mi.2, sd2i=sdi.2, n2i=ni.2, data=dat)
dat

### note: pairwise() rounds the effect sizes to two decimal places, so do the same here
dat$yi <- round(dat$yi, 2)

### calculate the variance-covariance matrix of the mean differences for the multitreatment studies
calc.v <- function(x) {
   v <- matrix(x$sdi.2[1]^2 / x$ni.2[1], nrow=nrow(x), ncol=nrow(x))
   diag(v) <- x$vi
   v
}
V <- bldiag(lapply(split(dat, dat$study), calc.v))

### add contrast matrix to dataset
dat <- contrmat(dat, grp1="treatment.1", grp2="treatment.2")
dat

### network meta-analysis using a contrast-based random-effects model
res1 <- rma.mv(yi, V, mods = ~ acarbose + benfluorex + metformin + miglitol + pioglitazone +
                               rosiglitazone + sitagliptin + sulfonylurea + vildagliptin - 1,
               random = ~ comp | study, rho=1/2, data=dat)
res1

### QE statistic is Q 'Total' from netmeta()

res2 <- rma.mv(yi, V, mods = ~ acarbose + benfluorex + metformin + miglitol + pioglitazone +
                               rosiglitazone + sitagliptin + sulfonylurea + vildagliptin +
                               (acarbose + benfluorex + metformin + miglitol + pioglitazone +
                               rosiglitazone + sitagliptin + sulfonylurea + vildagliptin):design - 1,
                               data=dat)

### QE statistic is Q 'Within designs' (Q.heterogeneity) from netmeta()
res2

### QM statistic is Q 'Between designs' (Q.inconsistency) from netmeta()
anova(res2, btt="design")

library(netmeta)

dat <- dat.senn2013

dat <- pairwise(treatment, sm="MD", mean=mi, sd=sdi, n=ni, studlab=study, data=dat)

res3 <- netmeta(TE, seTE, treat1, treat2, studlab=study, data=dat,
                reference.group="placebo", common=FALSE, method.tau="REML")
res3

###################################################

Despite using REML in both rma.mv() and netmeta(), the estimate of tau^2 is just slightly different between res1 and res3 (and hence the estimated fixed effects are also just slightly different). It is not entirely clear to me why there is this discrepancy in the estimated value of tau^2 (when removing the three-arm study, Willms (1999), then results are exactly identical). I hope the netmeta authors could chime in here.

Best,
Wolfgang

>I have been experimenting with the Senn2013 data in the Metafor package
>and while trying to reproduce the results, I have been having difficulty
>decomposing the residual heterogeneity ( QE( df=18) = 96.9841, Pval
><0.0001) into within study and between study heterogeneity like I could
>do with netmeta. At least to help me assess the inconsistency in the
>network meta-analysis.
>
>I will really appreciate if you could advise me on how to go about it.
>
>Thank you so much for all your great work.


More information about the R-sig-meta-analysis mailing list