
Plot the posterior probability of each unit's assigned class, by class
Source:R/wildcards.R
plot_posteriors.Rdplot_posteriors() plots how certain the classification of each unit is: the
posterior probability of the class the unit is assigned to, by class.
Arguments
- x
One of:
a fitted model of any family: from
lpa(),lca(),multilpa(),multilca(),lta()ormixture_regression(). This covers fits with covariates, growth mixtures, and the additive and cross-level families ofmultilpa();a
diagnostics()result, which is drawn from the fit it checked.
- main, subtitle
Title and subtitle of the plot.
NULL(default) keeps the view's own text. When two plots are returned, both get the same title and subtitle.
Value
A ggplot object. A fit that classifies at both levels returns a
latents_plots list of two ggplot objects named individuals and
groups; printing the list draws both.
Errors:
latents_nothing_to_plotwhen the package returnedxbut this function has no plot of it: a fit with one class or with a noise component, an enumeration grid, pooled imputations, a comparison, a bootstrap result or a sensitivity analysis. For an object of the wrong kind, the message names the plot functions that apply to it;latents_not_a_fitwhenxis not a fit, grid or other result of the package, for example a data frame;latents_missing_packagewhen ggplot2 is not installed.
Details
One point per classified unit (a case or a group). The x-axis is the posterior probability of the unit's assigned (most likely) class. It runs from chance, one divided by the number of classes (dashed line), to 1, which is certainty. The rows are the assigned classes, the largest at the top, each in its own colour; the points are spread within a row so that they do not overlap. A short vertical bar marks the mean of each class, which is the class's average posterior probability.
A fit with two or more group classes besides its profiles is drawn at
both levels, as two plots. A level with one class has nothing to draw, so
a fit with a single profile or class is refused. A fit with a noise
component is refused too. Enumeration grids have no such view; use
plot_avepp() or plot_entropy() for a grid.
See also
get_classification() for the average posterior probability of
each class as a table; plot_entropy(), plot_avepp();
plot_classification() for every class probability of each person of a
growth model.
