View source: R/compare-models.R
| compare_models | R Documentation |
One row per model with its log likelihood, number of parameters,
information criteria, classification quality and convergence, so
alternative specifications (for example trajectory classes alone against
a growth mixture model) are compared without assembling tables by hand.
delta_bic is each model's BIC above the smallest, and bic_weight the
Schwarz weight, exp(-delta/2) normalized over the models compared (Wagenmakers
and Farrell 2004): the approximate posterior probability of each model if
one of them is true, with equal prior probabilities.
compare_models(...)
... |
Two or more fits from |
Information criteria are comparable only on the same data: every model must be fitted to the same outcome, persons (or groups) and observations, or the comparison is refused.
A base data.frame of class latents_comparison with one row per
model: model, n_classes, random, n_parameters, log_likelihood,
aic, bic, sabic, icl, entropy, smallest_share, delta_bic,
bic_weight, converged. Raises latents_bad_argument for fits it
cannot compare and latents_incomparable_models for fits to different
data.
Wagenmakers, E.-J., & Farrell, S. (2004). AIC model selection using Akaike weights. Psychonomic Bulletin & Review, 11, 192–196.
# Fixed trajectories against growth curves with a random intercept,
# for the first 60 students
few_students <- subset(growth_scores, student <= 60)
trajectories <- mixture_regression(score ~ wave, few_students, n_classes = 2,
id = "student", class_level = "group",
seed = 1)
growth <- mixture_regression(score ~ wave, few_students, n_classes = 2,
id = "student", class_level = "group",
random = "intercept", seed = 1)
compare_models(trajectories = trajectories, growth = growth)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.