update_z function

Update class allocation vector

Update class allocation vector

This function updates the class allocation vector (independently for all observations) by drawing from its conditional distribution.

update_z(s, beta, b, Omega)

Arguments

  • s: The vector of class weights of length C. Set to NA if P_r = 0. For identifiability, the vector must be non-ascending.
  • beta: The matrix of the decision-maker specific coefficient vectors of dimension P_r x 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.

Returns

An updated class allocation vector.

Details

Let z=(z1,,zN)z = (z_1,\dots,z_N) denote the class allocation vector of the observations (mixed coefficients) β=(β1,,βN)\beta = (\beta_1,\dots,\beta_N). Independently for each nn, the conditional probability Pr(zn=cs,βn,b,Ω)\Pr(z_n = c \mid s,\beta_n,b,\Omega) of having βn\beta_n

allocated to class cc for c=1,,Cc=1,\dots,C depends on the class allocation vector ss, the class means b=(bc)cb=(b_c)_c and the class covariance matrices Omega=(Omegac)cOmega=(Omega_c)_c and is proportional to

scϕ(βnbc,Omegac). s_c \phi(\beta_n \mid b_c,Omega_c).

Examples

### class weights for C = 2 classes s <- rdirichlet(c(1,1)) ### coefficient vector for N = 1 decider and P_r = 2 random coefficients beta <- matrix(c(1,1), ncol = 1) ### class means and covariances b <- cbind(c(0,0),c(1,1)) Omega <- cbind(c(1,0,0,1),c(1,0,0,1)) ### updated class allocation vector update_z(s = s, beta = beta, b = b, Omega = Omega)