Plot cluster trajectories
Plot the cluster trajectories of a lcModel
# S4 method for data.frame
plotClusterTrajectories(
object,
response,
cluster = "Cluster",
time = getOption("latrend.time"),
center = meanNA,
trajectories = FALSE,
facet = isTRUE(trajectories),
id = getOption("latrend.id"),
...
)# S4 method for lcModel
plotClusterTrajectories(
object,
what = "mu",
at = time(object),
clusterLabels = sprintf("%s (%s)", clusterNames(object),
percent(clusterProportions(object))),
trajectories = FALSE,
facet = isTRUE(trajectories),
trajAssignments = trajectoryAssignments(object),
...
)
The (cluster) trajectory data.
The name of the response variable.
The cluster assignment column
The name of the time variable.
A function for aggregating multiple points at the same point in time
Whether to plot the original data in addition to the cluster (i.e., center) trajectories
Whether to facet by cluster. This is done by default when trajectories
is enabled.
Id column. Only needed when trajectories = TRUE
.
Arguments passed to clusterTrajectories, or ggplot2::geom_line for plotting the cluster trajectory lines.
The distributional parameter to predict. By default, the mean response 'mu' is predicted. The cluster membership predictions can be obtained by specifying what = 'mb'
.
An optional vector, list or data frame of covariates at which to compute the cluster trajectory predictions. If a vector is specified, this is assumed to be the time covariate. Otherwise, a named list or data frame must be provided.
Cluster display names. By default it's the cluster name with its proportion enclosed in parentheses.
The cluster assignments for the fitted trajectories. Only used when trajectories = TRUE
and facet = TRUE
. See trajectoryAssignments.
A ggplot
object.
Instead of passing the plotting arguments through ...
, consider modifying the ggplot2 defaults.
For example, changing the default line size: update_geom_defaults("line", list(size = 1.5))