Learn R Programming

powerbrmsINLA (version 1.3.0)

plot_power_assurance_overlay: Plot Conditional Power Curves with Assurance Overlay

Description

Shows the conditional power curve for each effect-size value in the design grid (thin lines), overlaid with the unconditional Bayesian assurance curve (thick line). This communicates that assurance is the prior-weighted average of the conditional power curves.

Usage

plot_power_assurance_overlay(
  power_result,
  assurance_result,
  metric = c("direction", "threshold", "rope", "bf"),
  title = NULL,
  subtitle = NULL
)

Value

A ggplot object.

Arguments

power_result

Output from brms_inla_power() (or compatible wrappers) containing a $summary element.

assurance_result

A powerbrmsINLA_assurance object from compute_assurance().

metric

Decision metric to plot: "direction" (default), "threshold", "rope", or "bf".

title, subtitle

Optional plot title and subtitle strings.

Examples

Run this code
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"))
a  <- compute_assurance(pr, list(dist = "normal", mean = 0.5, sd = 0.15))
plot_power_assurance_overlay(pr, a)

Run the code above in your browser using DataLab