lcFitMethods: Method fit modifiers

lcFitMethodsR Documentation

Method fit modifiers

Description

A collection of special methods that adapt the fitting procedure of the underlying longitudinal cluster method.

NOTE: the underlying implementation is experimental and may change in the future.

Supported fit methods:

  • lcFitConverged: Fit a method until a converged result is obtained.

  • lcFitRep: Repeatedly fit a method and return the best result based on a given internal metric.

  • lcFitRepMin: Repeatedly fit a method and return the best result that minimizes the given internal metric.

  • lcFitRepMax: Repeatedly fit a method and return the best result that maximizes the given internal metric.

Usage

lcFitConverged(method, maxRep = Inf)

lcFitRep(method, rep = 10, metric, maximize)

lcFitRepMin(method, rep = 10, metric)

lcFitRepMax(method, rep = 10, metric)

Arguments

method

The lcMethod to use for fitting.

maxRep

The maximum number of fit attempts

rep

The number of fits

metric

The internal metric to assess the fit.

maximize

Whether to maximize the metric. Otherwise, it is minimized.

Details

Meta methods are immutable and cannot be updated after instantiation. Calling update() on a meta method is only used to update arguments of the underlying lcMethod object.

Examples


data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time", nClusters = 2)
metaMethod <- lcFitConverged(method, maxRep = 10)
metaMethod
model <- latrend(metaMethod, latrendData)

data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time", nClusters = 2)
repMethod <- lcFitRep(method, rep = 10, metric = "RSS", maximize = FALSE)
repMethod
model <- latrend(repMethod, latrendData)

minMethod <- lcFitRepMin(method, rep = 10, metric = "RSS")

maxMethod <- lcFitRepMax(method, rep = 10, metric = "ASW")

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