Issue with itemfit() and DIF()

119 views
Skip to first unread message

Matthew Sigal

unread,
Oct 7, 2014, 8:52:05 AM10/7/14
to mirt-p...@googlegroups.com
I'm assuming these two errors are related, so I'm posting them together.  I am looking at a scale that consists of 8 tasks, which I'm looking at independently for the time being.

1) When I try to run itemfit() on each scale, I can the following error: "Error in makeObstables(dat, x@K) :   NAs are not allowed in subscripted assignments"
2) When I try to run DIF for Ethnicity (4 groups) on my multipleGroup object, I get the following error: "Error in constrain[[i]] : attempt to select less than one element"

There is no missing data, and all questions have at least 2 response values (0, 1, or 2), in gpcm models with large sample size.

Here is the code I'm having trouble with:

#scoredNames is a list with character vectors for each task (pertaining to the items used)
modAU2 <- mirt(data = scored[, scoredNames$tA], 1, itemtype = "gpcm", TOL = 1e-3)
fit <- itemfit(modAU2)

naDIFA <- multipleGroup(data = scoredNA[, scoredNames$tA], 1, group = demosNA$Ethnicity, invariance = scoredNames$tA)
(stepdownA <- DIF(naDIFA, c('a1', 'd'), scheme = 'drop_sequential'))

Any ideas?

Phil Chalmers

unread,
Oct 7, 2014, 12:23:54 PM10/7/14
to Matthew Sigal, mirt-package
Looks to be a bug on both fronts. Patches have been made on the dev version 1.5.11. Thanks for the report!

Phil

--
You received this message because you are subscribed to the Google Groups "mirt-package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mirt-package...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Joldersma

unread,
Apr 22, 2015, 4:10:18 PM4/22/15
to mirt-p...@googlegroups.com, matthe...@gmail.com
I'm having the same issues in mirt 1.9 with itemfit(). I have 8 polytomous (0-8) items with no missing values and no missing categories.

Session info and code I'm using below:

R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] mirt_1.9        lattice_0.20-31 ltm_1.0-0       polycor_0.7-8   sfsmisc_1.0-27 
 [6] mvtnorm_1.0-2   msm_1.5         MASS_7.3-40     RPostgreSQL_0.4 DBI_0.3.1      
[11] dplyr_0.4.1     RODBC_1.3-11    reshape2_1.4.1  plyr_1.8.2     

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.5           assertthat_0.1        grid_3.2.0            magrittr_1.5         
 [5] Matrix_1.2-0          splines_3.2.0         tools_3.2.0           stringr_0.6.2        
 [9] GPArotation_2014.11-1 survival_2.38-1       parallel_3.2.0        expm_0.99-1.1 


mod <- mirt(e7060, 1)
itemfit(mod)

Error in makeObstables(dat, x@K) : 
  NAs are not allowed in subscripted assignments



Phil Chalmers

unread,
Apr 22, 2015, 4:13:41 PM4/22/15
to Kevin Joldersma, mirt-package, Matthew Sigal
Hi Kevin,

Could you provide something more reproducible? I'm surprised this bug came back.

Phil

Kevin Joldersma

unread,
Apr 22, 2015, 5:23:45 PM4/22/15
to mirt-p...@googlegroups.com, kevin.j...@gmail.com, matthe...@gmail.com
Hi Phil,

Thanks for the quick response. Here's a minimal dput of my dataset. Along with previous info, is this enough to reproduce?

Best,

-Kevin

> dput(e7060[1:50,])
structure(list(da = c(3L, 5L, 8L, 6L, 8L, 7L, 6L, 
8L, 8L, 4L, 6L, 5L, 5L, 6L, 6L, 6L, 4L, 6L, 6L, 5L, 5L, 5L, 6L, 
6L, 5L, 5L, 6L, 6L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 5L, 6L, 3L, 5L, 
7L, 6L, 5L, 0L, 6L, 3L, 8L, 7L, 8L, 3L, 3L), ps = c(5L, 
5L, 1L, 7L, 8L, 2L, 3L, 7L, 5L, 5L, 6L, 5L, 6L, 6L, 6L, 4L, 5L, 
5L, 7L, 6L, 6L, 6L, 6L, 6L, 5L, 5L, 6L, 6L, 6L, 5L, 6L, 5L, 2L, 
5L, 6L, 6L, 6L, 5L, 6L, 6L, 6L, 5L, 0L, 7L, 2L, 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7L, 0L, 6L, 2L, 8L, 5L, 6L, 2L, 2L), cc = c(4L, 
4L, 8L, 4L, 1L, 7L, 6L, 7L, 5L, 4L, 6L, 6L, 6L, 6L, 6L, 8L, 0L, 
6L, 6L, 6L, 6L, 6L, 0L, 7L, 6L, 6L, 6L, 8L, 6L, 6L, 3L, 5L, 0L, 
6L, 6L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 0L, 6L, 2L, 8L, 8L, 7L, 3L, 
2L)), .Names = c("da", "ps", "pm", 
"ru", "hcp", "ircs", "cp", "cc"), row.names = c(NA, 
50L), class = "data.frame")

Phil Chalmers

unread,
Apr 22, 2015, 6:18:03 PM4/22/15
to Kevin Joldersma, mirt-package, Matthew Sigal
Thanks Kevin, but that doesn't quite do it. I get this as output with the dev version (similar results with 1.9):

> itemfit(mod)
  item     Zh    S_X2 df.S_X2 p.S_X2
1   da 0.4463 23.7734       4 0.0001
2   ps 0.0729 12.4112       2 0.0020
3   pm 0.4901 12.5704       3 0.0057
4   ru 0.1471  9.7467       2 0.0076
5  hcp 0.6092 28.4652       5 0.0000
6 ircs 0.5865 12.5617       1 0.0004
7   cp 0.4421 23.6166       4 0.0001
8   cc 0.1663     NaN       0    NaN

> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8       
 [4] LC_COLLATE=en_CA.UTF-8     LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mirt_1.9.1      lattice_0.20-31 testthat_0.9.1  devtools_1.7.0 

loaded via a namespace (and not attached):
[1] tools_3.2.0           roxygen2_4.1.0        Rcpp_0.11.5           grid_3.2.0           
[5] stringr_0.6.2         numDeriv_2012.9-1     GPArotation_2014.11-1 sfsmisc_1.0-27     
Reply all
Reply to author
Forward
0 new messages