# Implements S-X^2
# Each item in U starts with 0
# mincell is minimum allowed cell value before collapse
itemFitMirt <- function(mirtModel, data, items = 1:extract.mirt(mirtModel, "nitems"), approxThetaPdf = F) {
theta_lim <- c(-6, 6)
qpoints <- seq(-6, 6, length.out = 101)
probMatList <- list()
itemDFs <- vector("numeric", length = ncol(data))
for (item in items) {
extr <- extract.item(mirtModel, item)
probMatList[[item]] <- t(probtrace(extr, qpoints))
# no of parameters is Df for item
itemDFs[item] <- sum(mirtModel@ParObjects$pars[[item]]@est)
}
density <- if (approxThetaPdf)
cbind(qpoints, density(fscores(hadsAnxietyGrm), n=101)$y)
else
cbind(qpoints, dnorm(qpoints))
return(itemFit(data, probMatList, density, itemDFs))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.