clustra_sil: clustra_sil: Prepare silhouette plot data for several k or...

View source: R/evaluate.R

clustra_silR Documentation

clustra_sil: Prepare silhouette plot data for several k or for a previous clustra run

Description

Performs clustra runs for several k and prepares silhouette plot data. Computes a proxy silhouette index based on distances to cluster centers rather than trajectory pairs. The cost is essentially that of running clustra for several k as this information is available directly from clustra. Can also reuse a previous clustra run and produce data for a single silhouette plot.

Usage

clustra_sil(
  data,
  kv = NULL,
  starts = "random",
  mccores = 1,
  maxdf = 30,
  conv = c(10, 0),
  save = FALSE,
  verbose = FALSE
)

Arguments

data

A data.frame (see the data parameter of trajectories). Alternatively, the output from a completed clustra run can be used, in which case kv is left as NULL. See Details.

kv

Vector of clustra k values to run. If data is the output from a completed clustra run, leave kv as NULL.

starts

See clustra.

mccores

See trajectories.

maxdf

Fitting parameters. See trajectories.

conv

Fitting parameters. See trajectories.

save

Logical. When TRUE, save all results as file clustra_sil.Rdata.

verbose

Logical. When TRUE, information about each run of clustra is printed.

Details

When given the raw data as the first parameter (input data parameter of trajectories), kv specifies a vector of k parameters for clustra and produces data for silhouette plots of each of them. Alternatively, the input can be the output from a single clustra run, in which case data for a single silhouette plot will be made without running clustra.

Value

Invisibly returns a list of length length(kv), where each element is a matrix with nrow(data) rows and three columns cluster, neighbor, silhouette. The matrix in each element of this list can be used to draw a silhouette plot. When the input was a completed clustra run, the output is a list with a single element for a single silhouette plot.


clustra documentation built on Oct. 14, 2023, 9:15 a.m.