我正在尝试使用R中的mirt()包进行IRT分析。当我尝试在我之前运行的模型上运行itemfit()函数时,我收到以下错误:
>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
以下是我的代码。我首先使用下面的代码将丢失的数据估算到数据文件中,这可能是问题的一部分。 Here是我的数据 - 一位同事告诉我,发布一个已识别的数据子集是可以的。
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)
提前致谢...
根据要求,这里有更多信息:
> 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")
另一个奇怪的更新......显然我刚发布的数据子集有效。 Here是一个较小的子集,显示了我所询问的相同错误。给出这个错误的这两个数据集之间有什么不同