Skip to contents

Estimate the number of clusters using the mclust::Mclust() function.

Usage

model_based_clust(data, criteria = "BIC", cmin = 1, cmax = 5)

Arguments

data

a dataframe with only the indicators to be used in the clustering as columns.

criteria

which criteria to select the best number of clusters. One of BIC or lrt (likelihood ratio test).

cmin

the minimum number of cluster to test. Default to 1

cmax

the maximum number of clusters to test. Default to 5. Be careful that increasing cmax will greatly increase the computation time.

Value

the estimated number of clusters

Examples

X <- sim_clust(2, 100, dmin = 0.5, rmin = 0.3, nind = 10)
X <- X[, 1:(ncol(X) - 1)] # excluding the last column
model_based_clust(X)
#> $nclust
#> [1] 2
#> 
#> $preds
#>   [1] 1 2 2 1 2 1 2 2 2 1 2 1 2 2 2 2 1 2 1 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 2 1 2
#>  [38] 2 1 2 2 1 2 2 2 2 1 2 1 2 1 1 2 2 1 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2
#>  [75] 2 2 1 2 2 2 2 1 1 2 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2
#>