OptiNum: Finding an optimal number of clusters

Description Usage Arguments Value Source Examples

View source: R/OptiNum.R

Description

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

Usage

1
2
3
4
5
6
7
8
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

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

CluMP documentation built on Nov. 27, 2020, 9:06 a.m.

Related to OptiNum in CluMP...