forestplot.bayesmeta {bayesmeta} | R Documentation |
Generate a forest plot for a bayesmeta
object
(based on the forestplot
package's plotting functions).
Description
Generates a forest plot, showing individual estimates along with their 95 percent confidence intervals, shrinkage intervals, resulting effect estimate and prediction interval.
Usage
## S3 method for class 'bayesmeta'
forestplot(x, labeltext, exponentiate=FALSE,
prediction=TRUE, shrinkage=TRUE, heterogeneity=TRUE,
digits=2, plot=TRUE,
fn.ci_norm, fn.ci_sum, col, legend=NULL, boxsize, ...)
Arguments
x |
a |
labeltext |
an (alternative) “ |
exponentiate |
a logical flag indicating whether to exponentiate numbers (effect sizes) in table and plot. |
prediction |
a logical flag indicating whether to show the prediction interval below the mean estimate. |
shrinkage |
a logical flag indicating whether to show shrinkage intervals along with the quoted estimates. |
heterogeneity |
a logical flag indicating whether to quote the heterogeneity estimate and CI (at the bottom left). |
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 |
Details
Generates a forest plot illustrating the underlying data and resulting estimates (effect estimate and prediction interval, as well as shrinkage estimates and intervals).
Value
A list containing the following elements:
data |
a |
shrinkage |
a |
labeltext |
a |
forestplot |
result of the call to the
‘ |
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. doi:10.18637/jss.v093.i06.
C. Lewis and M. Clarke. Forest plots: trying to see the wood and the trees. BMJ, 322:1479, 2001. doi:10.1136/bmj.322.7300.1479.
C. Guddat, U. Grouven, R. Bender and G. Skipka. A note on the graphical presentation of prediction intervals in random-effects meta-analyses. Systematic Reviews, 1(34), 2012. doi:10.1186/2046-4053-1-34.
R.D. Riley, J.P. Higgins and J.J. Deeks. Interpretation of random effects meta-analyses. BMJ, 342:d549, 2011. doi:10.1136/bmj.d549.
See Also
bayesmeta
,
forestplot
,
forest.bayesmeta
,
plot.bayesmeta
.
Examples
# load data:
data("CrinsEtAl2014")
## Not run:
# compute effect sizes (log odds ratios) from count data
# (using "metafor" package's "escalc()" function):
require("metafor")
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)
# perform meta analysis:
crins.ma <- bayesmeta(crins.es, tau.prior=function(t){dhalfcauchy(t,scale=1)})
########################
# generate forest plots
require("forestplot")
# default options:
forestplot(crins.ma)
# exponentiate values (shown in table and plot), show vertical line at OR=1:
forestplot(crins.ma, expo=TRUE, zero=1)
# logarithmic x-axis:
forestplot(crins.ma, expo=TRUE, xlog=TRUE)
# omit prediction interval:
forestplot(crins.ma, predict=FALSE)
# omit shrinkage intervals:
forestplot(crins.ma, shrink=FALSE)
# show more decimal places:
forestplot(crins.ma, digits=3)
# change table values:
# (here: add columns for event counts)
fp <- forestplot(crins.ma, 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.ma, 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.ma, 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)))
## End(Not run)