get_prior {BKP}R Documentation

Construct Prior Parameters for the BKP Model

Description

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 from kernel_matrix.

Details

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.

See Also

get_prior_dkp, fit.BKP, predict.BKP, kernel_matrix

Examples

# Simulated data
set.seed(123)
n <- 10
X <- matrix(runif(n * 2), ncol = 2)
y <- rbinom(n, size = 5, prob = 0.6)
m <- rep(5, n)

# Example kernel matrix (Gaussian)
K <- kernel_matrix(X)

# Construct adaptive prior
prior <- get_prior(prior = "adaptive", r0 = 2, y = y, m = m, K = K)


[Package BKP version 0.1.0 Index]