
Fit a longitudinal cluster method to the given training data, according to the specification provided by the lcMethod object.
This function runs all steps as part of the method fitting procedure.
latrend(
method,
data,
...,
envir = NULL,
verbose = getOption("latrend.verbose")
)The data.frame to which to apply the method. Inputs supported by trajectories() can also be used.
Any other arguments to update the lcMethod definition with.
The environment in which to evaluate the method arguments (by compose()). This environment is also used to evaluate the data argument if it is of type call.
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').
A lcModel object representing the fitted model.
If a seed value is specified in the lcMethod object or arguments to latrend, this seed is set using set.seed prior to the cluster preparation step.
Other longitudinal cluster fit functions:
latrendBatch(),
latrendBoot(),
latrendCV(),
latrendRep()
# NOT RUN {
data(latrendData)
model <- latrend(lcMethodLMKM(Y ~ Time, id = "Id", time = "Time"), data = latrendData)
model <- latrend("lcMethodLMKM", formula = Y ~ Time, id = "Id", time = "Time", data = latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, data = latrendData, nClusters = 3)
model <- latrend(method, data = latrendData, nClusters = 3, seed = 1)
# }
Run the code above in your browser using DataLab