Creates item transition counts from paired responses, then estimates the constrained latent-class model of Cor and Sood (2016) independently for each item. This is equivalent to calling [count_item_transitions()] followed by [fit_item_lca_counts()].

fit_item_lca(
  pre_test,
  post_test,
  ...,
  subgroup = NULL,
  include_aggregate = FALSE,
  na_as = c("dk", "missing"),
  missing_action = c("omit", "error"),
  start = NULL,
  control = list()
)

Arguments

pre_test

Data frame containing one pre-test item per column.

post_test

Data frame containing the corresponding post-test items.

...

Must be empty. Its presence requires optional arguments to be named.

subgroup

Optional logical vector selecting observations to fit.

include_aggregate

Whether to fit the item-total transition counts and store that fit separately in `aggregate`.

na_as

Classification of `NA` responses: `"dk"` treats them as observed don't-know responses and `"missing"` treats them as structural missingness.

missing_action

How to handle structural missingness: `"omit"` excludes incomplete pairs and `"error"` rejects them.

start

Optional named feasible starting vector passed to [fit_item_lca_counts()].

control

List passed to the `control` argument of [Rsolnp::solnp()].

Value

A `guess_fit` object. `diagnostics` records optimizer results by item. An aggregate fit, when requested, is stored separately and excluded from item metadata.

References

Cor, M. K., and Sood, G. (2016). Guessing and Forgetting: A Latent Class Model for Measuring Learning. *Political Analysis*, 24(2), 226–242.

Galanos, A., and Ye, Y. (2025). *Rsolnp: General Non-Linear Optimization*. R package version 2.0.1.

Examples

sim <- simulate_lca(n = 500, n_items = 2, seed = 123)
fit_item_lca(sim$pre, sim$post)
#> LCA Model Fit
#> ----------------------------------------
#> Items: 2  | Observations: 1000 
#> Model: Without Don't Know 
#> 
#> Learning estimates:
#> item1 item2 
#> 0.275 0.290 
#> 
#> Use summary() for parameter details, coef() to extract parameters.