Update class covariances
Arguments
- beta
[
matrix(nrow = P_r, ncol = N)
]
The matrix of the decider-specific coefficient vectors.- b
[
matrix(nrow = P_r, ncol = C)
]
The matrix of class means as columns.- z
[
numeric(N)
]
The decider class allocations.- m
[
numeric(C)
]
The vector of current class frequencies.- n_Omega_0
[
integer(1)
]
The degrees of freedom of the Inverse Wishart prior for eachOmega_c
.- V_Omega_0
[
matrix(P_r, P_r)
]
The scale matrix of the Inverse Wishart prior for eachOmega_c
.
Examples
N <- 100
b <- cbind(c(0, 0), c(1, 1))
Omega <- matrix(c(1, 0.3, 0.3, 0.5, 1, -0.3, -0.3, 0.8), ncol = 2)
z <- c(rep(1, N / 2), rep(2, N / 2))
m <- as.numeric(table(z))
beta <- sapply(
z, function(z) oeli::rmvnorm(n = 1, b[, z], matrix(Omega[, z], 2, 2))
)
update_Omega(
beta = beta, b = b, z = z, m = m,
n_Omega_0 = 4, V_Omega_0 = diag(2)
)
#> [,1] [,2]
#> [1,] 0.84055535 1.0005869
#> [2,] 0.07520765 -0.6248856
#> [3,] 0.07520765 -0.6248856
#> [4,] 0.33410723 0.9020809