overfittingMFA: Basic MCMC sampler for the 'UCU' model

View source: R/fabMix.R

overfittingMFAR Documentation

Basic MCMC sampler for the UCU model

Description

Gibbs sampling for fitting a mixture model of factor analyzers.

Usage

overfittingMFA(x_data, originalX, outputDirectory, Kmax, m, thinning, burn, 
	g, h, alpha_prior, alpha_sigma, beta_sigma, 
	start_values, q, zStart, gibbs_z, lowerTriangular)

Arguments

x_data

normalized data

originalX

observed raw data (only for plotting purpose)

outputDirectory

Name of the output folder

Kmax

Number of mixture components

m

Number of iterations

thinning

Thinning of chain

burn

Burn-in period

g

Prior parameter g. Default value: g = 2.

h

Prior parameter h. Default value: h = 1.

alpha_prior

Parameters of the Dirichlet prior distribution of mixture weights.

alpha_sigma

Prior parameter \alpha. Default value: \alpha = 2.

beta_sigma

Prior parameter \beta. Default value: \beta = 1.

start_values

Optional (not used)

q

Number of factors.

zStart

Optional (not used)

gibbs_z

Optional

lowerTriangular

logical value indicating whether a lower triangular parameterization should be imposed on the matrix of factor loadings (if TRUE) or not. Default: TRUE.

Value

Set of files written in outputDirectory.

Author(s)

Panagiotis Papastamoulis

Examples

library('fabMix')
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)
colnames(syntheticDataset$data) <- paste0("x_",1:p)
Kmax <- 4       # number of components for the overfitted mixture model

set.seed(1)
overfittingMFA(x_data = syntheticDataset$data, 
	originalX = syntheticDataset$data, outputDirectory = 'outDir', 
	Kmax = Kmax, m = 5, burn = 1, 
	g = 0.5, h = 0.5, alpha_prior = rep(1, Kmax), 
	alpha_sigma = 0.5, beta_sigma = 0.5, 
	start_values = FALSE, q = 2,  gibbs_z = 1)
list.files('outDir')
unlink('outDir', recursive = TRUE)


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