Learn R Programming

rtkpp (version 0.8.5)

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 [modelNames] and the number of clusters given in [nbCluster], using the strategy specified in [strategy].

Usage

clusterCategorical(data, nbCluster = 2, modelNames = c("categorical_pk_pjk",
  "categorical_p_pjk"), strategy = clusterFastStrategy(), criterion = "ICL")

Arguments

data
frame or matrix containing the data. Rows correspond to observations and columns correspond to variables. If the data set contains NA values, they will be estimated during the estimation process.
nbCluster
[vector] listing the number of clusters to test.
modelNames
[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". Default is "ICL".

Value

  • An instance of the [ClusterCategorical] class.

Examples

Run this code
## A quantitative example with the birds data set
data(birds)
## add 10 missing values
x = birds;
x[round(runif(5,1,nrow(birds))), 2] <- NA
x[round(runif(5,1,nrow(birds))), 4] <- NA
## with default values
model <- clusterCategorical(data=x, nbCluster=2:3, strategy = clusterFastStrategy())

## use graphics functions
plot(model)

## get summary
summary(model)
## print model
print(model)
## get estimated missing values
missingValues(model)

Run the code above in your browser using DataLab