PH 251D Project 2: How to draw a Forest Plot using Rmeta Package.

By: Catherine Yu

*Introduction: For meta-analysis, oftentimes Forest Plots are done using Stata or, rarely, Excel. This is mainly because not a lot of information or instruction is available on how to draw Forest Plots using R. Even with the information that is available on the web, the main audience for those articles is advanced R users who know how to read R codes with fluency.

RMeta is a package in R that was just published last year (10/29/12), for which not that many articles are written about it, even less demonstrations using the package.

My project herein is to teach R beginners to utilize R to perform meta-analysis using RMeta, specifically how to draw a Forest Plot.

*Concept: Forest plots are very useful (and expected) when doing a meta-analysis because it summarizes the effect sizes, confidence intervals and weights of each study in both graphical and numercal forms. The graphical presentation allows the reader of the meta-analysis to quickly gauge how a treatment is with regards to the outcome of interest.

*Background on the data: The topic of the meta-analysis I will be using for this demonstration is the use of Platelet Rich Plasma (PRP) in treating Tendonopathies. This is a hot topic in recent years as famous athletes such as Tiger Woods and Kobe Bryant have reported to treating their musculoskeletal injuries with this new treatment. Although the athletes swear by PRP, studies have shown mixed results. After doing a literature search, I have narrowed my analysis to seven RCT studies.

Something to note about the studies is that the effect sizes are standardized mean differences that I calculated from the data given. I cannot report a raw mean difference because different studies used different scales to measure pain and disability.

*Demonstration: When you start R, make sure you have the rmeta package checked. If not, then type in the following to find and install rmeta:

library(rmeta)
## Loading required package: grid

I saved the following data in a text file named PRP.txt:

Study MeanDiff SE LL UL Krogh2013 0.06098 0.31630 -0.559 0.681 Thanasa2011 0.89203 0.396316 0.113 1.671 Peersom2010 0.20259 0.20055 -0.191 0.596 Creaney2011 -0.24178 0.19228 -0.619 0.135 Gosens2011 -0.19410 0.20051 -0.587 0.199 DeVos2010 -0.02494 0.27218 -0.558 0.509 Rha2012 -0.77408 0.33214 -1.426 -0.122

SE: Standard Error LL: Lower Limit of the 95% CI UL: Upper Limit of the 95% CI

Make sure there is only one space between the columns and no spaces in the study names.

The default plot that metaplot gives when only the effect size and standard error is given is an all-black plot with x-axis labeled as Odds Ratio and 95% confidence intervals around the effect size with no labeling of which effect size corresponds to which study. Also the box area is proportional to 1/SE2 by default.

To change or to add anything to the plot such as change the colors, additional parameters and arguments must be included within the metaplot command. In the following example, I changed the x-axis (xlab) and y-axis labels (ylab), and added study names (labels).

PRP <- read.table("C:/Users/Catherine Yu/Documents/PH 251D/PRP.txt", as.is = TRUE, 
    header = TRUE)
PRP
##         Study MeanDiff     SE     LL     UL
## 1   Krogh2013  0.06098 0.3163 -0.559  0.681
## 2 Thanasa2011  0.89203 0.3963  0.113  1.671
## 3 Peersom2010  0.20259 0.2006 -0.191  0.596
## 4 Creaney2011 -0.24178 0.1923 -0.619  0.135
## 5  Gosens2011 -0.19410 0.2005 -0.587  0.199
## 6   DeVos2010 -0.02494 0.2722 -0.558  0.509
## 7     Rha2012 -0.77408 0.3321 -1.426 -0.122
attach(PRP)
metaplot(MeanDiff, SE, labels = Study, xlab = "Mean Difference", ylab = "Study")

plot of chunk unnamed-chunk-2

The above shows a very basic Forest Plot. Most Forest Plots include the effect measures of individual studies and a summary measure as well.

To make a Forest Plot that includes the summary measure: 1) You can run a meta.summaries command and plot the output:

