Learn R Programming

LCPA (version 1.0.0)

get.SE: Compute Standard Errors

Description

Computes approximate standard errors (SEs) for estimated parameters in Latent Class Analysis (LCA) or Latent Profile Analysis (LPA) models using two methods:

  • "Bootstrap": Non-parametric bootstrap with label-switching correction. McLachlan & Peel (2004) suggest that 50–100 replicates often provide adequate accuracy for practical purposes, though more (e.g., 500–1000) may be preferred for publication-quality inference.

  • "Obs": Numerical evaluation of the observed information matrix (Hessian of negative log-likelihood)

Users should note that get.SE computes standard errors based on the observed information matrix via numerical differentiation, which may lack precision and often yields ill-conditioned matrices. Therefore, we recommend using method = "Bootstrap".

Usage

get.SE(object, method = "Bootstrap", n.Bootstrap = 100, vis = TRUE)

Value

A list of class "SE" containing:

se

Named list of SEs matching parameter structure of input model:

  • LPA: means (matrix: classes x variables), covs (array: vars x vars x classes), P.Z (vector: class prob SEs)

  • LCA: par (array: classes x items x categories), P.Z (vector: class prob SEs)

  • Critical Note for "Obs" method: Only free parameters have non-zero SEs. Non-free parameters (e.g., last class probability in P.Z due to sum-to-1 constraint; last category probability in LCA items) have SE=0. Bootstrap provides SEs for all parameters.

vcov

NULL for bootstrap. For "Obs": variance-covariance matrix (may be regularized). Diagonal contains squared SEs of free parameters.

hessian

NULL for bootstrap. For "Obs": observed information matrix (pre-regularization). Dimension = number of free parameters.

diagnostics

Method-specific diagnostics:

  • Bootstrap: n.Bootstrap.requested, n.Bootstrap.completed

  • Obs: Hessian computation details, condition number, regularization status, step sizes

call

Function call that generated the object

arguments

List of input arguments

Arguments

object

An object of class "LCA" or "LPA" returned by LCA or LPA.

method

Character specifying SE calculation method: "Obs" or "Bootstrap" (default).

n.Bootstrap

Integer. Number of bootstrap replicates when method="Bootstrap" (default=100).

vis

Logical. If TRUE, displays progress information during estimation (default: TRUE).

References

McLachlan, G. J., & Peel, D. (2004). Finite Mixture Models. Wiley. https://books.google.com.sg/books?id=c2_fAox0DQoC

Examples

Run this code
# \donttest{
library(LCPA)
set.seed(123)

# LPA with Bootstrap (minimal replicates for example)
lpa_data <- sim.LPA(N = 500, I = 4, L = 3)
lpa_fit <- LPA(lpa_data$response, L = 3)
se_boot <- get.SE(lpa_fit, method = "Bootstrap", n.Bootstrap = 10)

print(se_boot)
extract(se_boot, "covs")


# LCA with Observed Information (note zeros for constrained parameters)
lca_data <- sim.LCA(N = 500, I = 4, L = 3, poly.value = 5)
lca_fit <- LCA(lca_data$response, L = 3)
se_obs <- get.SE(lca_fit, method = "Obs")

print(se_obs)
extract(se_obs, "par")
# }

Run the code above in your browser using DataLab