missing value error when using mirt itemfit function in R

467 views Asked by At

I am trying to conduct an IRT analysis using the mirt() package in R. When I try to run the itemfit() function on the model I previously ran, I get the following error(s):

>itemfit(cnigrm)
Data adjusted so that the lowest category score for every item is 0
Error in if (left) whc - 1L else whc + 1L : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In if (whc == 1L) { :
  the condition has length > 1 and only the first element will be used
2: In if (whc == length(tmp)) { :
  the condition has length > 1 and only the first element will be used

Below is my code. I imputed the missing data in the data file first using the code below, which may be part of the problem. Here is my data - a colleague told me it would be alright to post an deidentified subset of the data.

IRTdata<-read.csv(file="IRTdata.csv")
IRTdata[IRTdata==999]<-NA
library(mirt)

cnigrm<-mirt(IRTdata,1,"graded",technical=list(NCYCLES=50000))
scores<-fscores(cnigrm,method='EAP',full.scores=TRUE,scores.only=TRUE)
fullIRTdata<-imputeMissing(cnigrm,scores)
cnigrm<-mirt(fullIRTdata,1,"graded",technical=list(NCYCLES=50000))

itemfit(cnigrm)

Thanks in advance...

As requested, here is more information:

> dput(head(IRTdata))
structure(list(CNI1 = c(4L, 3L, 7L, 5L, 1L, 1L), CNI2 = c(3L, 
2L, 4L, 2L, 1L, 2L), CNI3 = c(4L, 4L, 7L, 6L, 2L, 4L), CNI4 = c(4L, 
3L, 4L, 5L, 1L, 3L), CNI5 = c(4L, 2L, 1L, 5L, 1L, 6L), CNI6 = c(5L, 
4L, 4L, 5L, 2L, 2L), CNI7 = c(4L, 1L, 4L, 1L, 1L, 3L), CNI8 = c(3L, 
4L, 4L, 5L, 2L, 3L), CNI9 = c(4L, 3L, 4L, 1L, 1L, 7L), CNI10 = c(3L, 
5L, 5L, 5L, 3L, 2L), CNI11 = c(3L, 2L, 4L, 1L, 1L, 1L), CNI12 = c(4L, 
4L, 5L, 6L, 5L, 2L), CNI13 = c(5L, 3L, 5L, 5L, 3L, 1L), CNI14 = c(4L, 
2L, 4L, 4L, 4L, 2L), CNI15 = c(4L, 5L, 5L, 5L, 3L, 5L), CNI16 = c(5L, 
2L, 4L, 1L, 1L, 3L)), .Names = c("CNI1", "CNI2", "CNI3", "CNI4", 
"CNI5", "CNI6", "CNI7", "CNI8", "CNI9", "CNI10", "CNI11", "CNI12", 
"CNI13", "CNI14", "CNI15", "CNI16"), row.names = c(NA, 6L), class = "data.frame")

Another strange update...apparently the subset of data I just posted works. Here is a smaller subset that shows the same error I am asking about. What is different between these two data sets that is giving this error??

0

There are 0 answers