update_z | R Documentation |
This function updates the class allocation vector (independently for all observations) by drawing from its conditional distribution.
update_z(s, beta, b, Omega)
s |
The vector of class weights of length |
beta |
The matrix of the decision-maker specific coefficient vectors of dimension
|
b |
The matrix of class means as columns of dimension |
Omega |
The matrix of class covariance matrices as columns of dimension
|
Let z = (z_1,\dots,z_N)
denote the class allocation vector of the observations (mixed coefficients) \beta = (\beta_1,\dots,\beta_N)
.
Independently for each n
, the conditional probability \Pr(z_n = c \mid s,\beta_n,b,\Omega)
of having \beta_n
allocated to class c
for c=1,\dots,C
depends on the class allocation vector s
, the class means b=(b_c)_c
and the class covariance
matrices Omega=(Omega_c)_c
and is proportional to
s_c \phi(\beta_n \mid b_c,Omega_c).
An updated class allocation vector.
### 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.