plotMetric: Plot one or more internal metrics for all lcModels

plotMetricR Documentation

Plot one or more internal metrics for all lcModels

Description

Plot one or more internal metrics for all lcModels

Usage

plotMetric(models, name, by = "nClusters", subset, group = character())

Arguments

models

A lcModels or list of lcModel objects to compute and plot the metrics of.

name

The name(s) of the metric(s) to compute. If no names are given, the names specified in the latrend.metric option (WRSS, APPA, AIC, BIC) are used.

by

The argument name along which methods are plotted.

subset

Logical expression based on the lcModel method arguments, indicating which lcModel objects to keep.

group

The argument names to use for determining groups of different models. By default, all arguments are included. Specifying group = character() disables grouping. Specifying a single argument for grouping uses that specific column as the grouping column. In all other cases, groupings are represented by a number.

Value

ggplot2 object.

Functionality

  • Print an argument summary for each of the models.

  • Convert to a data.frame of method arguments.

  • Subset the list.

  • Compute an internal metric or external metric.

  • Obtain the best model according to minimizing or maximizing a metric.

  • Obtain the summed estimation time.

  • Plot a metric across a variable.

  • Plot the cluster trajectories.

See Also

Other lcModels functions: as.lcModels(), lcModels-class, lcModels, max.lcModels(), min.lcModels(), print.lcModels(), subset.lcModels()

Examples

data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
methods <- lcMethods(method, nClusters = 1:3)
models <- latrendBatch(methods, latrendData)

if (require("ggplot2")) {
  plotMetric(models, "WMAE")
}

if (require("ggplot2") && require("clusterCrit")) {
  plotMetric(models, c("WMAE", "Dunn"))
}

latrend documentation built on March 31, 2023, 5:45 p.m.