# [R-meta] Antwort: RE: Antwort: RE: metafor - averaging over rma result

steph@@ie@wi@keibei@er m@iii@g oii bii@uzh@ch steph@@ie@wi@keibei@er m@iii@g oii bii@uzh@ch
Fri Nov 1 10:07:53 CET 2019

```Dear Wolfgang,

I hadn't tried that yet but will do so immediately.

Best,
Stephanie
-----"Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer using maastrichtuniversity.nl> schrieb: -----
An: "stephanie.winkelbeiner using bli.uzh.ch" <stephanie.winkelbeiner using bli.uzh.ch>
Von: "Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer using maastrichtuniversity.nl>
Datum: 28.10.2019 12:35
Kopie: "r-sig-meta-analysis using r-project.org" <r-sig-meta-analysis using r-project.org>
Betreff: RE: Antwort: RE: [R-meta] metafor - averaging over rma result

Dear Stephanie,

Aggregating per disorder would be another option. This isn't all that different from the approach I described below, except that it allows tau^2 to differ per disorder, while the approach I described assumes a common tau^2 regardless of the disorder. But one can allow tau^2 to differ across disorders as well:

http://www.metafor-project.org/doku.php/tips:comp_two_independent_estimates

To use the same example:

library(metafor)

dat <- dat.bourassa1996

# calculate log(OR) and corresponding sampling variances
dat <- escalc(measure="OR", ai=lh.le, bi=lh.re, ci=rh.le, di=rh.re, data=dat, subset=sex=="combined")
dat

# fit model
res1 <- rma(yi, vi, mods = ~ eye_assess - 1, data=dat)
res1

# allow tau^2 to differ across groups
res2 <- rma.mv(yi, vi, mods = ~ eye_assess - 1, random = ~ eye_assess | sample, struct="DIAG", data=dat)
res2

# fit model per group
res3 <- lapply(split(dat, dat\$eye_assess), function(x) rma(yi, vi, data=x))

# compare coefficients
cbind(coef(res1), coef(res2), sapply(res3, function(x) coef(x)))

# compare tau^2 estimates
cbind(res1\$tau2, res2\$tau2, sapply(res3, function(x) x\$tau2))

The minor differences in res2 and res3 are due to slight differences in the optimization methods.

I assume your overall model doesn't allow for different tau^2 values per disorder, so it is basically this:

res4 <- rma(yi, vi, data=dat)
res4

One could also make the argument that the most sensible thing is to fit a model assuming a common tau^2, but fixing the tau^2 to the one from the overall model:

res5 <- rma(yi, vi, mods = ~ eye_assess - 1, data=dat, tau2=res4\$tau2)

The reason is that one can then meta-analyze the coefficients from that model and obtain the the same results as the ones from the overall model:

rma(coef(res5), vi=diag(vcov(res5)), method="FE")

(things like I^2, H^2, and the Q-test are different, but the rest is the same)

Best,
Wolfgang

-----Original Message-----
From: stephanie.winkelbeiner using bli.uzh.ch [mailto:stephanie.winkelbeiner using bli.uzh.ch]
Sent: Thursday, 24 October, 2019 20:18
To: Viechtbauer, Wolfgang (SP)
Cc: r-sig-meta-analysis using r-project.org
Subject: Antwort: RE: [R-meta] metafor - averaging over rma result

Dear Wolfgang,

Do I understand correctly that you, from a statistical point of view, would not
recommend aggregating over the rma results by disorder and then plotting those in a
forest plot, considering that this would not accurately represent the overall intercept
as well as would lead to a bias in the VRs and corresponding CIs in the plot?

Thanks for your take on that.

Best,
Stephanie

-----"Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer using maastrichtuniversity.nl> schrieb: -----
An: "stephanie.winkelbeiner using bli.uzh.ch" <stephanie.winkelbeiner using bli.uzh.ch>, "r-sig-meta-analysis using r-project.org" <r-sig-meta-analysis using r-project.org>
Von: "Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer using maastrichtuniversity.nl>
Datum: 22.10.2019 17:03
Betreff: RE: [R-meta] metafor - averaging over rma result
Dear Stephanie,

My suggestion would be to fit a sensible model that uses 'disorder' as a predictor and then plot the model coefficients using the forest() function. Here is an example, not using VRs, but the idea is the same:

library(metafor)

dat <- dat.bourassa1996

# calculate log(OR) and corresponding sampling variances
dat <- escalc(measure="OR", ai=lh.le, bi=lh.re, ci=rh.le, di=rh.re, data=dat)
dat

# fit model
res <- rma(yi, vi, mods = ~ eye_assess - 1, data=dat, subset=sex=="combined")
res

# by removing the intercept, the coefficients are the estimated log(OR)s for each level of 'eye_assess'

# pass coefficients and variance of the coefficients to forest() function
forest(coef(res), diag(vcov(res)), slab=names(coef(res)), atrans=exp,
at = c(log(c(1, 2, 4, 8, 16, 32))), xlab="Odds Ratio (log scale)")

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of stephanie.winkelbeiner using bli.uzh.ch
Sent: Tuesday, 22 October, 2019 15:44
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] metafor - averaging over rma result

Dear experts,

for a meta-analysis, we calculated the variability ratio (VR) of all included studies
using the rma function of the metafor package.

We would like to plot the results in a forest plot grouped by disorder for a less
busy presentation (compared to plotting the VR for every study).

Yet, averaging over the VRs, especially over the confidence intervals seems
worrying.

Do you have any suggestions?

Thank you,
Stephanie

[[alternative HTML version deleted]]

```