philchalmers / mirt

Multidimensional item response theory
https://philchalmers.github.io/mirt/
201 stars 75 forks source link

Residuals fails on large N data #165

Closed mrkwht closed 5 years ago

mrkwht commented 5 years ago

I'm not sure if this is known or not, but I'm having issues with the residual method failing when the N of cases gets above about 100K.

dat<-mirt::simdata(a=rnorm(21),d=rnorm(21),N=140533,itemtype="dich") 
mod <- mirt(dat,1)
residuals(mod)

Above gives error:

Error in if (s == 0) s <- 1 : missing value where TRUE/FALSE needed
In addition: Warning message:
In c + d :
 Show Traceback

 Rerun with Debug
 Error in if (s == 0) s <- 1 : missing value where TRUE/FALSE needed 

But the following runs fine (only difference is N decreases by factor of 10).

dat<-mirt::simdata(a=rnorm(21),d=rnorm(21),N=14053 ,itemtype="dich") 
mod <- mirt(dat,1)
residuals(mod)

Note that the original error I received was an integer overflow error on the same line of the residual function. My data is ordinal and not dichotomous, which appears to push s out of the allowable range for integers. I cannot seem to generate a minimum working example for this issue though...

philchalmers commented 5 years ago

Thanks. Another user reported this a while back too, and the fix is available on the dev version here. Feel free to install to get the fix, or wait until the next formal CRAN release. Cheers.