Learn R Programming

guess (version 0.2.1)

fit_model: Goodness of fit statistics for transition matrix data

Description

Chi-square goodness of fit between true and model based multivariate distribution. Handles both data with and without don't know responses automatically.

Usage

fit_model(pre_test, pst_test, g, est.param, force9 = FALSE)

fit_dk(pre_test, pst_test, g, est.param, force9 = FALSE)

fit_nodk(pre_test, pst_test, g, est.param)

Value

matrix with two rows: top row carrying chi-square value, bottom row p-values

Arguments

pre_test

data.frame carrying pre_test items

pst_test

data.frame carrying pst_test items

g

estimates of gamma produced from lca_cor

est.param

estimated parameters produced from lca_cor

force9

Optional. Force 9-column format even if no DK responses. Default is FALSE.

Details

Unified Goodness of Fit Statistics

Examples

Run this code
if (FALSE) {
# 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$param.lca[nrow(res$param.lca), ], 
                       res$param.lca[-nrow(res$param.lca), ])
}

Run the code above in your browser using DataLab