Learn R Programming

guess (version 0.7.0)

person_item_lca_fit: Fit a Joint Person-Level Latent Class Model

Description

Fits one latent transition class per person across repeated items. Class proportions are shared across items, while guessing probabilities are item-specific. Parameters are estimated jointly by expectation-maximization.

Usage

person_item_lca_fit(
  pre_test,
  pst_test,
  na_as = c("dk", "missing"),
  missing_action = c("omit", "error"),
  item_fit = NULL,
  max_iter = 1000L,
  tol = 1e-08
)

Value

An object of class guess_person_fit containing shared class proportions, item-specific guessing probabilities, person-level posterior probabilities, log-likelihood, and convergence information.

Arguments

pre_test

data frame of pre-test responses

pst_test

data frame of post-test responses

na_as

classification of NA responses

missing_action

structural missingness handling

item_fit

optional item-wise fit used to initialize the EM algorithm

max_iter

maximum EM iterations

tol

convergence tolerance

Details

This is distinct from item_lca_fit, which fits independent class proportions for each item.

Examples

Run this code
sim <- simulate_lca(n = 500, n_items = 4, seed = 123)
fit <- person_item_lca_fit(sim$pre, sim$post)
fit$class_priors
head(fit$posterior)

Run the code above in your browser using DataLab