Learn R Programming

LCPA (version 1.0.0)

get.npar.LTA: Calculate Number of Free Parameters in Latent Transition Analysis

Description

Computes the total number of free parameters in a Latent Transition Analysis (LTA) model estimated via the three-step approach. The count depends on the number of latent classes, the number of time points, the number of covariates at each time point, and whether transition coefficients are constrained to be equal across time.

Usage

get.npar.LTA(covariates.ncol, L, covariates.timeCross = FALSE)

Value

Integer representing the total number of free parameters: $$npar = M_1 \times (L-1) + \begin{cases} L \times (L-1) \times M_2 & \text{if } T>1 \text{ and time-invariant effects} \\ \sum_{t=2}^T L \times (L-1) \times M_t & \text{if } T>1 \text{ and time-varying effects} \\ 0 & \text{if } T=1 \end{cases}$$

where:

  • time-invariant effects corresponds to covariates.timeCross = TRUE

  • time-varying effects corresponds to covariates.timeCross = FALSE

Arguments

covariates.ncol

An integer vector of length \(T\) (number of time points). Each element \(M_t\) represents the number of covariates (columns) for time point \(t\). Must include an intercept column (all 1s) as the first covariate.

L

Integer scalar. Number of latent classes (\(L \geq 2\)).

covariates.timeCross

Logical. If TRUE, transition coefficients are constrained to be identical across all transitions (time-invariant effects). This requires that the number of covariates is the same for all time points after the first (i.e., \(M_2 = M_3 = \dots = M_T\)). If FALSE (default), each transition has its own set of coefficients.

Details

Parameterization:

Initial status model (time 1):

Multinomial logit model with \(L\) classes (last class is reference). Number of free parameters: \(M_1 \times (L-1)\).

Transition models (time \(t \to t+1\)):

For each transition, a multinomial logit model conditioned on previous class. For each origin class \(k\) and destination class \(l\) (\(l \neq L\)), there is a coefficient vector of length \(M_{t+1}\). Total per transition: \(L \times (L-1) \times M_{t+1}\) parameters. The constraint covariates.timeCross determines whether these parameters are shared across transitions.

Examples

Run this code
# Example 1: 2 time points, 2 classes, time-invariant transition coefficients
#   Time1: 2 covariates (intercept + 1 predictor)
#   Time2: 3 covariates (but constrained to match Time1 due to timeCross=TRUE)
covariates.ncol <- c(2, 3)
L <- 2
get.npar.LTA(covariates.ncol, L, covariates.timeCross = TRUE)

# Example 2: Same as above but time-varying coefficients
get.npar.LTA(covariates.ncol, L, covariates.timeCross = FALSE)

# Example 3: 3 time points, 3 classes, time-invariant coefficients
covariates.ncol <- c(2, 2, 2)  # All time points have identical covariates
L <- 3
get.npar.LTA(covariates.ncol, L, covariates.timeCross = TRUE)

# Example 4: 3 time points, 3 classes, time-varying coefficients
covariates.ncol <- c(2, 3, 4)
L <- 3
get.npar.LTA(covariates.ncol, L, covariates.timeCross = FALSE)

# Example 5: Single time point (equivalent to LCA)
covariates.ncol <- c(3)
L <- 4
get.npar.LTA(covariates.ncol, L)

Run the code above in your browser using DataLab