| select_n_classes | R Documentation |
Fits a latent class metafrontier model for each value in
n_classes_range and tabulates the Bayesian information
criterion (BIC) and marginal log-likelihood of each fit. The
optimal number of classes minimises BIC. Fits that fail are
silently dropped from the table. Because the EM algorithm can
converge to local optima, the ranking is sensitive to the number
of random starts: pass n_starts (forwarded to
latent_class_metafrontier) and increase it for a
more reliable comparison across class counts.
select_n_classes(formula, data, n_classes_range = 2:5, ...)
formula |
formula. |
data |
data frame. |
n_classes_range |
integer vector of class counts to try. |
... |
additional arguments passed to
|
A data frame with columns n_classes, BIC,
and marginal_ll.
sim <- simulate_metafrontier(n_groups = 2, n_per_group = 80, seed = 42)
bic_table <- select_n_classes(
log_y ~ log_x1 + log_x2,
data = sim$data, n_classes_range = 2:3,
n_starts = 3, seed = 42
)
print(bic_table)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.