fast_lca {svs} | R Documentation |
Latent Class Analysis
Description
A fast procedure for computing latent class analysis.
Usage
fast_lca(dat, k, tol = 1e-08, posterior = FALSE, transform = 1, sep = "_")
Arguments
dat |
Input data: can be a table or a data frame. |
k |
Numeric specification of the number of latent classes to compute. |
tol |
Numeric specification of the convergence criterion. |
posterior |
Logical indicating whether the posterior probabilities of the individual observations should also be returned. |
transform |
Numeric specification of the power transformation to be applied on the posterior distribution; see |
sep |
Character specifying the separator string for joining the levels (if |
Details
The prior probabilities of the latent classes are initialized with a Dirichlet distribution (by means of rdirichlet
from
the package gtools) with alpha =
the total frequency counts of every level.
Value
A list with components:
prob0 |
The probabilities of the latent classes. |
prob1-prob... |
The probabilities for each set of levels. The columns of each |
posterior |
If |
References
Agresti, A. (2013) Categorical data analysis. Hoboken: John Wiley and Sons, 535–542.
Examples
SndT_Fra <- read.table(system.file("extdata", "SndT_Fra.txt", package = "svs"),
header = TRUE, sep = "\t", quote = "\"", encoding = "UTF-8",
stringsAsFactors = FALSE)
lca_SndT_Fra <- fast_lca(SndT_Fra, k = 7)
lca_SndT_Fra