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) denote the class allocation vector of the observations (mixed coefficients) β=(β1,…,βN). Independently for each n, the conditional probability Pr(zn=c∣s,βn,b,Ω) of having βn
allocated to class c for c=1,…,C depends on the class allocation vector s, the class means b=(bc)c and the class covariance matrices Omega=(Omegac)c and is proportional to
scϕ(βn∣bc,Omegac).
Examples
### class weights for C = 2 classess <- rdirichlet(c(1,1))### coefficient vector for N = 1 decider and P_r = 2 random coefficientsbeta <- matrix(c(1,1), ncol =1)### class means and covariancesb <- cbind(c(0,0),c(1,1))Omega <- cbind(c(1,0,0,1),c(1,0,0,1))### updated class allocation vectorupdate_z(s = s, beta = beta, b = b, Omega = Omega)