
Get how many units each class holds and how certain their assignment is
Source:R/wildcards.R
get_classification.Rdget_classification() returns, for every class, how many units it holds,
counted two ways, and how certain the assignment of its units is.
Arguments
- x
One of:
a fitted model of any family: from
lpa(),lca(),multilpa(),multilca(),lta()ormixture_regression(). The table is the onediagnostics()computes with its defaults;an enumeration grid of any kind, from
enumerate_lpa(),enumerate_lca(),enumerate_classes()orenumerate_regressions(). The tables of the fitted candidates are stacked, with a first columncandidatethat names the candidate of each row. A candidate whose estimation failed has no rows;the result of
diagnostics(). The table is the one the result holds.
Value
A data frame with one row per level and class (per candidate, level and class for a grid) and the columns:
level:"individuals"or"groups";class: the number of the class;0is the noise component of a fit that has one;n_modal: the number of units whose most likely class this is;proportion_modal:n_modalas a share of the units;estimated_n: the sum of the units' posterior probabilities of the class;estimated_proportion:estimated_nas a share of the units;average_posterior: the mean posterior probability of the class among the units assigned to it;odds_correct_classification: the odds ofaverage_posteriordivided by the odds ofestimated_proportion.
A fit without group classes has rows for the individuals only; a fit that classifies groups only has rows for the groups only.
Errors: latents_not_a_fit when x is none of these, for example a
comparison, pooled imputations or a data frame.
See also
plot_sizes() and plot_posteriors() draw it; get_avepp()
for the full matrix of average posterior probabilities.
Examples
fit <- lpa(faithful, c("eruptions", "waiting"), n_profiles = 2,
n_starts = 2, seed = 1)
get_classification(fit)
#> level class n_modal proportion_modal estimated_n estimated_proportion
#> 1 individuals 1 175 0.6433824 175.02745 0.6434833
#> 2 individuals 2 97 0.3566176 96.97255 0.3565167
#> average_posterior odds_correct_classification
#> 1 0.9999434 9782.752
#> 2 0.9996149 4684.632