plot_precision_fan_chart: Precision conditional power as a function of sample size

View source: R/plotting-precision.R

plot_precision_fan_chartR Documentation

Precision conditional power as a function of sample size

Description

Plots the proportion of simulations in which the posterior credible interval width is less than or equal to a target, as a function of sample size n. Optionally colours separate curves by an effect-grid variable.

Usage

plot_precision_fan_chart(
  power_results,
  ci_width_target,
  effect_filter = NULL,
  colour_by = NULL,
  title = NULL,
  subtitle = NULL
)

Arguments

power_results

Output from a ⁠brms_inla_power*⁠ function, or a data.frame with at least columns n and ci_width, plus any effect-grid columns (e.g. treatment, age_effect).

ci_width_target

Numeric, target width for the credible interval. Conditional power is defined as Pr(ci_width <= ci_width_target).

effect_filter

Optional named list for filtering effect-grid columns, e.g. list(treatment = 0.3).

colour_by

Optional name of an effect-grid column to colour separate curves by. If NULL, only n is used.

title, subtitle

Optional plot labels.

Details

This implementation works directly from the per-simulation results (column ci_width) and does not rely on the robustness engine.

These plots display conditional Bayesian power — the probability of achieving the precision criterion at a fixed effect size. For unconditional assurance (averaged over a design prior on effect size), see plot_assurance_curve().

Value

A ggplot object.


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