ChrisP - 10 months ago 56

R Question

I am meta-analysing data from ~90 studies. This presents some challenges in how to display the data in an accessible format for publication. I would like to display only the overall effect size estimates of the different meta-analyses and exclude the study-specific estimates. I am able to do this in Stata using the

`metan`

`summaryonly`

`metafor`

I've been using the

`addpoly`

`res.a <- rma(n1i = Intervention_n, n2i = Control_n, m1i = intervention_d, m2i = control_d, sd1i = intervention_d_sd,`

sd2i = control_d_sd, measure="MD", intercept=TRUE, data = Dataset.a, vtype="LS", method="DL", level=95,

digits=4, subset = (exclude==0 & child=="No"), slab=paste(Dataset.a$Label, Dataset.a$Year, sep=", "))

addpoly(res.a, row=7.5, cex=.75, font=3, mlab="Random effects model for subgroup")

Answer

If I understand you correctly, you are conducting several analyses with these ~90 studies (e.g., based on different subsets) and your goal is to show only the summary estimates (as based on these analyses) in a forest plot. Then the easiest approach would be to just collect the estimates and corresponding variances of the various analyses in a vector and then pass that to the `forest()`

function. Let me give a simple example:

```
### load metafor package
library(metafor)
### load BCG vaccine dataset
data(dat.bcg)
### calculate log relative risks and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
### fit random-effects models to some subsets
res.r <- rma(yi, vi, data=dat, subset=alloc=="random")
res.s <- rma(yi, vi, data=dat, subset=alloc=="systematic")
res.a <- rma(yi, vi, data=dat, subset=alloc=="alternate")
### collect model estimates and corresponding variances
estimates <- c(coef(res.r), coef(res.s), coef(res.a))
variances <- c(vcov(res.r), vcov(res.s), vcov(res.a))
### create vector with labels
labels <- c("Random Allocation", "Systematic Allocation", "Alternate Allocation")
### forest plot
forest(estimates, variances, slab=labels)
```

If you don't like that the point sizes differ (by default, they are drawn inversely proportional to the variances), you could use:

```
forest(estimates, variances, slab=labels, psize=1)
```

A couple other improvements:

```
forest(estimates, variances, slab=labels, psize=1, atransf=exp, xlab="Relative Risk (log scale)", at=log(c(.2, .5, 1, 2)))
```

**ADDENDUM**

In case you prefer polygon shapes for the estimates, you could do the following. First draw the plot as above, but use `efac=0`

to hide the vertical lines on the CIs. Then just draw over the summary polygons with `addpoly()`

:

```
forest(estimates, variances, slab=labels, psize=1, atransf=exp, xlab="Relative Risk (log scale)", at=log(c(.2, .5, 1, 2)), efac=0)
addpoly(estimates, variances, atransf=exp, rows=3:1, col="white", annotate=FALSE)
```

You can also use `efac=1.5`

in `addpoly()`

to stretch the polygons vertically. Adjust the factor to your taste.

Source (Stackoverflow)