[R-meta] Forest plot help!

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Jul 2 16:41:57 CEST 2019


Hi Lauren,

You can do this with metafor. Here is an example:

library(metafor)

### meta-analysis of log incidence rates (per 1000 person days)
res <- rma(measure="IRLN", xi=x1i, ti=t1i/1000, data=dat.nielweise2008, slab=paste0(authors, ", ", year))
res

### forest plot of log incidence rates
forest(res, refline=NA)

### forest plot of incidence rates (transform estimates/bounds directly)
forest(res, refline=NA, transf=exp)

### forest plot of incidence rates (use log scale on x-axis)
forest(res, refline=NA, atransf=exp)

The last one does exactly what you are asking for.

### some further tweaking
forest(res, refline=NA, atransf=exp, xlim=c(-9, 9), at=log(c(.04, .2, 1, 5, 25)))
text(-9, 11, "Author(s) and Year",      pos=4, font=2)
text( 9, 11, "Incidence Rate [95% CI]", pos=2, font=2)

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Graybill, Lauren Aiko
Sent: Tuesday, 02 July, 2019 15:43
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] Forest plot help!

Hi everyone,

I was hoping that folks on this mailing list may be able to help me out with some code. I'm working on a meta-analysis of incidence rates and would like to include a forest plot where the 95% confidence interval of each contributing estimate is symmetrical around the estimate (something we anticipate being asked about once we submit the manuscript for publication, so trying to get ahead here). This is possible if I plot natural log-transformed estimates, but for interpretability, I'd like to have everything exponentiated to the actual incidence rate per 100 PY. I imagine I may be able to achieve symmetrical 95% CIs if I plot log-transformed estimates and then change the label of the x-axis such that it shows exponentiated numbers...but I'm not sure how to do this. 

Currently, I use the metarate function, followed by the forest function, where I plot the actual IR (not the log-transformed IR):

crude_1fp <- metarate(event=Seroconversions, time=PY, data=ir, studlab=cite, 
                    exclude=NULL, method="inverse", sm=("IRLN"), incr=0.5, allincr=FALSE, 
                    level=(0.95), level.comb=(0.95), comb.fixed=FALSE, comb.random=TRUE, 
                    prediction=TRUE, method.tau="REML", irscale=100, irunit="Person-Years", 
                    title="HIV Incidence Rates")

forest(crude_1fp, digits=1, fontsize=10, spacing=0.8, xlim=c(0,20), squaresize=0.75, 
       overall=TRUE, prediction=TRUE, pooled.events=TRUE, pooled.times=TRUE, 
       hetstat=TRUE, rightcols = c("effect", "ci"), rightlabs = c("Rate", "[95% CI]"), 
       leftcols = c("studlab", "event", "time"), leftlabs = c("Study", "Events", "PY"), 
       smlab = "Incidence Rate per 100 PY")

I sense I may need to recode the forest plot using ggplot2, but was wondering if there is a quick fix with the forest function?

Thanks so much in advance,
Lauren



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