Learn R Programming

powerbrmsINLA (version 1.1.1)

plot_precision_fan_chart: Precision assurance 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
)

Value

A ggplot object.

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. Assurance 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.