plot_design_prior: Plot Design Prior Density over the Effect Grid

View source: R/plotting-assurance.R

plot_design_priorR Documentation

Plot Design Prior Density over the Effect Grid

Description

Visualises one or more design prior distributions over the effect-size range used in a power analysis. Vertical dashed lines mark the grid points at which power was simulated, helping assess prior-grid alignment.

Usage

plot_design_prior(
  prior_spec,
  effect_grid,
  labels = NULL,
  n_points = 300L,
  title = NULL,
  subtitle = NULL
)

Arguments

prior_spec

A single prior specification list (e.g. list(dist = "normal", mean = 0.5, sd = 0.15)) or a list of such lists. Supported distributions: "normal" (mean, sd), "uniform" (min, max), "beta" (shape1, shape2 or mode, n).

effect_grid

Numeric vector of effect-grid values passed to brms_inla_power(). Vertical dashed lines are drawn at each value.

labels

Character vector naming each prior. Defaults to "Design prior" for a single spec or "Prior 1", "Prior 2", … for multiple.

n_points

Number of x points at which to evaluate the density curve (default 300).

title, subtitle

Optional plot title and subtitle strings.

Value

A ggplot object.

Examples

plot_design_prior(
  prior_spec  = list(dist = "normal", mean = 0.5, sd = 0.15),
  effect_grid = c(0.2, 0.5, 0.8)
)

# Multiple priors
plot_design_prior(
  prior_spec  = list(
    list(dist = "normal", mean = 0.5, sd = 0.10),
    list(dist = "normal", mean = 0.5, sd = 0.30)
  ),
  effect_grid = c(0.2, 0.5, 0.8),
  labels      = c("Informative", "Diffuse")
)


powerbrmsINLA documentation built on July 2, 2026, 5:07 p.m.