R/fit_unified.R
assess_item_lca_fit.RdComputes per-item Pearson diagnostics between paired observed responses and the cell counts implied by a [fit_item_lca()] or [fit_item_lca_counts()] result. It is an in-sample specification diagnostic, not a measure of held-out predictive performance. Use [score_item_lca()] with independent transition counts or [cv_individual_lca()] for held-out evaluation.
The binary model is saturated: its three free cell probabilities are exactly accounted for by its three free parameters, so it has zero degrees of freedom and no p-value. The don't-know model has one remaining over-identifying restriction and therefore one degree of freedom.
A `guess_fit` object returned by [fit_item_lca()] or [fit_item_lca_counts()].
Data frame containing one pre-test item per column.
Data frame containing the corresponding post-test items.
Must be empty. Its presence requires optional arguments to be named.
Classification of `NA` responses: `"dk"` treats them as observed don't-know responses and `"missing"` treats them as structural missingness.
How to handle structural missingness: `"omit"` excludes incomplete pairs and `"error"` rejects them.
A `guess_gof` object with `statistics`, a data frame containing the unrounded Pearson statistic, degrees of freedom, p-value, and observation count for each item; plus `observed`, `expected`, and `residuals` matrices.
Pearson, K. (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. *Philosophical Magazine*, 50(302), 157–175. doi:10.1080/14786440009463897.
Cor, M. K., and Sood, G. (2016). Guessing and Forgetting: A Latent Class Model for Measuring Learning. *Political Analysis*, 24(2), 226–242.
sim <- simulate_lca_dk(n = 500, n_items = 2, seed = 123)
fit <- fit_item_lca(sim$pre, sim$post)
assess_item_lca_fit(fit, sim$pre, sim$post)
#> Item-level Pearson goodness-of-fit diagnostics
#> statistic df p_value n_observations
#> item1 0.3212243 1 0.5708728 500
#> item2 0.5268087 1 0.4679517 500
#>
#> Use $observed, $expected, and $residuals for cell-level diagnostics.