Learn R Programming

bayesmeta (version 3.4)

plot.bayesmeta: Generate summary plots for a bayesmeta object.

Description

Generates a forest plot, and joint and marginal posterior density plots for the two parameters of the random-effects meta-analysis model.

Usage

# S3 method for bayesmeta
plot(x, main=deparse(substitute(x)),
     which=1:4, prior=FALSE, forest.margin=8,
     mulim=c(NA,NA), taulim=c(NA,NA),
     violin=FALSE, ...)

Value

Returns the supplied bayesmeta object (x).

Arguments

x

a bayesmeta object.

main

a character string giving the main title for the plot(s).

which

an indicator of which plots to generate.

prior

an indicator whether to also draw the prior density in marginal posterior density plots.

forest.margin

the width of the margin to the left of the forest plot. This may require some manual tweaking so that the study labels fit properly.

mulim, taulim

(optional) ranges of effect (mu) and heterogeneity (tau) values to be used for plotting.

violin

an indicator whether to draw the forest plot as a “violin plot”.

...

other graphical parameters.

Details

Depending on the value of the which argument, one or several plots are generated, namely

  1. a forest plot, including a 95% credible interval (diamond) and a 95% prediction interval (rectangle) for the effect \(\mu\). The shown intervals for \(\mu\) are based on posterior medians and shortest credible intervals (from x$summary). If violin=TRUE, the forest plot is plotted as a “violin plot”, i.e., via Gaussian densities for the estimates \(y_i\) (and their associated uncertainties), and the posterior densities for the effect \(\mu\), and for the predictive distribution.

  2. a plot of the joint posterior density of heterogeneity (\(\tau\)) and effect (\(\mu\)). Red lines trace the contours of constant density corresponding to approximate 2D credible regions (based on a \(\chi^2\)-approximation to the logarithmic posterior density) as labelled. The credible regions are only an approximation based on a ‘well-behaved’, unimodal posterior; contour lines are omitted if the posterior mode is not finite. Blue lines show the conditional mean effect \(\mu\) as a function of the heterogeneity \(\tau\) (solid line) along with conditional 95% confidence bounds (dashed lines). Green lines indicate marginal medians and shortest 95% credible intervals for \(\tau\) and \(\mu\).

  3. the marginal posterior probability density of the effect \(\mu\) with median and shortest 95% credible interval indicated. Depending on the prior argument, a dashed line showing the prior density is added. Note that for improper priors the scaling is arbitrary and may be inappropriate for the plot.

  4. the marginal posterior probability density of the heterogeneity \(\tau\) with median and shortest 95% credible interval indicated. Depending on the prior argument, a dashed line showing the prior density is added. Note that for improper priors the scaling is arbitrary and may be inappropriate for the plot.

The joint posterior density plot (2) especially highlights the dependence of the effect estimate on the heterogeneity parameter. In a ‘conventional’ frequentist meta-analysis, one would commonly first estimate the heterogeneity \(\tau\), and then fix this value and estimate the effect \(\mu\) based on the assumption that the heterogeneity estimate was the true value. In the joint density plot, this would correspond to considering vertical “slices” of the parameter space, a slice at \(\tau=0\) for the fixed-effects model, and a slice a a different \(\tau\) value for the random-effects model, where the blue lines would then indicate the corresponding estimate and confidence interval for \(\mu\).

Note that when using the prior=TRUE argument, the added line may end up be outside the plotted range, especially when using improper priors with arbitrary normalisation (consider adding it “manually” instead).

References

C. Roever. Bayesian random-effects meta-analysis using the bayesmeta R package. Journal of Statistical Software, 93(6):1-51, 2020. tools:::Rd_expr_doi("10.18637/jss.v093.i06").

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. tools:::Rd_expr_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. tools:::Rd_expr_doi("10.1136/bmj.d549").

See Also

bayesmeta, forestplot.bayesmeta

Examples

Run this code
if (FALSE) {
# example data by Snedecor and Cochran:
data("SnedecorCochran")

# analyze using a weakly informative prior
# (may take a few seconds to compute!):
ma <- bayesmeta(y=SnedecorCochran[,"mean"], sigma=sqrt(SnedecorCochran[,"var"]),
                label=SnedecorCochran[,"no"],
                mu.prior.mean=50, mu.prior.sd=50,
                tau.prior=function(x){dhalfcauchy(x, scale=10)})

# show some plots:
plot(ma, main="Snedecor/Cochran data", prior=TRUE)
plot(ma, main="Snedecor/Cochran data", which=1, violin=TRUE)
}

Run the code above in your browser using DataLab