postprob | R Documentation |
Get the posterior probability matrix with element (i,j)
indicating the probability of trajectory i
belonging to cluster j
.
postprob(object, ...)
## S4 method for signature 'lcModel'
postprob(object, ...)
object |
The model. |
... |
Not used. |
This method should be extended by lcModel
implementations. The default implementation returns uniform probabilities for all observations.
An I-by-K numeric 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.
trajectoryAssignments predictPostprob predictAssignments
Other lcModel functions:
clusterNames()
,
clusterProportions()
,
clusterSizes()
,
clusterTrajectories()
,
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()
,
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)
postprob(model)
if (rlang::is_installed("lcmm")) {
gmmMethod = lcMethodLcmmGMM(
fixed = Y ~ Time,
mixture = ~ Time,
id = "Id",
time = "Time",
idiag = TRUE,
nClusters = 2
)
gmmModel <- latrend(gmmMethod, data = latrendData)
postprob(gmmModel)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.