Get the posterior probability matrix with element
# S4 method for lcModel
postprob(object, ...)
The lcModel
.
Additional arguments.
A I-by-K matrix
with I = nIds(object)
and K = nClusters(object)
.
Classes extending lcModel
should override this method.
setMethod("postprob", "lcModelExt", function(object, ...) { # return trajectory-specific posterior probability matrix })
If you are getting errors about undefined model signatures when calling postprob(model), check whether the postprob() function is still the one defined by the latrend package. It may have been overridden when attaching another package (e.g., lcmm). If you need to attach conflicting packages, load them first.
This method should be extended by lcModel
implementations. The default implementation returns uniform probabilities for all observations.
trajectoryAssignments predictPostprob predictAssignments
Other model-specific methods:
clusterTrajectories()
,
coef.lcModel()
,
converged()
,
deviance.lcModel()
,
df.residual.lcModel()
,
fitted.lcModel()
,
fittedTrajectories()
,
lcModel-class
,
logLik.lcModel()
,
model.frame.lcModel()
,
nobs.lcModel()
,
predict.lcModel()
,
predictAssignments()
,
predictForCluster()
,
predictPostprob()
,
residuals.lcModel()
,
sigma.lcModel()
,
time.lcModel()
# NOT RUN {
data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)
postprob(model)
if (rlang::is_installed("lcmm")) {
gmmMethod = lcMethodLcmmGMM(
fixed = Y ~ Time,
mixture = ~ Time,
id = "Id",
time = "Time"
)
gmmModel <- latrend(gmmMethod, data = latrendData)
postprob(gmmModel)
}
# }
Run the code above in your browser using DataLab