| fittedTrajectories {latrend} | R Documentation |
Extract the fitted trajectories
Description
Extract the fitted trajectories
Usage
fittedTrajectories(object, ...)
## S4 method for signature 'lcModel'
fittedTrajectories(
object,
at = time(object),
what = "mu",
clusters = trajectoryAssignments(object),
...
)
Arguments
object |
The model. |
... |
For |
at |
The time points at which to compute the id-specific trajectories. The default implementation merely filters the output, i.e., fitted values can only be outputted for times at which the model was trained. |
what |
The distributional parameter to compute the response for. |
clusters |
The cluster assignments for the strata to base the trajectories on. |
Details
The default lcModel implementation uses the output of fitted() of the respective model.
Value
A data.frame representing the fitted response per trajectory per moment in time for the respective cluster.
For lcModel: A data.frame with columns id, time, response, and "Cluster".
See Also
Other lcModel functions:
clusterNames(),
clusterProportions(),
clusterSizes(),
clusterTrajectories(),
coef.lcModel(),
converged(),
deviance.lcModel(),
df.residual.lcModel(),
estimationTime(),
externalMetric(),
fitted.lcModel(),
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
data(latrendData)
# Note: not a great example because the fitted trajectories
# are identical to the respective cluster trajectory
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)
fittedTrajectories(model)
fittedTrajectories(model, at = time(model)[c(1, 2)])