d <- meta.summaries(MeanDiff, SE, names = Study, method = c("fixed"))
summary(d)
## Fixed-effects meta-analysis
## Call: meta.summaries(d = MeanDiff, se = SE, method = c("fixed"), names = Study)
## ----------------------------------------------------
##             Effect (lower  95% upper) weights
## Krogh2013     0.06   -0.56       0.68     0.6
## Thanasa2011   0.89    0.12       1.67     0.4
## Peersom2010   0.20   -0.19       0.60     1.5
## Creaney2011  -0.24   -0.62       0.14     1.6
## Gosens2011   -0.19   -0.59       0.20     1.5
## DeVos2010    -0.02   -0.56       0.51     0.8
## Rha2012      -0.77   -1.43      -0.12     0.5
## ----------------------------------------------------
## Summary effect: -0.06 95% CI ( -0.25,0.12 )
## Test for heterogeneity: X^2( 6 ) = 13.61 ( p-value 0.0343 )
plot(d, summary = TRUE, summlabel = "Summary", xlab = "Mean Difference", main = "Use of PRP to treat Tendonopathies")

plot of chunk unnamed-chunk-3

The “fixed” is for Fixed Effects Model. This can be substituted with “Random” for Random Effects Model. Summary = TRUE puts the summary measures onto the graph. If you put FALSE, it will look like the regular simple metaplot we did above.

2) You can also run the forestplot command. The forestplot command may be preferred (although requires more work to code) because you can add a table of text onto the plot to display numerical data as well as graphical:

PRP <- read.table("C:/Users/Catherine Yu/Documents/PH 251D/PRP.txt", as.is = TRUE, 
    header = TRUE)
d <- meta.summaries(MeanDiff, SE, names = Study, method = c("fixed"), data = PRP)
tabletext <- cbind(c("", "Study", PRP$Study, NA, "Summary"), c("95%", "Lower", 
    PRP$LL, NA, NA), c("C.I.", "Upper", PRP$UL, NA, NA), c("", "Mean Diff", 
    PRP$MeanDiff, NA, round(d$summary, 2)))
m <- c(NA, NA, PRP$MeanDiff, NA, d$summary)
l <- c(NA, NA, PRP$LL, NA, d$summary - d$se.summary * 1.96)
u <- c(NA, NA, PRP$UL, NA, d$summary + d$se.summary * 1.96)
forestplot(tabletext, m, l, u, zero = 0, is.summary = c(TRUE, TRUE, rep(FALSE, 
    8), TRUE), boxsize = 0.5)
title(xlab = "Mean Difference", main = "Use of PRP to treat Tendonopathies")

plot of chunk unnamed-chunk-4

First you must stitch together the columns with cbind. That's what I did, and I saved it under 'tabletext'. You can enter in names(d) to find variables are named which was very helpful in writing the forestplot codes. I defined m (mean), l (lower bound of confidence interval) and u (upper bound of confidence interval) so that the forestplot command knows what to graph. Alternative to what I have, you can also define l and u like the following:

l <- m - c(NA, NA, d$stderrs, NA, d$se.summary) * 1.96
u <- m + c(NA, NA, d$stderrs, NA, d$se.summary) * 1.96

If you look at it, it looks like a regular confidence interval equation: point estimate +/- 1.96*SE. If you think about the code this way, it will be easier to know how to define it.

Some other useful notes on the forest plot: is.summary bolds the column titles and summary line. TRUE means bold boxsize changes the size of the effect measure squares.

*Discussion: The two methods I talked about in this paper to make a Forest Plot using RMeta package are what I have found to be very helpful for my meta-analysis. The instructions herein are simple and more arguments can be added to make the plots more complex and sophisticated. I think making Forest Plots in R is both complicated and flexible. Although making Forest Plots in Stata is very easy, Stata does not allow much flexibility on plot customization, which R allows. The possibilities of what a Forest Plot can include is endless with RMeta.