Computes the prior Beta distribution parameters alpha0
and beta0
at each input location, based on the chosen prior
specification. Supports noninformative, fixed, and data-adaptive prior
strategies.
Usage
get_prior(
prior = c("noninformative", "fixed", "adaptive"),
r0 = 2,
p0 = 0.5,
y = NULL,
m = NULL,
K = NULL
)
Arguments
- prior
Character string specifying the type of prior to use. One of
"noninformative"
,"fixed"
, or"adaptive"
.- r0
Positive scalar indicating the global precision parameter. Used when
prior
is"fixed"
or"adaptive"
.- p0
Prior mean for the success probability (in (0,1)). Used only when
prior = "fixed"
.- y
Numeric vector of observed successes, of length
n
.- m
Numeric vector of total binomial trials, of length
n
.- K
A precomputed kernel matrix of size
n × n
, typically obtained fromkernel_matrix
.
Value
A list with two numeric vectors:
alpha0
Prior alpha parameters of the Beta distribution, length
n
.beta0
Prior beta parameters of the Beta distribution, length
n
.
Details
For
prior = "noninformative"
, all prior parameters are set to 1 (noninformative prior).For
prior = "fixed"
, all locations share the same Beta prior:Beta(r0 * p0, r0 * (1 - p0))
.For
prior = "adaptive"
, the prior mean at each location is computed by kernel smoothing the observed proportionsy/m
, and precisionr0
is distributed accordingly.