plot.bayesmeta {bayesmeta}R Documentation

Generate summary plots for a bayesmeta object.


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


  ## S3 method for class '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, ...) 



a bayesmeta object.


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


an indicator of which plots to generate.


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


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.


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


other graphical parameters.


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 μ. The shown intervals for μ 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 μ, and for the predictive distribution.

  2. a plot of the joint posterior density of heterogeneity (τ) and effect (μ). Red lines trace the contours of constant density corresponding to approximate 2D credible regions (based on a χ^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 μ as a function of the heterogeneity τ (solid line) along with conditional 95% confidence bounds (dashed lines). Green lines indicate marginal medians and shortest 95% credible intervals for τ and μ.

  3. the marginal posterior probability density of the effect μ 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 τ 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 τ, and then fix this value and estimate the effect μ 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 τ=0 for the fixed-effects model, and a slice a a different τ value for the random-effects model, where the blue lines would then indicate the corresponding estimate and confidence interval for μ.

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).


Returns the supplied bayesmeta object (x).


Christian Roever


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. 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.bayesmeta


## Not run: 
# example data by Snedecor and Cochran:

# analyze using a weakly informative prior
# (may take a few seconds to compute!):
ma <- bayesmeta(y=SnedecorCochran[,"mean"], sigma=sqrt(SnedecorCochran[,"var"]),
                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)

## End(Not run)

[Package bayesmeta version 2.7 Index]