Learn R Programming

latrend (version 1.1.0)

latrendRep: Cluster longitudinal data repeatedly

Description

Performs a repeated fit of the specified latrend model on the given data.

Usage

latrendRep(
  method,
  data,
  .rep = 10,
  ...,
  .errorhandling = "remove",
  .seed = NULL,
  envir = NULL,
  verbose = getOption("latrend.verbose")
)

Arguments

method

The lcMethod object specifying the longitudinal cluster method to apply.

data

The data.frame or matrix to which to apply the method.

.rep

The number of repeated fits.

...

Any other arguments to update the lcMethod definition with.

.errorhandling

How to handle fits in which on error occurs. If "remove", errors are ignored and the respective repetition is exempt from the returned model list. If "stop", errors are not caught, ensuring that the function halts on the first error.

.seed

Set the seed for generating the respective seed for each of the repeated fits.

envir

The environment in which to evaluate the method arguments. Note that this only applies to data when data is a call.

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 containing the resulting models.

Details

This method is faster than repeatedly calling latrend as it only prepares the data via prepareData() once.

See Also

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

Examples

Run this code
# NOT RUN {
data(latrendData)
method <- lcMethodKML("Y", id = "Id", time = "Time")
models <- latrendRep(method, data = latrendData, .rep = 5) # 5 repeated runs

models <- latrendRep(method, data = latrendData, .seed = 1, .rep = 3)
# }

Run the code above in your browser using DataLab