update_z2: Collapsed Gibbs for z using matrix inversion lemma

View source: R/fabMix.R

update_z2R Documentation

Collapsed Gibbs for z using matrix inversion lemma

Description

Collapsed Gibbs for z using matrix inversion lemma

Usage

update_z2(w, mu, Lambda, SigmaINV, K, x_data)

Arguments

w

vector with length K consisting of mixture weights

mu

K\times p array containing the marginal means

Lambda

K\times p array with factor loadings

SigmaINV

p\times p precision matrix

K

Number of components

x_data

n\times p matrix containing the observed data

Value

Allocation vector

Author(s)

Panagiotis Papastamoulis

Examples

library('fabMix')
# simulate some data
n = 8                # sample size
p = 5                # number of variables
q = 2                # number of factors
K = 2                # true number of clusters
sINV_diag = 1/((1:p))    # diagonal of inverse variance of errors
set.seed(100)
syntheticDataset <- simData(sameLambda=TRUE,K.true = K, n = n, q = q, p = p, 
                        sINV_values = sINV_diag)
# use the real values as input and simulate allocations
update_z2(w = syntheticDataset$weights, mu = syntheticDataset$means, 
	Lambda = syntheticDataset$factorLoadings, 
	SigmaINV = diag(1/diag(syntheticDataset$variance)), 
	K = K, x_data = syntheticDataset$data)$z


fabMix documentation built on May 29, 2024, 2:53 a.m.