Learn R Programming

MixAll (version 1.5.10)

clusterCategorical: Create an instance of the [ClusterCategorical] class

Description

This function computes the optimal Categorical mixture model according to the criterion among the list of model given in models and the number of clusters given in nbCluster, using the strategy specified in strategy.

Usage

clusterCategorical(
  data,
  nbCluster = 2,
  models = clusterCategoricalNames(probabilities = "free"),
  strategy = clusterStrategy(),
  criterion = "ICL",
  nbCore = 1
)

Value

An instance of the [ClusterCategorical] class.

Arguments

data

a data.frame or a matrix containing the data. Rows correspond to observations and columns correspond to variables. data will be coerced as an integer matrix. If data set contains NA values, they will be estimated during the estimation process.

nbCluster

[vector] listing the number of clusters to test.

models

[vector] of model names to run. By default the categorical models "categorical_pk_pjk" and "categorical_p_pjk" are estimated.

strategy

a [ClusterStrategy] object containing the strategy to run. [clusterStrategy]() method by default.

criterion

character defining the criterion to select the best model. The best model is the one with the lowest criterion value. Possible values: "BIC", "AIC", "ICL", "ML". Default is "ICL".

nbCore

integer defining the number of processors to use (default is 1, 0 for all).

Author

Serge Iovleff

Examples

Run this code
## A quantitative example with the birds data set
data(birds)
## add 10 missing values
x = as.matrix(birds); n <- nrow(x); p <- ncol(x)
indexes <- matrix(c(round(runif(5,1,n)), round(runif(5,1,p))), ncol=2)
x[indexes] <- NA
## estimate model (using fast strategy, results may be misleading)
model <- clusterCategorical( data=x, nbCluster=2:3
                           , models=c( "categorical_pk_pjk", "categorical_p_pjk")
                           , strategy = clusterFastStrategy()
                           )

## use graphics functions
if (FALSE) {
plot(model)
}

## get summary
summary(model)
## print model
if (FALSE) {
print(model)
}
## get estimated missing values
missingValues(model)

Run the code above in your browser using DataLab