# Implements S-X^2
# Each item in U starts with 0
# mincell is minimum allowed cell value before collapse
itemFitTestGardener <- function(model, data, items = 1:ncol(data), mincell = 1, kernelDensity = F) {
# get wdfList for last cycle
parList <- model$parList[[length(model$parList)]]
# create list of model probabilities for each item
probMatList <- list()
itemDFs <- vector("numeric", length = ncol(data))
for (item in items) {
probMatList[[item]] <- t(parList$WfdList[[item]]$Pmatfine)
# no of basis splines times categories - 1 is DF?
itemDFs[item] <- parList$WfdList[[item]]$Wfd$basis$nbasis*(nrow(probMatList[[item]])-1)
}
density <- if (kernelDensity)
cbind(0:100, density(parList$theta, from = 0, to = 100, n=101)$y)
else
cbind(0:100, parList$densfine)
return(itemFit(data, probMatList, density, itemDFs))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.