View source: R/conflict_sensitivity.R
| sensitivity_cri | R Documentation |
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.
sensitivity_cri(
prior,
data_summary,
param_grid,
cri_level = 0.95,
threshold = NULL
)
prior |
A |
data_summary |
Named list as for |
param_grid |
Named list of numeric vectors, one per hyperparameter. |
cri_level |
Numeric in (0, 1). Credible interval level. Default
|
threshold |
Optional numeric. Computes |
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.
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.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.