Learn R Programming

see (version 0.6.4)

plot.see_parameters_brms_meta: Plot method for Model Parameters from Bayesian Meta-Analysis

Description

The plot() method for the parameters::model_parameters() function when used with brms-meta-analysis models.

Usage

# S3 method for see_parameters_brms_meta
plot(
  x,
  size_point = 2,
  size_line = 0.8,
  size_text = 3.5,
  posteriors_alpha = 0.7,
  rope_alpha = 0.15,
  rope_color = "cadetblue",
  normalize_height = TRUE,
  ...
)

Arguments

x

An object.

size_point

Size of point-geoms.

size_line

Size of line geoms.

size_text

Size of text labels.

posteriors_alpha

Alpha value of the posterior distributions.

rope_alpha

Transparency level of ROPE ribbon.

rope_color

Color of ROPE ribbon.

normalize_height

Logical, if TRUE, height of mcmc-areas is "normalized", to avoid overlap. In certain cases when the range of a posterior distribution is narrow for some parameters, this may result in very flat mcmc-areas. In such cases, set normalize_height = FALSE.

...

Arguments passed to or from other methods.

Value

A ggplot2-object.

Details

Colors of density areas and errorbars

To change the colors of the density areas, use scale_fill_manual() with named color-values, e.g. scale_fill_manual(values = c("Study" = "blue", "Overall" = "green")). To change the color of the error bars, use scale_color_manual(values = c("Errorbar" = "red")).

Show or hide estimates and CI

Use size_text = NULL or size_text = NA to hide the textual output of estimates and credible intervals.

Examples

Run this code
# NOT RUN {
if (require("bayestestR") && require("brms") && require("metafor")) {
  +
    # data
    data(dat.bcg)
  dat <- escalc(
    measure = "RR",
    ai = tpos,
    bi = tneg,
    ci = cpos,
    di = cneg,
    data = dat.bcg
  )
  dat$author <- make.unique(dat$author)

  # model
  set.seed(123)
  priors <- c(
    prior(normal(0, 1), class = Intercept),
    prior(cauchy(0, 0.5), class = sd)
  )
  model <- brm(yi | se(vi) ~ 1 + (1 | author), data = dat)

  # result
  mp <- model_parameters(model)
  plot(mp)
}
# }

Run the code above in your browser using DataLab