Learn R Programming

latrend (version 1.0.1)

predictAssignments: Predict the cluster assignments for new trajectories

Description

Computes the posterior probability based on the provided (observed) data.

Usage

# S4 method for lcModel
predictAssignments(object, newdata = NULL, strategy = which.max, ...)

Arguments

object

The lcModel object.

newdata

Optional data frame for which to compute the model predictions. If omitted, the model training data is used. Cluster trajectory predictions are made when ids are not specified. If the clusters are specified under the Cluster column, output is given only for the specified cluster. Otherwise, a matrix is returned with predictions for all clusters.

strategy

A function returning the cluster index based on the given vector of membership probabilities. By default, ids are assigned to the cluster with the highest probability.

...

Additional arguments.

Value

A factor with length nrow(newdata) that indicates the posterior probability per trajectory per observation.

Details

The default implementation uses predictPostprob to determine the cluster membership.

See Also

predictPostprob

Other model-specific methods: clusterTrajectories(), coef.lcModel(), converged(), deviance.lcModel(), df.residual.lcModel(), fitted.lcModel(), lcModel-class, logLik.lcModel(), model.frame.lcModel(), nobs.lcModel(), postprob(), predict.lcModel(), predictForCluster(), predictPostprob(), residuals.lcModel(), sigma.lcModel(), time.lcModel(), trajectories()