Learn R Programming

latrend (version 1.6.1)

clusterTrajectories: Extract cluster trajectories

Description

Extracts a data.frame of the cluster trajectories associated with the given object.

Usage

clusterTrajectories(object, ...)

# S4 method for lcModel clusterTrajectories(object, at = time(object), what = "mu", ...)

Value

A data.frame of the estimated values at the specified times. The first column should be named "Cluster". The second column should be time, with the name matching the timeVariable(object). The third column should be the expected value of the observations, named after the responseVariable(object).

Arguments

object

The model.

...

For lcModel objects: Arguments passed to predict.lcModel.

at

A numeric vector of the times at which to compute the cluster trajectories.

what

The distributional parameter to predict. By default, the mean response 'mu' is predicted. The cluster membership predictions can be obtained by specifying what = 'mb'.

See Also

plotClusterTrajectories

Other lcModel functions: clusterNames(), clusterProportions(), clusterSizes(), coef.lcModel(), converged(), deviance.lcModel(), df.residual.lcModel(), estimationTime(), externalMetric(), fitted.lcModel(), fittedTrajectories(), getCall.lcModel(), getLcMethod(), ids(), lcModel-class, metric(), model.frame.lcModel(), nClusters(), nIds(), nobs.lcModel(), plot-lcModel-method, plotClusterTrajectories(), plotFittedTrajectories(), postprob(), predict.lcModel(), predictAssignments(), predictForCluster(), predictPostprob(), qqPlot(), residuals.lcModel(), sigma.lcModel(), strip(), time.lcModel(), trajectoryAssignments()

Examples

Run this code
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)

clusterTrajectories(model)

clusterTrajectories(model, at = c(0, .5, 1))

Run the code above in your browser using DataLab