| fit_model | R Documentation |
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")
)
pre_test |
data.frame carrying pre_test items |
pst_test |
data.frame carrying pst_test items |
g |
estimates of gamma produced from |
est_param |
estimated parameters produced from |
force9 |
Optional. Force 9-column format even if no DK responses. Default is FALSE. |
na_as |
Classification of NA responses: '"dk"' (the default) treats them as observed don't know responses; '"missing"' treats them as structural missingness. |
missing_action |
How to handle structural missingness: '"omit"' excludes incomplete pairs and '"error"' rejects them. |
Unified Goodness of Fit Statistics
matrix with two rows: top row carrying chi-square value, bottom row p-values
## Not run:
# 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), ]
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.