Skip to contents

get_classification() returns, for every class, how many units it holds, counted two ways, and how certain the assignment of its units is.

Usage

get_classification(x)

Arguments

x

One of:

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; 0 is the noise component of a fit that has one;

  • n_modal: the number of units whose most likely class this is;

  • proportion_modal: n_modal as a share of the units;

  • estimated_n: the sum of the units' posterior probabilities of the class;

  • estimated_proportion: estimated_n as 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 of average_posterior divided by the odds of estimated_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