forestplot.escalc: Generate a forest plot for an 'escalc' object (based on the...

Description Usage Arguments Details Note Author(s) References See Also Examples

View source: R/bayesmeta.R

Description

Generates a forest plot, showing estimates along with their 95 percent confidence intervals.

Usage

1
2
3
4
  ## S3 method for class 'escalc'
forestplot(x, labeltext, exponentiate=FALSE,
           digits=2, plot=TRUE,
           fn.ci_norm, fn.ci_sum, col, legend, boxsize, ...)

Arguments

x

an escalc object.

labeltext

an (alternative) “labeltext” argument which is then handed on to the forestplot() function (see the help there). You can use this to change contents or add columns to the displayed table; see the example below.

exponentiate

a logical flag indicating whether to exponentiate numbers (effect sizes) in table and plot.

digits

The number of significant digits to be shown. This is interpreted relative to the standard errors of all estimates.

plot

a logical flag indicating whether to actually generate a plot.

fn.ci_norm, fn.ci_sum, col, legend, boxsize, ...

other arguments passed on to the forestplot package's forestplot function (see also the help there).

Details

Generates a forest plot illustrating the data returned by the “escalc()” function (showing the estimates potentially to be meta-analyzed, but without a combined summary estimate).

Note

This function is based on the forestplot package's “forestplot()” function.

Author(s)

Christian Roever christian.roever@med.uni-goettingen.de

References

C. Roever. Bayesian random-effects meta-analysis using the bayesmeta R package. Journal of Statistical Software, 93(6):1-51, 2020.

C. Lewis and M. Clarke. Forest plots: trying to see the wood and the trees. BMJ, 322:1479, 2001.

R.D. Riley, J.P. Higgins and J.J. Deeks. Interpretation of random effects meta-analyses. BMJ, 342:d549, 2011.

See Also

escalc, forestplot, forestplot.bayesmeta.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# load data:
data("CrinsEtAl2014")

# compute effect sizes (log odds ratios) from count data
# (using "metafor" package's "escalc()" function):
crins.es <- escalc(measure="OR",
                   ai=exp.AR.events,  n1i=exp.total,
                   ci=cont.AR.events, n2i=cont.total,
                   slab=publication, data=CrinsEtAl2014)
print(crins.es)

########################
# generate forest plots;
# with default settings:
forestplot(crins.es)

# exponentiate values (shown in table and plot), show vertical line at OR=1:
forestplot(crins.es, expo=TRUE, zero=1)

# logarithmic x-axis:
forestplot(crins.es, expo=TRUE, xlog=TRUE)

# show more decimal places:
forestplot(crins.es, digits=3)

# change table values:
# (here: add columns for event counts)
fp <- forestplot(crins.es, expo=TRUE, plot=FALSE)
labtext <- fp$labeltext
labtext <- cbind(labtext[,1],
                 c("treatment",
                   paste0(CrinsEtAl2014[,"exp.AR.events"], "/", CrinsEtAl2014[,"exp.total"])),
                 c("control",
                   paste0(CrinsEtAl2014[,"cont.AR.events"], "/", CrinsEtAl2014[,"cont.total"])),
                 labtext[,2:3])
labtext[1,4] <- "OR"
print(fp$labeltext) # before
print(labtext)      # after
forestplot(crins.es, labeltext=labtext, expo=TRUE, xlog=TRUE)

# see also the "forestplot" help for more arguments that you may change,
# e.g. the "clip", "xticks", "xlab" and "title" arguments,
# or the "txt_gp" argument for label sizes etc.:
forestplot(crins.es, clip=c(-4,1), xticks=(-3):0,
           xlab="log-OR", title="pediatric transplantation example",
           txt_gp = fpTxtGp(ticks = gpar(cex=1), xlab = gpar(cex=1)))


###########################################################
# In case effects and standard errors are computed already
# (and normally one wouldn't need to call "escalc()")
# you can still use "escalc()" to assemble the plot, e.g.:

data("HinksEtAl2010")
print(HinksEtAl2010)

hinks.es <- escalc(yi=log.or, sei=log.or.se,
                   slab=study, measure="OR",
                   data=HinksEtAl2010)

forestplot(hinks.es)

Example output

Loading required package: forestplot
Loading required package: grid
Loading required package: magrittr
Loading required package: checkmate
Loading required package: metafor
Loading required package: Matrix
Loading 'metafor' package (version 2.4-0). For an overview 
and introduction to the package please type: help(metafor).
      publication year randomized control.type      comparison       IL2RA 
1  Heffron (2003) 2003        yes   concurrent     delayed CNI  daclizumab 
2  Gibelli (2004) 2004         no   historical     IL-2RA only basiliximab 
3 Schuller (2005) 2005         no   concurrent     IL-2RA only  daclizumab 
4 Ganschow (2005) 2005         no   historical     IL-2RA only basiliximab 
5    Spada (2006) 2006        yes   concurrent no/low steroids basiliximab 
6     Gras (2008) 2008         no   historical no/low steroids basiliximab 
             CNI MMF followup exp.AR.events exp.SRR.events exp.PTLD.events 
1     tacrolimus yes       24            14              2              NA 
2 cyclosporine A  no        6            16             NA              NA 
3     tacrolimus yes        6             3             NA               0 
4 cyclosporine A  no       36             9              4               1 
5     tacrolimus  no       12             4             NA               1 
6     tacrolimus  no       36             0              1              NA 
  exp.deaths exp.total cont.AR.events cont.SRR.events cont.PTLD.events 
1          4        61             15               4               NA 
2         NA        28             19              NA               NA 
3         NA        18              8              NA                0 
4          1        54             29               6                0 
5          4        36             11              NA                1 
6          2        50              3               4               NA 
  cont.deaths cont.total      yi     vi 
1           3         20 -2.3097 0.3594 
2          NA         28 -0.4595 0.3096 
3          NA         12 -2.3026 0.7750 
4           3         54 -1.7579 0.2078 
5           3         36 -1.2585 0.4122 
6           3         34 -2.4179 2.3373 
     [,1]              [,2]       [,3]            
[1,] "study"           "estimate" "95% CI"        
[2,] "Heffron (2003)"  "0.099"    "[0.031, 0.322]"
[3,] "Gibelli (2004)"  "0.632"    "[0.212, 1.879]"
[4,] "Schuller (2005)" "0.100"    "[0.018, 0.561]"
[5,] "Ganschow (2005)" "0.172"    "[0.071, 0.421]"
[6,] "Spada (2006)"    "0.284"    "[0.081, 1.000]"
[7,] "Gras (2008)"     "0.089"    "[0.004, 1.783]"
     [,1]              [,2]        [,3]      [,4]    [,5]            
[1,] "study"           "treatment" "control" "OR"    "95% CI"        
[2,] "Heffron (2003)"  "14/61"     "15/20"   "0.099" "[0.031, 0.322]"
[3,] "Gibelli (2004)"  "16/28"     "19/28"   "0.632" "[0.212, 1.879]"
[4,] "Schuller (2005)" "3/18"      "8/12"    "0.100" "[0.018, 0.561]"
[5,] "Ganschow (2005)" "9/54"      "29/54"   "0.172" "[0.071, 0.421]"
[6,] "Spada (2006)"    "4/36"      "11/36"   "0.284" "[0.081, 1.000]"
[7,] "Gras (2008)"     "0/50"      "3/34"    "0.089" "[0.004, 1.783]"
            study year        country   or or.lower or.upper     log.or
1 Prahalad (2006) 2006  United States 0.88     0.71     1.07 -0.1278334
2    Hinks (2006) 2006 United Kingdom 0.79     0.66     0.94 -0.2357223
3  Lindner (2007) 2007         Norway 0.82     0.63     1.08 -0.1984509
   log.or.se
1 0.10463176
2 0.09021595
3 0.13750163

bayesmeta documentation built on Dec. 15, 2020, 5:15 p.m.