update_SigmaINV_faster_Sj: Gibbs sampling for Sigma^{-1} per component

View source: R/fabMix.R

update_SigmaINV_faster_SjR Documentation

Gibbs sampling for \Sigma^{-1} per component

Description

Gibbs sampling for updating \Sigma^{-1} for the xUU model.

Usage

update_SigmaINV_faster_Sj(x_data, z, y, Lambda, mu, K, alpha_sigma, beta_sigma)

Arguments

x_data

n\times p matrix containing the observed data

z

Allocation vector

y

n\times q matrix containing the latent factors

Lambda

K\times p\times q array with factor loadings

mu

K\times p array containing the marginal means

K

Number of components

alpha_sigma

Prior parameter \alpha

beta_sigma

Prior parameter \beta

Value

K\times p\times p array with the variance of errors per component \Sigma^{-1}_k, k = 1,\ldots,K.

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 update SigmaINV
update_SigmaINV_faster_Sj(x_data = syntheticDataset$data, 
	z = syntheticDataset$class, 
	y = syntheticDataset$factors, 
	Lambda = syntheticDataset$factorLoadings, 
	mu = syntheticDataset$means, 
	K = K, 
	alpha_sigma = 0.5, beta_sigma = 0.5)


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