baggr_plot function

Plotting method in baggr package

Plotting method in baggr package

Extracts study effects from the baggr model and plots them, possibly next to the hypereffect estimate.

baggr_plot( bg, hyper = FALSE, style = c("intervals", "areas", "forest_plot"), transform = NULL, prob = 0.5, prob_outer = 0.95, vline = TRUE, order = TRUE, values_outer = TRUE, values_size = 4, values_digits = 1, ... )

Arguments

  • bg: object of class baggr
  • hyper: logical; show hypereffect as the last row of the plot? alternatively you can pass colour for the hypermean row, e.g. hyper = "red"
  • style: "forest_plot" imitates the visual style of forest plots and also prints means and intervals next to each row; "intervals" (default) or "areas" use package bayesplot styles
  • transform: a function (e.g. exp(), log()) to apply to the values of group (and hyper, if hyper=TRUE) effects before plotting; when working with effects that are on log scale, exponent transform is used automatically, you can plot on log scale by setting transform = identity
  • prob: Probability mass for the inner interval in visualisation
  • prob_outer: Probability mass for the outer interval in visualisation
  • vline: logical; show vertical line through 0 in the plot?
  • order: logical; sort groups by magnitude of treatment effect?
  • values_outer: logical; use the interval corresponding to prob_outer when style = "forest_plot"? if not, the "inner" interval (prob) is used
  • values_size: size of the text values in the plot when style = "forest_plot"
  • values_digits: number of significant digits to use when style = "forest_plot"
  • ...: extra arguments to pass to the bayesplot functions

Returns

ggplot2 object

Examples

fit <- baggr(schools, pooling = "none") plot(fit, hyper = "red") plot(fit, style = "areas", order = FALSE) plot(fit, style = "forest_plot", order = FALSE)

See Also

bayesplot::MCMC-intervals for more information about bayesplot functionality; forest_plot for a typical meta-analysis alternative (which you can imitate using style = "forest_plot"); effect_plot for plotting treatment effects for a new group

Author(s)

Witold Wiecek; the visual style is based on bayesplot package

  • Maintainer: Witold Wiecek
  • License: GPL (>= 3)
  • Last published: 2024-02-12