# OptiNum

##### Finding an optimal number of clusters

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

- Keywords
- CluMP

##### 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.

##### Examples

```
# NOT RUN {
data <- GeneratePanel(n = 100, Param = ParamLinear, NbVisit = 10)
OptiNum(data = data, formula = Y ~ Time, group = "ID")
# }
```

*Documentation reproduced from package CluMP, version 0.7, License: GPL (>= 3)*