sensitivity_cri: Credible interval sensitivity over prior hyperparameters

View source: R/conflict_sensitivity.R

sensitivity_criR Documentation

Credible interval sensitivity over prior hyperparameters

Description

Evaluates how the posterior credible interval width and bounds change as prior hyperparameters vary over a specified grid. This is the preferred function for demonstrating that key regulatory conclusions (e.g., whether the CrI excludes a null value) are robust to prior choice.

Usage

sensitivity_cri(
  prior,
  data_summary,
  param_grid,
  cri_level = 0.95,
  threshold = NULL
)

Arguments

prior

A bayprior object (the reference prior).

data_summary

Named list as for prior_conflict.

param_grid

Named list of numeric vectors, one per hyperparameter.

cri_level

Numeric in (0, 1). Credible interval level. Default 0.95.

threshold

Optional numeric. Computes Pr(theta > threshold) at each grid point if supplied.

Details

As with sensitivity_grid, when prior is a mixture, a single-family working prior is derived via .mixture_working_prior() – moment-matching the mixture's pooled mean/SD to the dominant component's family – rather than analysing the dominant component alone.

Value

An object of class bayprior_sensitivity whose grid contains columns cri_lower, cri_upper, and cri_width, plus optionally posterior_mean, posterior_sd, and prob_efficacy.

Examples

prior <- elicit_beta(mean = 0.30, sd = 0.10, method = "moments",
                     label = "Response rate")
cri_sa <- sensitivity_cri(
  prior,
  data_summary = list(type = "binary", x = 14, n = 40),
  param_grid   = list(alpha = seq(1, 8, 0.5), beta = seq(2, 20, 1)),
  cri_level    = 0.95
)
plot_sensitivity(cri_sa, target = "cri_width")


bayprior documentation built on Aug. 27, 2026, 1:09 a.m.