| get_prior | R Documentation |
Computes prior parameters for Beta Kernel Process (BKP, binary) or Dirichlet Kernel Process (DKP, multi-class) models. Supports three prior strategies: noninformative, fixed, adaptive.
get_prior(
prior = c("noninformative", "fixed", "adaptive"),
model = c("BKP", "DKP"),
r0 = 2,
p0 = NULL,
y = NULL,
m = NULL,
Y = NULL,
K = NULL
)
prior |
Character string; prior type. One of: '"noninformative"', '"fixed"', '"adaptive"'. |
model |
Character string; model type. One of: '"BKP"' (binary), '"DKP"' (multi-class). |
r0 |
Numeric; prior precision (positive scalar, default = 2). |
p0 |
Numeric; global prior mean. BKP: scalar in (0,1); DKP: vector summing to 1. |
y |
Numeric vector; observed success counts (BKP only). |
m |
Numeric vector; number of trials (BKP only, same length as 'y'). |
Y |
Numeric matrix; observed class counts (DKP only, n × q). |
K |
Numeric matrix; precomputed kernel matrix. |
Prior strategies: * 'noninformative': flat prior (Beta(1,1) or Dirichlet(1,...,1)). * 'fixed': global constant prior. * 'adaptive': kernel-smoothed local prior, estimated from observed data.
For BKP: a list with 'alpha0' and 'beta0'. For DKP: a matrix 'alpha0' of prior Dirichlet parameters.
# BKP example
set.seed(123)
n <- 10
X <- matrix(runif(n*2), ncol = 2)
y <- rbinom(n, size = 5, prob = 0.6)
m <- rep(5, n)
K <- matrix(1, n, n)
prior_bkp <- get_prior(
model = "BKP", prior = "adaptive",
r0 = 2, y = y, m = m, K = K
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.