plot_assurance_curve: Plot Assurance Curve(s) vs Sample Size

View source: R/plotting-assurance.R

plot_assurance_curveR Documentation

Plot Assurance Curve(s) vs Sample Size

Description

Plots unconditional Bayesian assurance against sample size for one or more design priors, with an optional horizontal reference line at a target assurance level. Each prior produces one line, making it easy to compare how the choice of design prior changes the required sample size.

Usage

plot_assurance_curve(
  assurance_results,
  labels = NULL,
  target = 0.8,
  title = NULL,
  subtitle = NULL
)

Arguments

assurance_results

A single powerbrmsINLA_assurance object (from compute_assurance()) or a list of such objects.

labels

Character vector naming each design prior, e.g. c("Sceptical", "Primary", "Optimistic"). Defaults to "Design prior" for a single object or "Prior 1", "Prior 2", … for multiple objects.

target

Numeric in (0, 1): horizontal reference line added at this assurance level (default 0.80). Set to NULL to suppress the line.

title, subtitle

Optional plot title and subtitle strings.

Value

A ggplot object.

Examples

syn_summary <- data.frame(
  n               = rep(c(50, 100, 200), each = 3),
  treatment       = rep(c(0.2, 0.5, 0.8), 3),
  power_direction = c(0.40, 0.65, 0.85, 0.60, 0.82, 0.95, 0.72, 0.90, 0.98)
)
pr <- list(summary = syn_summary, settings = list(effect_name = "treatment"))
a1 <- compute_assurance(pr, list(dist = "normal", mean = 0.5, sd = 0.15))
a2 <- compute_assurance(pr, list(dist = "normal", mean = 0.5, sd = 0.30))
plot_assurance_curve(list(a1, a2), labels = c("Informative", "Diffuse"))


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