elicit_weibull: Elicit a Weibull prior via moments, direct parameters, or...

View source: R/elicitation.R

elicit_weibullR Documentation

Elicit a Weibull prior via moments, direct parameters, or quantile matching

Description

Fits a Weibull(shape, scale) prior from expert-specified moments or quantiles. The Weibull distribution generalises the Exponential and is widely used for survival analysis with non-constant hazard.

Usage

elicit_weibull(
  shape = NULL,
  scale = NULL,
  mean = NULL,
  sd = NULL,
  quantiles = NULL,
  method = c("moments", "params", "quantile"),
  expert_id = "Expert",
  label = "Quantity"
)

Arguments

shape

Numeric > 0. Shape parameter k. Used when method = "params".

scale

Numeric > 0. Scale parameter \lambda. Used when method = "params".

mean

Numeric > 0. Prior mean. Used with sd when method = "moments".

sd

Numeric > 0. Prior SD. Used with mean when method = "moments".

quantiles

Named numeric vector with at least two interior quantiles. Used when method = "quantile".

method

Character. One of "moments", "params", or "quantile". Default "moments".

expert_id

Character. Identifier for the eliciting expert.

label

Character. Human-readable label for the quantity.

Details

Parameterised as in R's stats::dweibull: shape k and scale \lambda, with mean \lambda \Gamma(1 + 1/k) and variance \lambda^2 [\Gamma(1 + 2/k) - \Gamma(1 + 1/k)^2].

Shape parameter interpretation:

  • k < 1: decreasing hazard (e.g. early mortality selecting out)

  • k = 1: constant hazard (reduces to Exponential)

  • k > 1: increasing hazard (e.g. ageing, post-surgical)

Value

A bayprior object with dist = "weibull".

Examples

# Moment matching: mean 20 months, SD 10 months
p <- elicit_weibull(mean = 20, sd = 10, method = "moments",
                     label     = "Survival time (months)",
                     expert_id = "Expert_1")
print(p)
plot(p)

# Direct parameters (shape = 2 = increasing hazard)
p2 <- elicit_weibull(shape = 2, scale = 20, method = "params",
                      label = "PFS (months)")

# Quantile matching (at least 2 required)
p3 <- elicit_weibull(
  quantiles = c("0.10" = 5, "0.50" = 18, "0.90" = 40),
  method    = "quantile",
  label     = "OS (months)"
)


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