OptiNum {CluMP} R Documentation

## Finding an optimal number of clusters

### Description

This function finds optimal number of clusters based on evaluation criteria (indices) available from the NbClust package.

### Usage

OptiNum(
formula,
group,
data,
index = c("silhouette", "ch", "db"),
max_clust = 10,
base_val = FALSE
)


### Arguments

 formula A two-sided formula object, with a numeric, clustering variable (Y) on the left of a ~ separator and the time (numeric) variable on the right. Time is measured from the start of the follow-up period (baseline). group A grouping factor variable (vector), i.e. single identifier for each individual (trajectory). data A data frame containing the variables named in formula and group arguments. index String vector of indices to be computed. Default is c("silhouette", "ch", "db"). See NbClust package for available indices and their description. max_clust An integer, positive number (scalar) defining the maximum number of clusters to check. Default value of this argument is 10 or maximum number of individuals. base_val Indicates whether include a value at zero time point as an additional clustering variable. Default is FALSE and the standard number (7) of clustering parameters is used.

### Value

Determine the optimal number of clusters, returns graphical output (red dot in plot indicates the recommended number of clusters according to that index) and table with indices.

### Source

Malika Charrad, Nadia Ghazzali, Veronique Boiteau, Azam Niknafs (2014). NbClust: An R Package for Determining the Relevant Number of Clusters in a Data Set. Journal of Statistical Software, 61(6), 1-36. URL http://www.jstatsoft.org/v61/i06/.

### Examples

set.seed(123)
data <- GeneratePanel(n = 100, Param = ParamLinear, NbVisit = 10)
OptiNum(data = data, formula = Y ~ Time, group = "ID")



[Package CluMP version 0.8.1 Index]