Learn R Programming

latrend (version 1.1.0)

latrendBatch: Cluster longitudinal data for a list of model specifications

Description

Fit a list of longitudinal cluster methods.

Usage

latrendBatch(
  methods,
  data,
  cartesian = TRUE,
  envir = NULL,
  verbose = getOption("latrend.verbose")
)

Arguments

methods

A list of lcMethod objects.

data

A data.frame, matrix, or a list thereof to which to apply to the respective lcMethod. Multiple datasets can be supplied by encapsulating the datasets using data=.(df1, df2, ..., dfN).

cartesian

Whether to fit the provided methods on each of the datasets. If cartesian=FALSE, only a single dataset may be provided or a list of data matching the length of methods.

envir

The environment in which to evaluate the lcMethod arguments.

verbose

The level of verbosity. Either an object of class Verbose (see R.utils::Verbose for details), a logical indicating whether to show basic computation information, a numeric indicating the verbosity level (see Verbose), or one of c('info', 'fine', 'finest').

Value

A lcModels object.

See Also

lcMethods

Other longitudinal cluster fit functions: latrendBoot(), latrendCV(), latrendRep(), latrend()

Examples

Run this code
# NOT RUN {
data(latrendData)
methods <- lcMethods(lcMethodKML("Y", id = "Id", time = "Time"), nClusters = 1:3)
models <- latrendBatch(methods, data = latrendData)

models <- latrendBatch(lcMethods(lcMethodKML("Y", id = "Id", time = "Time"), nClusters = 1:2),
   data = .(subset(latrendData, Time > .5),
            subset(latrendData, Time < .5))) # different data per method

# }

Run the code above in your browser using DataLab