| addpoly.rma {metafor} | R Documentation |
Function to add a polygon to a forest plot showing the summary estimate with correspondong confidence interval based on an object of class "rma".
## S3 method for class 'rma':
addpoly(x, row=-2, level=x$level, digits=2, annotate=TRUE,
mlab=NULL, transf=FALSE, atransf=FALSE, targs=NULL,
col="black", efac=1, cex=NULL, ...)
x |
an object of class "rma". |
row |
integer specifying the row number where the polygon should be placed (default is -2). |
level |
a numerical value between 0 and 100 specifying the confidence interval level (the default is to take the value from the object). |
digits |
integer value specifying the number of decimal places to which the annotations should be rounded (default is 2). |
annotate |
logical specifying whether annotations for the summary estimate should be added to the plot (default is TRUE). |
mlab |
optional character string giving a label for the summary estimate polygon. Defaults to NULL, which means that the label is created within the function. |
transf |
an optional argument specifying the name of a function that should be used to transform the summary estimate and confidence interval bound. Defaults to FALSE, which means that no transformation is used. |
atransf |
an optional argument specifying the name of a function that should be used to transform the annotations. Defaults to FALSE, which means that no transformation is used. |
targs |
optional arguments needed by the function specified via transf or atransf. |
col |
color of the polygon that is drawn (default is "black"). |
efac |
vertical expansion factor for the polygon. The default value of 1 should usually work okay. |
cex |
an optional symbol expansion factor. If NULL (default), the function tries to set this to a sensible value. |
... |
other arguments. |
The function can be used to add a polygon to an existing forest plot created with the forest function. The polygon shows the summary estimate based on a fixed- or random-effects model.
The arguments transf, atransf, efac, and cex should always be set equal to the same values used to create the forest plot.
Wolfgang Viechtbauer; wvb@www.wvbauer.com; http://www.wvbauer.com/
### load BCG vaccine data
data(dat.bcg)
### meta-analysis of the log risk ratios using the Mantel-Haenszel method
res <- rma.mh(ai=tpos, bi=tneg, ci=cpos, di=cneg, slab=paste(author, year),
data=dat.bcg, measure="RR")
### forest plot of the observer risk ratios with summary estimate
forest(res, atransf=exp, addrows=1, xlab="Relative Risk (log scale)")
### meta-analysis of the log risk ratios using a random-effects model
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, measure="RR", method="REML")
### add summary estimate from the random-effects model to forest plot
addpoly(res, atransf=exp)