runVICatMix {VICatMix}R Documentation

runVICatMix

Description

Perform a run of the VICatMix model on a data-frame with no variable selection imposed.

Usage

runVICatMix(data, K, alpha, maxiter = 2000, tol = 5e-08, verbose = FALSE)

Arguments

data

A data frame or data matrix with N rows of observations, and P columns of covariates.

K

Maximum number of clusters desired. Must be an integer greater than 1.

alpha

The Dirichlet prior parameter. Recommended to set this to a number < 1. Must be > 0.

maxiter

The maximum number of iterations for the algorithm. Default is 2000.

tol

A convergence parameter. Default is 5x10^-8.

verbose

Default FALSE. Set to TRUE to output ELBO values for each iteration.

Value

A list with the following components: (maxNCat refers to the maximum number of categories for any covariate in the data)

labels

A numeric vector listing the cluster assignments for the observations.

ELBO

A numeric vector tracking the value of the ELBO in every iteration.

Cl

A numeric vector tracking the number of clusters in every iteration.

model

A list containing all variational model parameters and the cluster labels:

alpha

A K-length vector of Dirichlet parameters for alpha.

eps

A K x maxNCat x P array of Dirichlet parameters for epsilon.

labels

A numeric vector listing the cluster assignments for the observations.

rnk

A N x K matrix of responsibilities for the latent variables Z.

factor_labels

A data frame showing how variable categories correspond to numeric factor labels in the model.

Examples

# example code
set.seed(20)
generatedData <- generateSampleDataBin(500, 4, c(0.1, 0.2, 0.3, 0.4), 100, 0)
result <- runVICatMix(generatedData$data, 10, 0.01)

print(result$labels)




[Package VICatMix version 1.0 Index]