| class_updates | R Documentation |
Low-level sampler kernels for class weights, allocations, sizes, the weight-based class update, and Dirichlet-process class updates.
sample_allocation(prob)
update_s(delta, m)
update_z(s, beta, b, Omega)
update_m(C, z, non_zero = FALSE)
update_classes_wb(
s,
b,
Omega,
epsmin = 0.01,
epsmax = 0.7,
deltamin = 0.1,
deltashift = 0.5,
identify_classes = FALSE,
Cmax = 10L
)
update_classes_dp(
beta,
z,
b,
Omega,
delta,
mu_b_0,
Sigma_b_0,
n_Omega_0,
V_Omega_0,
identify_classes = FALSE,
Cmax = 10L
)
prob |
[ |
delta |
[ |
m |
[ |
s |
[ |
beta |
[ |
b |
[ |
Omega |
[ |
C |
[ |
z |
[ |
non_zero |
[ |
epsmin |
[ |
epsmax |
[ |
deltamin |
[ |
deltashift |
[ |
identify_classes |
[ |
Cmax |
[ |
mu_b_0 |
[ |
Sigma_b_0 |
[ |
n_Omega_0 |
[ |
V_Omega_0 |
[ |
The functions return one sampler update:
sample_allocation(): an integer class label.
update_s(): a C by 1 numeric matrix of class weights.
update_z(): an N by 1 numeric matrix of allocations.
update_m(): a C by 1 numeric matrix of class sizes.
update_classes_wb(): a list with s, b, Omega, and update_type,
where the latter is zero for no update, one for removal, two for
splitting, and three for merging.
update_classes_dp(): a list with z, b, Omega, and C.
Neal2000RprobitB
\insertRefOelschlaeger2021RprobitB
### a latent class state of six deciders with one random coefficient
set.seed(1)
beta <- matrix(c(-1, -1.2, -0.8, 1, 1.3, 0.9), nrow = 1)
b <- matrix(c(-1, 1), nrow = 1)
Omega <- matrix(c(0.2, 0.2), nrow = 1)
### the weights, the allocations, and the class sizes are drawn in turn
s <- update_s(delta = 1, m = c(3, 3))
z <- update_z(s, beta, b, Omega)
m <- update_m(C = 2, z = z)
sample_allocation(c(0.5, 0.3, 0.2))
### the weight-based update splits a class that grew too large
update_classes_wb(s = c(0.9, 0.1), b = b, Omega = Omega)
### the Dirichlet process update draws the class count from the data
update_classes_dp(
beta = beta, z = z, b = b, Omega = Omega, delta = 1,
mu_b_0 = 0, Sigma_b_0 = diag(1), n_Omega_0 = 4, V_Omega_0 = diag(1)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.