
Get the relative entropy, from 0 to 1, of how sharply a model separates its classes
Source:R/wildcards.R
get_entropy.Rdget_entropy() returns one number per classification level that says how
sharply the model separates its classes: the relative entropy, from 0 (every
unit is equally likely to be in every class) to 1 (every unit belongs to one
class with certainty).
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 classification level (per candidate and level for a grid) and the columns:
level:"individuals"(the cases sorted into profiles or classes) or"groups"(the groups sorted into group classes);n_classes: the number of classes at that level;n_units: the number of classified units;entropy_sum: the sum of the units' entropies;relative_entropy: one minus the mean entropy of a unit divided by its largest possible value, the logarithm ofn_classes.NAfor a level with one class.
A profile, class or transition fit always has both rows; without group
classes its "groups" row has one class and NA. A fit of another
family has a row for each level it classifies.
Errors: latents_not_a_fit when x is none of these, for example a
comparison, pooled imputations or a data frame.
See also
plot_entropy() draws the entropy of each unit;
get_classification(), get_avepp().