Obtain latent class probabilities for an object for which a method exists. See Details.
class_prob(
x,
type = c("sum.posterior", "sum.mostlikely", "mostlikely.class", "avg.mostlikely",
"individual"),
...
)
An object for which a method exists.
Character vector, indicating which types of probabilities to extract. See Details.
Further arguments to be passed to or from other methods.
A data.frame.
The following types are available:
A summary table of the posterior class probabilities; this indicates what proportion of your data contributes to each class.
A summary table of the most likely class membership, based on the highest posterior class probability. Note that this is subject to measurement error.
If C is the true class of an observation, and N is the most likely class based on the model, then this table shows the probability P(N==i|C==j). The diagonal represents the probability that observations in each class will be correctly classified.
Average posterior probabilities for each class, for the subset of observations with most likely class of 1:k, where k is the number of classes.
The posterior probability matrix, with dimensions n (number of cases in the data) x k (number of classes).
if (FALSE) {
df <- iris[, 1, drop = FALSE]
names(df) <- "x"
res <- mx_mixture(model = "x ~ m{C}*1
x ~~ v{C}*x", classes = 1, data = df)
class_prob(res)
}