update_classes_dp function

Dirichlet process-based update of latent classes

Dirichlet process-based update of latent classes

This function updates the latent classes based on a Dirichlet process.

update_classes_dp( Cmax, beta, z, b, Omega, delta, xi, D, nu, Theta, s_desc = TRUE )

Arguments

  • Cmax: The maximum number of classes.
  • beta: The matrix of the decision-maker specific coefficient vectors of dimension P_r x N. Set to NA if P_r = 0.
  • z: The vector of the allocation variables of length N. Set to NA if P_r = 0.
  • b: The matrix of class means as columns of dimension P_r x C. Set to NA if P_r = 0.
  • Omega: The matrix of class covariance matrices as columns of dimension P_r*P_r x C. Set to NA if P_r = 0.
  • delta: A numeric for the concentration parameter vector rep(delta,C) of the Dirichlet prior for s. Per default, delta = 1. In case of Dirichlet process-based updates of the latent classes, delta = 0.1 per default.
  • xi: The mean vector of length P_r of the normal prior for each b_c. Per default, xi = numeric(P_r).
  • D: The covariance matrix of dimension P_r x P_r of the normal prior for each b_c. Per default, D = diag(P_r).
  • nu: The degrees of freedom (a natural number greater than P_r) of the Inverse Wishart prior for each Omega_c. Per default, nu = P_r + 2.
  • Theta: The scale matrix of dimension P_r x P_r of the Inverse Wishart prior for each Omega_c. Per default, Theta = diag(P_r).
  • s_desc: If TRUE, sort the classes in descending class weight.

Returns

A list of updated values for z, b, Omega, s, and C.

Details

To be added.

Examples

set.seed(1) z <- c(rep(1,20),rep(2,30)) b <- matrix(c(1,1,1,-1), ncol=2) Omega <- matrix(c(1,0.3,0.3,0.5,1,-0.3,-0.3,0.8), ncol=2) beta <- sapply(z, function(z) rmvnorm(b[,z], matrix(Omega[,z],2,2))) delta <- 1 xi <- numeric(2) D <- diag(2) nu <- 4 Theta <- diag(2) RprobitB:::update_classes_dp( Cmax = 10, beta = beta, z = z, b = b, Omega = Omega, delta = delta, xi = xi, D = D, nu = nu, Theta = Theta )