
Fit latent profile models with different numbers of profiles and covariance structures, and compare them
Source:R/lpa.R
enumerate_lpa.Rdenumerate_lpa() fits latent profile models with different numbers of
profiles and specified covariance structures. It brings together evidence
about fit, classification, and estimation stability to support selection
of the number of profiles and their covariance specification. Each fitted
candidate remains available for detailed examination.
Arguments
- data
A data frame with one row per observation.
- vars
Names of the indicator columns.
- n_profiles
Numbers of profiles to compare, specified as positive integers. Default
1:4.- model
The covariance structures to fit at every number of profiles; each structure with each number of profiles is one candidate.
"basic"(default): four structures."EEI": the profiles share their variances and the indicators are uncorrelated within a profile."VVI": each profile has its own variances, still uncorrelated."EEE": the profiles share one covariance matrix."VVV": each profile has its own covariance matrix."all": all fourteen structures of mclust.One or more of the codes
"EII","VII","EEI","VEI","EVI","VVI","EEE","VEE","EVE","VVE","EEV","VEV","EVV","VVV": those structures only.multilpa()explains the three letters.NULL: no structures are crossed, and every candidate has the structuremultilpa()fits by default ("VVI").
Giving
variance_model,covariance_model,volume,shapeororientationin...sets one structure for every candidate;modelmust then be left out.- ...
Further arguments for
multilpa(), used for every candidate, such asmissing("error"or"fiml"),n_starts,seed,boundary("allow"or"exclude") andcategorical.idandn_group_classesare not accepted.
Value
An object of class multilpa_enumeration, as enumerate_classes()
returns. get_candidates() (also as.data.frame()) gives one row per
candidate with its log likelihood, information criteria, entropy,
convergence and replication; get_best() and summary() the candidate
with the lowest value of each criterion; plot() the criteria against
the number of profiles; and get_candidate() one fitted candidate, a
multilpa fit. A candidate that could not be fitted keeps its row,
with NA values.
Details
This is the single-level interface to enumerate_classes().
For observations nested in groups, use enumerate_classes() with the
grouping column as id, which also varies the number of group classes.
Conditions
latents_bad_argument when id or n_group_classes is passed, when
model names an unknown structure, and when model is given together
with variance_model, covariance_model, volume, shape or
orientation. A latents_single_start message names the candidates
whose best log likelihood was reached from one start only.
See also
lpa() to fit one model; enumerate_lca() for categorical
indicators; bootstrap_lrt() to test one number of profiles against
another.
Examples
models <- enumerate_lpa(srl, c("cognitive_strategies", "intrinsic_value",
"self_efficacy", "self_regulation",
"test_anxiety"),
n_profiles = 1:3, n_starts = 2, seed = 1)
#> 1 of 12 candidates reached their best log likelihood from one start only (profiles3_EEE); refit those you consider with more starts.
summary(models)
#> Class enumeration: 12 candidates, 12 converged, 0 failed to fit
#> 2 distinct candidate(s) are minimal under some criterion.
#> No candidate is selected automatically. Choose one convention and keep it.
#>
#> ! 1 of 12 candidates reached their best log likelihood from one start only
#> (profiles3_EEE); refit those you consider with more starts.
#> ! 1 candidates have a class with average posterior below 0.8 (profiles3_EEE).
#>
#> -- lowest value of each criterion --------------------------------
#> criterion convention candidate value
#> aic <NA> profiles3_VVV 1193
#> kic <NA> profiles3_VVV 1258
#> bic groups profiles1_EEE 1345
#> bic individuals profiles1_EEE 1345
#> sabic groups profiles3_VVV 1226
#> sabic individuals profiles3_VVV 1226
#> caic groups profiles1_EEE 1365
#> caic individuals profiles1_EEE 1365
#> awe groups profiles1_EEE 1520
#> awe individuals profiles1_EEE 1520
#> icl groups profiles1_EEE 1345
#> icl individuals profiles1_EEE 1345
#> clc groups profiles1_EEE 1231
#> clc individuals profiles1_EEE 1231
#>
#> -- knees of bic_groups ----------------------------------------
#> direction line knee_candidate knee_without_largest stable
#> profiles 1 group class, EEE <NA> <NA> NA
#> profiles 1 group class, EEI profiles2_EEI <NA> NA
#> profiles 1 group class, VVI profiles2_VVI <NA> NA
#> profiles 1 group class, VVV <NA> <NA> NA
#> parameters all candidates, EEE <NA> <NA> NA
#> parameters all candidates, EEI profiles2_EEI <NA> NA
#> parameters all candidates, VVI profiles2_VVI <NA> NA
#> parameters all candidates, VVV <NA> <NA> NA
#>
#> Tables: get_candidates(x), get_best(x), get_deltas(x), get_knees(x),
#> get_tree(x), get_classification(x), get_entropy(x), get_checks(x).
#> Plots: plot_criteria(x), plot_deltas(x), plot_avepp(x), plot_tree(x), plot_all(x).
plot(models)