# compute_A_B_G_D_and_simulate_mu_Lambda_Sj: Computation and simulations In fabMix: Overfitting Bayesian Mixtures of Factor Analyzers with Parsimonious Covariance and Unknown Number of Components

## Description

This function simulates μ and Λ.

## Usage

 1 2  compute_A_B_G_D_and_simulate_mu_Lambda_Sj(SigmaINV, suff_statistics, OmegaINV, K, priorConst1, T_INV, v_r) 

## Arguments

 SigmaINV Precision matrix Σ^{-1} per component suff_statistics Sufficient statistics OmegaINV Prior parameter: Ω^{-1} K Number of overfitting mixture components priorConst1 Prior constant: T^{-1}ξ T_INV Prior parameter: T^{-1}ξ v_r This vector is used to set to zero the upper right (q-1)\times(q-1) diagonal block of factor loadings for identifiability purposes.

## Value

A list containing a draw from the conditional distributions of μ and Λ:

 Lambdas K\times p\times q array (factor loadings per component) mu K\times p array (marginal mean per component)

## Author(s)

Panagiotis Papastamoulis

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36  library('fabMix') data(waveDataset1500) x_data <- scale(as.matrix(waveDataset1500[ 1:20, -1])) # data z <- waveDataset1500[ 1:20, 1] # class p <- dim(x_data)[2] n <- dim(x_data)[1] q <- 2 K <- length(table(z)) # 3 classes # give some arbitrary values to the parameters: set.seed(1) mu <- array( runif(K * p), dim = c(K,p) ) y <- array(rnorm(n = q*n), dim = c(n,q)) SigmaINV <- array(data = 0, dim = c(K,p,p) ) for(k in 1:K){ diag(SigmaINV[k,,]) <- 0.5 + 0.5*runif(p) } OmegaINV <- diag(q) # compute sufficient stats suf_stat <- compute_sufficient_statistics(y = y, z = z, K = K, x_data = x_data) v_r <- numeric(p) #indicates the non-zero values of Lambdas for( r in 1:p ){ v_r[r] <- min(r,q) } T_INV <- array(data = 0, dim = c(p,p)) diag(T_INV) <- diag(var(x_data)) diag(T_INV) <- 1/diag(T_INV) ksi <- colMeans(x_data) priorConst1 <- array(diag(T_INV)*ksi, dim =c(p,1)) # now simulate mu and Lambda f2 <- compute_A_B_G_D_and_simulate_mu_Lambda_Sj(SigmaINV = SigmaINV, suff_statistics = suf_stat, OmegaINV = OmegaINV, K = K, priorConst1 = priorConst1, T_INV = T_INV, v_r = v_r) # f2$mu contains the simulated means # f2$Lambdas contains the simulated factor loadings 

fabMix documentation built on Feb. 20, 2020, 1:09 a.m.