Pearson chi-square goodness of fit between the observed transition counts and those the fitted model implies. Handles data with and without don't know responses automatically.
Degrees of freedom are the free cell probabilities less the parameters estimated from the same counts. The don't-know model leaves 1 degree of freedom. The model without don't know is saturated – 3 free parameters against 3 free cell probabilities – so no test is possible and both rows are `NA`.
fit_model(
pre_test,
pst_test,
g,
est_param,
force9 = FALSE,
na_as = c("dk", "missing"),
missing_action = c("omit", "error")
)
fit_dk(
pre_test,
pst_test,
g,
est_param,
force9 = FALSE,
na_as = c("dk", "missing"),
missing_action = c("omit", "error")
)
fit_nodk(
pre_test,
pst_test,
g,
est_param,
na_as = c("dk", "missing"),
missing_action = c("omit", "error")
)data.frame carrying pre_test items
data.frame carrying pst_test items
estimates of gamma produced from lca_cor
estimated parameters produced from lca_cor
Optional. Force 9-column format even if no DK responses. Default is FALSE.
Classification of NA responses: `"dk"` (the default) treats them as observed don't know responses; `"missing"` treats them as structural missingness.
How to handle structural missingness: `"omit"` excludes incomplete pairs and `"error"` rejects them.
matrix with two rows: top row carrying chi-square value, bottom row p-values
Unified Goodness of Fit Statistics
if (FALSE) { # \dontrun{
# Fit model first
transmatrix <- multi_transmat(pre_test, pst_test)
res <- lca_cor(transmatrix)
# Calculate goodness of fit
fit_stats <- fit_model(
pre_test, pst_test, res$params[nrow(res$params), ],
res$params[-nrow(res$params), ]
)
} # }