Warning when detecting DIF for binary and graded items together

14 views
Skip to first unread message

Yiqi Zheng

unread,
May 30, 2024, 3:14:18 AMMay 30
to mirt-package
Hello Phill,

I'm working on detecting gender DIF for a booklet with most binary items and some graded items.  I want to fit 2PL for binary items and GPCM for graded items. 

I have already put the graded and binary item names into two lists, which are bk15_graded_items and bk15_binary_items. When I run the codes below, I keep having the warning Error: Keywords and latent trait/class names must differ from colnames(data) for the codes I highlight as red below. I check the colnams which are all item original names, such as  MQ12D02A MQ12D02B MQ12D03 MQ12D04 MQ12D05 MQ12D06A MQ12D06B MQ12D07A. Could you please me have a look to see why I have this warning?

bk15_graded_spec <- paste(bk15_graded_items, "=1-GPCM", collapse=", ")
bk15_binary_spec <- paste(bk15_binary_items, "=1-2PL", collapse=", ")


bk15_model_spec <- paste(bk15_graded_spec, bk15_binary_spec, collapse=", ")


bk15_fit <- mirt(bk15_data[, c(bk15_graded_items, bk15_binary_items)], model = bk15_model_spec, itemtype = 'mixed')


bk15_dif_results <- dif(bk15_fit, group = bk15_data$gender)

Yiqi Zheng

unread,
May 30, 2024, 3:16:51 AMMay 30
to mirt-package
Below are some codes for your reference. Thank you!

> bk15_model_spec
[1] "MQ12B03 =1-GPCM, MQ12B05C =1-GPCM, MQ12D07B =1-GPCM MQ12B01 =1-2PL, MQ12B02 =1-2PL, MQ12B04A =1-2PL, MQ12B04B =1-2PL, MQ12B04C =1-2PL, MQ12B05A =1-2PL, MQ12B05B =1-2PL, MQ12R01 =1-2PL, MQ12R02A =1-2PL, MQ12R02B =1-2PL, MQ12R02C =1-2PL, MQ12D01 =1-2PL, MQ12D02A =1-2PL, MQ12D02B =1-2PL, MQ12D03 =1-2PL, MQ12D04 =1-2PL, MQ12D05 =1-2PL, MQ12D06A =1-2PL, MQ12D06B =1-2PL, MQ12D07A =1-2PL, MQ12D08A =1-2PL, MQ12D08B =1-2PL"

> bk15_data[, c(bk15_graded_items, bk15_binary_items)]
   MQ12B03 MQ12B05C MQ12D07B MQ12B01 MQ12B02 MQ12B04A MQ12B04B MQ12B04C MQ12B05A MQ12B05B MQ12R01 MQ12R02A MQ12R02B MQ12R02C MQ12D01
1       NA        0        1       1       0        0        1        0        1        1       1        1        1        1       0
2        2        1        0       1       0        0        1        1        1        1       0        1        1        1       1
3        0        0        0       0       0        0        0        0        0        0       0        1        1        0       0
4        2        0        0       1       0        0        0        0        1        1       0        0        0        0       0
5        0        0        0       0       0        0        0        0        0        0       0        0        0        0       0
6        0        0        0       0       0        0        0        0        0        0       0        0        0        0       0
7       NA        0        0       0       0        0        0        0        0        0       0        0        0        0       0
8        0        0        0       0       0        0        0        0        0        0       0        1        0        0       0
9        2        0        1       1       1        1        1        1        1        1       1        1        1        1       1
10       0        0        0       0       0        0        0        0        0        0       0        0        0        0       0
11       0        0        0       1       0        0        1        0        1        1       0        0        0        0       0
12      NA        0        2       1       0        0        1        1        0        1       1        1        1        0       1
13       0        0        0       0       0        0        0        0        1        0       0        0        0        0       0
14      NA        0        0       0       0        0        0        1        0        0       0        0        0        0       0
15       2        0        0       1       0        0        1        1        0        1       0        1        1        0       1
16       2        0        2       1       1        1        1        1        1        1       1        1        0        1       1
17       0        0        0       0       0        0        0        0        1        1       1        1        1        1       0
18      NA        0        0       0       1        1        0        0        1        1       1        0        0        0       0
19      NA        0        0       0       0        0        0        0        0        0       0        0        0        0       0
20       2        0        0       1       0        0        1        0        0        1       0        0        0        0       1
21      NA        0        2       1       1        0        0        1        1        1       1        0        0        0       0
22       0        0        0       1       0        0        0        0        1        1       0        1        0        0       1
23       2        0        0       1       0        1        1        1        1        1       1        1        1        1       1
24       0        0        0       0       0        0        0        0        0        0       0        0        0        0       0
25       0        0        0       0       0        0        0        0        0        0       0        0        0        0       0
26       0        0        0       1       0        0        0        1        0        0       0        1        1        0       0
27       2        1        2       1       0        1        1        1        1        1       1        1        1        1       1
28       0        0        0       0       0        0        0        0        0        0       0        0        0        0       1
29       2        1        0       1       1        0        1        1        1        1       0        0        0        0       1
30       0        0        0       1       0        1        1        0        1        1       0        0        0        0       0
31      NA        0        0       0       1        0        1        0        0        1       0        0        0        0       0
32       2        0        0       1       1        0        1        1        0        1       0        0        0        0       1
33       2        0        2       1       1        1        1        1        0        0       1        1        1        1       1
34      NA        0        1       0       0        0        0        0        1        1       0        0        0        0       0
35      NA        0        0       0       0        0        0        0        1        0       0        0        0        0       0
36       0        0        1       0       0        0        0        0        0        0       0        0        0        0       0
37       2        0        0       1       1        1        1        1        1        1       1        1        1        0       1
38       0        0        0       0       0        0        0        0        0        0       0        0        0        0       0
39      NA        0        0       1       0        1        0        1        1        1       1        1        1        1       1
40       0        0        0       0       0        1        0        1        1        1       1        0        0        0       1

Phil Chalmers

unread,
May 30, 2024, 4:40:10 PMMay 30
to Yiqi Zheng, mirt-package
dif() is not a function defined in mirt (DIF() is, however). It also doesn't look like you're defining a supported itemtype, or even a valid model definition. Might help to refer to the documentation in help(mirt.model) before moving forward.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mirt-package/3a4c1ffb-20af-4088-af5e-af766939e17en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages