Extracts a data.frame
of the cluster trajectories associated with the given object.
clusterTrajectories(object, ...)
# S4 method for class 'lcModel'
clusterTrajectories(object, at = time(object), what = "mu", ...)
The model.
For lcModel
objects: Arguments passed to predict.lcModel.
A numeric vector
of the times at which to compute the cluster trajectories.
The distributional parameter to predict. By default, the mean response 'mu' is predicted. The cluster membership predictions can be obtained by specifying what = 'mb'
.
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)
.
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()
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)
clusterTrajectories(model)
#> Cluster Time Y
#> 1 A 0.0000000 0.09202386
#> 2 A 0.2222222 0.10921565
#> 3 A 0.4444444 0.11104821
#> 4 A 0.6666667 0.09712083
#> 5 A 0.8888889 0.06140180
#> 6 A 1.1111111 0.01318545
#> 7 A 1.3333333 -0.05804444
#> 8 A 1.5555556 -0.13662404
#> 9 A 1.7777778 -0.24801613
#> 10 A 2.0000000 -0.34779054
#> 11 B 0.0000000 -0.97975135
#> 12 B 0.2222222 -0.63534769
#> 13 B 0.4444444 -0.38525328
#> 14 B 0.6666667 -0.16233773
#> 15 B 0.8888889 0.05903586
#> 16 B 1.1111111 0.17918673
#> 17 B 1.3333333 0.31069966
#> 18 B 1.5555556 0.39004675
#> 19 B 1.7777778 0.42939022
#> 20 B 2.0000000 0.43011898
clusterTrajectories(model, at = c(0, .5, 1))
#> Cluster Time Y
#> 1 A 0.0 0.09202386
#> 2 A 0.5 0.10756637
#> 3 A 1.0 0.03729362
#> 4 B 0.0 -0.97975135
#> 5 B 0.5 -0.32952439
#> 6 B 1.0 0.11911130