Returns the cluster-specific fitted values for the given lcModel object.
The default implementation calls predict() with newdata = NULL.
# S3 method for lcModel
fitted(object, ..., clusters = trajectoryAssignments(object))A numeric vector of the fitted values for the respective class, or a matrix of fitted values for each cluster.
The lcModel object.
Additional arguments.
Optional cluster assignments per id. If unspecified, a matrix is returned containing the cluster-specific predictions per column.
Classes extending lcModel can override this method to adapt the computation of the predicted values for the training data.
Note that the implementation of this function is only needed when predict() and predictForCluster() are not defined for the lcModel subclass.
fitted.lcModelExt <- function(object, ..., clusters = trajectoryAssignments(object)) {
pred = predict(object, newdata = NULL)
transformFitted(pred = pred, model = object, clusters = clusters)
}
The transformFitted() function takes care of transforming the prediction input to the right output format.
fittedTrajectories plotFittedTrajectories stats::fitted predict.lcModel trajectoryAssignments transformFitted
Other lcModel functions:
clusterNames(),
clusterProportions(),
clusterSizes(),
clusterTrajectories(),
coef.lcModel(),
converged(),
deviance.lcModel(),
df.residual.lcModel(),
estimationTime(),
externalMetric(),
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()
data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)
fitted(model)
Run the code above in your browser using DataLab