elicit_beta: Elicit a Beta prior via quantile matching or moment matching

View source: R/elicitation.R

elicit_betaR Documentation

Elicit a Beta prior via quantile matching or moment matching

Description

Fits a Beta(alpha, beta) distribution to expert-specified quantiles or moments. Implements the structured elicitation framework of the SHELF methodology, supporting the documented, reproducible prior derivation called for in the FDA's 2026 draft guidance on Bayesian methods.

Usage

elicit_beta(
  quantiles = NULL,
  mean = NULL,
  sd = NULL,
  method = c("quantile", "moments"),
  expert_id = "Expert_1",
  label = "Unknown quantity",
  tol = 1e-06
)

Arguments

quantiles

Named numeric vector of quantile specifications, e.g. c("0.05" = 0.1, "0.50" = 0.3, "0.95" = 0.6). At least two quantiles required.

mean

Optional numeric. Expert-specified mean for moment matching.

sd

Optional numeric. Expert-specified SD for moment matching.

method

Character. One of "quantile" (default) or "moments".

expert_id

Character. Identifier for this expert's elicitation.

label

Character. Description of the quantity being elicited.

tol

Numeric. Optimisation tolerance. Default 1e-6.

Details

For method = "moments", the mean and SD are matched analytically to the Beta family using the standard method-of-moments identities:

\alpha = \bar{x}\left(\frac{\bar{x}(1-\bar{x})}{s^2} - 1\right), \quad \beta = (1-\bar{x})\left(\frac{\bar{x}(1-\bar{x})}{s^2} - 1\right)

where \bar{x} is mean and s is sd. This requires s^2 < \bar{x}(1-\bar{x}); an SD too large for the given mean implies a negative \alpha or \beta and raises an error. For method = "quantile", \alpha and \beta are instead found numerically by minimising squared error between the fitted quantiles and the expert-specified quantiles.

Value

An object of class bayprior with components:

dist

"beta"

params

Named list with alpha and beta

method

Elicitation method used

expert_id

Expert identifier

label

Quantity label

fit_summary

Summary statistics of fitted prior

Examples

# Expert believes response rate is ~30%, with 90% CI of [10%, 60%]
prior <- elicit_beta(
  quantiles = c("0.05" = 0.10, "0.50" = 0.30, "0.95" = 0.60),
  expert_id = "Expert_1",
  label     = "Response rate (treatment arm)"
)
print(prior)
plot(prior)

# Moment-based elicitation
prior_mom <- elicit_beta(
  mean   = 0.30, sd = 0.12,
  method = "moments",
  label  = "Response rate"
)


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