View source: R/lca_measurement.R
| lca_step1 | R Documentation |
Estimates the latent class measurement model with multilevLCA and
optionally, fixes mPhi and estimates covariate effects (two-step
initialization) with fitZ_from_fit0().
lca_step1(
data,
Y.names,
n_classes,
Zp.names = NULL,
maxIter.measurement = 5000L,
measurement.tol = 1e-08,
covariate.tol = 1e-06,
iter.measurement = 10L,
R2.threshold = 0.7,
use.two.step = TRUE,
estimate.one.step = TRUE,
incomplete = FALSE,
maxIter.fitZ = 200L,
include.intercept = TRUE,
rebase = "C1",
startval = NULL,
n_init = NULL,
verbose = FALSE
)
data |
A data.frame containing at minimum the indicator columns. |
Y.names |
Character vector of item column names. |
n_classes |
Integer. Number of latent classes. |
Zp.names |
Character vector of covariate column names, or |
maxIter.measurement |
Maximum EM iterations before giving up on convergence. Default |
measurement.tol |
Convergence tolerance. Default |
covariate.tol |
Convergence tolerance for the |
iter.measurement |
Number of random restarts when entropy R |
R2.threshold |
Entropy R |
use.two.step |
Logical. If |
estimate.one.step |
Logical. If |
incomplete |
Logical. FIML for partially missing indicators. See the
|
maxIter.fitZ |
Maximum EM iterations for |
include.intercept |
Logical. Prepend intercept to covariate design matrix. Default |
rebase |
Character or integer specifying the reference latent class.
Use |
startval |
Optional starting classification for the Step-1
measurement model: either an integer vector of length |
n_init |
Optional positive integer. If supplied, fits the
measurement model |
verbose |
Logical. Print progress messages. Default |
A list with $fit0 (multilevLCA::multiLCA() measurement model) and $fitZ
(two-step covariate model from fitZ_from_fit0(), or NULL).
Deprecated as of tseLCA 2.0.0: use tse_lca(). It keeps
working and warns once per session when called directly.
d <- generate_data(200, "high", "covariate", seed = 1)
# Measurement model only
s1 <- lca_step1(d, Y.names = paste0("Y", 1:6), n_classes = 3)
s1$fit0$vPi # estimated class prevalences
s1$fit0$mPhi # item-response probabilities
# With two-step covariate initialization
s1z <- lca_step1(d, Y.names = paste0("Y", 1:6), n_classes = 3,
Zp.names = "Zp", use.two.step = TRUE, verbose = TRUE)
s1z$fitZ$mGamma # two-step gamma estimates
# Many random-classification restarts, keeping the best (analogous to
# n_init in StepMix or nrep in poLCA)
s1r <- lca_step1(d, Y.names = paste0("Y", 1:6), n_classes = 3,
n_init = 20L, verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.