| lta | R Documentation |
Fits latent profiles to repeated observations of the same group and
estimates the probabilities of moving between them from one occasion to the
next. The measurement model is that of multilpa() – Gaussian, categorical
or mixed indicators, invariant across occasions – so profiles keep the same
meaning at every occasion and a change of profile is a change of state
rather than a change of definition. With more than one group class, each
class carries its own initial distribution and its own transition matrix,
which is how groups that differ in their dynamics are separated from groups
that differ only in where they start.
lta(
data,
vars,
id,
n_profiles,
time,
n_group_classes = 1L,
variance_model = c("varying", "equal"),
n_starts = 10L,
max_iter = 1000L,
tol = 1e-08,
min_variance = 1e-06,
seed = NULL,
missing = c("error", "fiml"),
covariance_model = c("diagonal", "full"),
categorical = character(),
min_probability = 1e-10,
occasions = c("observed", "grid"),
select_start = c("likelihood", "converged"),
transitions = c("homogeneous", "occasion"),
transition_covariates = character(),
initial_covariates = character(),
measurement = c("invariant", "occasion"),
order = 1L,
model = NULL,
mover_stayer = FALSE,
weights = NULL,
ordinal = character(),
count = character(),
count_model = c("poisson", "negative_binomial"),
count_dispersion = c("varying", "equal")
)
data |
A data frame containing indicators and a group identifier. |
vars |
Unique character vector of continuous indicator column names. |
id |
Name of the observed group identifier column. Character, factor, or
numeric identifiers are supported; missing identifiers are not. Required
here: this model has a second level by construction, so it has no
single-level form and does not take |
n_profiles |
Integer number of individual profiles, at least two. |
time |
Name of the column giving each observation's occasion within its group. Required: this model is defined by the ordering. Values must be complete and unique within each group. |
n_group_classes |
Positive integer number of latent group classes. One gives an ordinary single-level latent transition model; more than one fits a mixture of transition models over groups. |
variance_model |
Either |
n_starts |
Positive integer number of EM starts. The first is
deterministic: Ward's hierarchical clustering of the standardized
indicators (on at most 2000 evenly spaced rows), each cluster described by
its own means and spread, which is the start mclust's name refers to and
finds solutions whose profiles differ in shape. The rest are k-means from
random centres. When |
max_iter |
Nonnegative integer maximum number of EM updates per start.
|
tol |
Positive relative log-likelihood tolerance. Convergence requires
absolute change no greater than |
min_variance |
Positive lower bound on each variance, or each covariance eigenvalue for full covariance, in squared input units. This defines a constrained maximum-likelihood problem. Bound-active estimates are explicitly reported and generate a warning. |
seed |
Optional random seed: any whole number |
missing |
|
covariance_model |
|
categorical |
Character vector naming indicators to treat as categorical. Each is modelled by unrestricted, profile-specific response probabilities over its observed categories, which is the latent class measurement model. Binary, ordinal and unordered indicators are all handled by the same unrestricted parameterization; numeric, integer, logical, character and factor columns are accepted. Indicators not named here stay Gaussian, so naming a subset fits a mixed-mode model. |
min_probability |
Positive lower bound on every categorical response
probability, defining a constrained maximum-likelihood problem in the same
way |
occasions |
How a group's occasions are placed on the transition grid.
|
select_start |
Which start the fit reports. |
transitions |
|
transition_covariates |
Names of columns whose values shift the transition probabilities through a multinomial logit per origin profile: the log odds of moving to each other profile rather than staying. A column may change over occasions; the value at the destination occasion is used. Factors are expanded to indicator columns. |
initial_covariates |
Names of columns that shift the initial profile distribution (a multinomial logit, reference: the last profile), read at each group's first occasion. |
measurement |
|
order |
|
model |
A covariance structure as |
mover_stayer |
|
weights |
|
ordinal, count, count_model, count_dispersion |
Ordinal and count
indicators, as in |
This is latent transition analysis (LTA); with more than one group class it
is a mixture over transition patterns, so the classes are trajectories rather
than states. multilpa() is the cross-sectional counterpart.
By default transitions are first order and homogeneous over
occasions: the probability of moving from one profile to another does not
depend on the occasion or on earlier profiles. Measurement parameters are
shared across occasions and across group classes. A profile that no group occupies before
its final occasion leaves its transition row without information; the row
is then uniform by construction rather than estimated. Such a row is warned
about when the model is fitted, is flagged by the estimated column of
the transition table and is listed by
get_results(fit, "transitions", estimated = FALSE).
Profile labels are arbitrary and
are not comparable across fits without alignment.
max_iter = 0 updates nothing: the starting values are evaluated and
returned with the expectation they imply, and the fit reports
converged = FALSE after zero iterations. Every reported quantity,
including expected_count and the implied profile prevalence, is then
read off that single expectation.
A multilpa_transitions object containing means, variances,
optional covariances and response_probabilities,
initial_probabilities (group classes by profiles),
transition_probabilities (profiles by profiles by group classes, rows
indexing the profile moved from), group_probabilities, posterior
matrices, classifications, log likelihood, information criteria, restart
diagnostics and convergence history. Use get_results() for the tidy
transition table and for the other
tables. No standard
errors, likelihood-ratio tests or guarantees of global optimality are
given for this model family.
With transitions = "occasion", transition_covariates,
initial_covariates, measurement = "occasion" or order = 2 the
result is a multilpa_lta object instead, read with
get_results.multilpa_lta(): transition and initial logit coefficients
with Wald standard errors (observed, robust or OPG, from analytic
scores), model-implied transition probabilities per occasion, profiles
per occasion. Missing indicators (missing = "fiml") and covariance
structures are supported; diagonal fits are finished by a quasi-Newton
search on the exact likelihood, others by EM.
Agreement with Mplus (User's Guide examples 8.13, 8.14; occasion-specific
thresholds), depmixS4 and LMest is recorded in
equivalence/lta-extensions/ of the source repository.
Collins, L. M., & Lanza, S. T. (2010). Latent class and latent transition analysis. Wiley.
Vermunt, J. K. (2003). Multilevel latent class models. Sociological Methodology, 33, 213–239. doi:10.1111/j.0081-1750.2003.t01-1-00131.x.
get_results() for the fitted transition probabilities and for the
assignments in order, and multilpa() for the
cross-sectional model this one shares its measurement parameters with.
# Students take their courses in their own order, which `sequence` records,
# so the same enrolments that fit a cross-sectional model fit a transition
# one. Engagement mostly persists from one course to the next.
fit <- lta(
course_engagement,
vars = c("browse", "lectures", "forum_read", "forum_post", "attendance"),
id = "student", n_profiles = 2, time = "sequence", n_starts = 2, seed = 1
)
get_results(fit, what = "transitions")
summary(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.