| diagnostics | R Documentation |
summary() reports what a model estimated. This reports whether to believe
it: how sharply the posterior separates the classes, how big each class
actually is, how confidently each unit was assigned, and whether the
within-profile independence the model assumes survives contact with the data.
diagnostics(x, data = NULL, plots = TRUE, by = c("profile", "overall"), ...)
## S3 method for class 'multilpa_diagnostics'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'multilpa_diagnostics'
print(x, ...)
## S3 method for class 'multilpa_diagnostics'
plot(x, ...)
x |
A fitted model of this package. |
data |
Optional. The data the model was fitted to. A fit carries the columns it was built from, so this is only needed to override them. |
plots |
|
by |
|
... |
For |
row.names, optional |
Passed to the base generic; |
It gathers the four classification tables of get_results() — "entropy",
"classification", "average_posteriors" and "residuals" — and prints
one line of reading per diagnostic rather than four differently shaped
tables. The tables themselves come back from get_results() on the result, or
on the fit.
An object of class multilpa_diagnostics. Read its tables with
get_results(result, what = ), which offers "entropy", "classification",
"average_posteriors", "residuals" and "all", and never with $. A
model family that has no bivariate residuals leaves that table out of
"all", and asking for it by name raises latents_no_group_classes.
print() returns the object invisibly, having printed one line per
diagnostic: relative entropy, smallest class, lowest average posterior and
largest residual, at each level the fit has. plot() returns every
classification plot as a latents_plots list of ggplot objects – the
effective profile sizes, the posterior probability of each case's assigned
profile, each case's relative entropy, and the average posterior
probability matrix – that draws all four when printed.
as.data.frame() returns the entropy table, the primary one.
get_results() for these tables and every other one, descriptives()
for the before-the-fit counterpart, and summary() for what the model
estimated rather than whether to trust it.
fit <- multilpa(
course_engagement,
vars = c("browse", "lectures", "forum_read", "forum_post", "attendance"),
id = "student", n_profiles = 2, n_group_classes = 2, n_starts = 4,
seed = 1
)
quality <- diagnostics(fit)
quality
get_results(quality, what = "classification")
get_results(diagnostics(fit, by = "overall"), what = "residuals")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.