# How to check goodness of fit for a graded response model in R

I am using the grm function in the ltm package in R. There is no function to check the goodness of fit of the output. How can I check if the graded response model is a good fit to the data?

• GoF=goodness of fit, GRM=graded response model, right? – Momo Apr 30 '14 at 10:11
• Yes. that's right – Deepak Agarwal May 1 '14 at 3:55

The ltm package in R does not have effective global model fit statistics available; one could construct the $G^2$ statistic from the complete-data tables in this package, but this statistic behaves extremely poorly in moderate to large sized tests due to extreme levels of data sparseness. However, the mirt package does have suitable limited information tests of overall model fit (version 1.3.3+).

You can call the M2* statistic (Cai and Hansen, 2013) for several polytomous models using the M2() function, which collapses the highly sparse complete data tables into first- and second-order information (i.e., means and covariances) to test the goodness of fit based on these marginals instead. For instance,

library(mirt)
set.seed(1)
a <- matrix(rlnorm(20))
diffs <- t(apply(matrix(runif(20*4, .3, 1), 20), 1, cumsum))
diffs <- -(diffs - rowMeans(diffs))
d <- diffs + rnorm(20)

# simulate 20 items, each with 5 ordered categories
dat <- simdata(a, d, N=1000, itemtype = 'graded')

# estimate the model
mod <- mirt(dat, 1)
Iteration: 63, Log-Lik: -22946.624, Max-Change: 0.00009

# M2() statistic
M2(mod)
M2  df         p      RMSEA RMSEA_5   RMSEA_95       TLI       CFI      SRMSR
stats 126.155 110 0.1390846 0.01212481       0 0.02091059 0.9955107 0.9962014 0.02216049