| lca | R Documentation |
Fits a single-level latent class model: each observation belongs to one of
n_classes unobserved classes, and within a class the discrete
indicators are independent. Categorical indicators have unrestricted
response probabilities; ordinal and count in ... choose the
structured measurement models described by multilpa(). It
is the model multilca() fits with id = NULL, and it returns the same
object, so every accessor, plot and inference verb of the package applies
to it. In the results the classes are labelled profile_1, profile_2,
and so on, as throughout the package.
lca(data, vars, n_classes, ...)
data |
A data frame with one row per observation. |
vars |
Names of the discrete indicator columns. Categories are taken
from the data; |
n_classes |
Number of classes, a positive whole number. |
... |
Further arguments for |
For observations nested in groups, use multilca() with the grouping
column as id, which adds latent classes of groups above the classes of
observations.
A fitted multilpa object, as multilca() returns.
latents_bad_argument when id or n_group_classes is passed; the
conditions multilca() raises otherwise.
Lazarsfeld, P. F., & Henry, N. W. (1968). Latent Structure Analysis. Houghton Mifflin.
lpa() for continuous indicators; multilca() for the
two-level model; enumerate_lca() to compare numbers of classes.
fit <- lca(student_esm, c("time_with_friends", "on_social_media",
"tv_video_games", "sports"),
n_classes = 2, n_starts = 3, seed = 1)
fit
plot(fit, what = "heatmap")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.