DIF on bifactor model: Error in `*tmp*`[[i]] : subscript out of bounds

337 views
Skip to first unread message

Michael Paul Grosz

unread,
Sep 8, 2014, 8:23:30 AM9/8/14
to

Dear Phil and others,

I encountered the following error when I was trying to do a DIF analysis on a bifactor model (set of 9 items, all items were administered on a 6 point-Likert scale, N=1858).

gender <- ordered(Data[,1])

ADMm <- '

Adm = 1-9'

 

modelADM <- mirt.model(ADMm)

specific <- c(1,1,NA,NA,2,1,NA,2,2)

 

ADMbf <- bfactor(data=ADM, model=specific,model2=modelADM, group=gender,itemtype='graded')

 

> ADM.DIF <- DIF(ADMbf, c('a1','d1','d2','d3','d4','d5'),scheme="add_sequential")

Checking for DIF in 0 more items

Computing final DIF estimates...

Error in `*tmp*`[[i]] : subscript out of bounds


Do you have any idea how I could fix the problem?

I did not get this error when I used the default scheme ("add") on the same model.

Btw, based on which literature did you implement the “add_sequential” and "drop_sequential" scheme? In the "drop" and "drop_sequential" scheme, does one need to know beforehand that at least one item is DIF-free (anchor item)? So, if I don't know whether any of the items is DIF-free, I better use the "add" schemes?

Another question is, how does DIF treat the grouping factors (facets) when DIF is tested within the framework of a bifactor model?

I got an error when I included the discrimination parameters of the grouping factors ('a2','a3').

How does the DIF function take into account the discrimination parameters a2 and a3 when it calculates DIF for a1? could I also do a DIF analysis on the discrimination parameters a2 and a3?

Furthermore, in another set of items, I encountered the following message:EM cycles terminated after 500 iterations.
I tried to increase the number of cycles by the argument NCYCLES but I got the same message again.
> RIV.DIF <- DIF(RIVbf, c('a1','d1','d2','d3','d4','d5'),scheme="add_sequential",NCYCLES = 2000)
EM cycles terminated after 500 iterations.
Checking for DIF in 5 more items
EM cycles terminated after 500 iterations

Any idea would I could do to solve this issue? could I change the convergence treshold (TOL)?

best,
Michael

Phil Chalmers

unread,
Sep 8, 2014, 8:34:01 AM9/8/14
to Michael Paul Grosz, mirt-package
Hi Michael,

To start, I didn't really think about using the bfactor() function in DIF(), it was primarily a wrapper for the mulitpleGroup() function. I'll think about how to add in this support though. That being said, the accuracy of the DIFs calculated aren't using the dimensional reduction approach, so you probably are better setting up the constraints manually for now.

On Mon, Sep 8, 2014 at 8:23 AM, Michael Paul Grosz <michael.p...@gmail.com> wrote:

Dear Phil and others,

I encountered the following error when I was trying to do a DIF analysis on a bifactor model (set of 9 items, all items were administered on a 6 point-Likert scale, N=1858).

1. gender <- ordered(Data[,1])

ADMm <- '

Adm = 1-9'

 

modelADM <- mirt.model(ADMm)

specific <- c(1,1,NA,NA,2,1,NA,2,2)

 

ADMbf <- bfactor(data=ADM, model=specific,model2=modelADM, group=gender,itemtype='graded')

 

> ADM.DIF <- DIF(ADMbf, c('a1','d1','d2','d3','d4','d5'),scheme="add_sequential")

Checking for DIF in 0 more items

Computing final DIF estimates...

Error in `*tmp*`[[i]] : subscript out of bounds


Do you have any idea how I could fix the problem?

I did not get this error when I used the default scheme ("add") on the same model.

Btw, based on which literature did you implement the “add_sequential” and "drop_sequential" scheme? In the "drop" and "drop_sequential" scheme, does one need to know beforehand that at least one item is DIF-free (anchor item)? So, if I don't know whether any of the items is DIF-free, I better use the "add" schemes?


No literature, just my idea of how analysts do DIF testing, either by adding/removing parameters one at a time or in sets, or sequentially testing for parameters and once DIF is found create a new base model to be used in the comparisons (the sequential approach). 
 

Another question is, how does DIF treat the grouping factors (facets) when DIF is tested within the framework of a bifactor model?


It doesn't. Partially because multidimensional DIF is hard is should be done with caution.
 

I got an error when I included the discrimination parameters of the grouping factors ('a2','a3').

How does the DIF function take into account the discrimination parameters a2 and a3 when it calculates DIF for a1? could I also do a DIF analysis on the discrimination parameters a2 and a3?

Furthermore, in another set of items, I encountered the following message:EM cycles terminated after 500 iterations.
I tried to increase the number of cycles by the argument NCYCLES but I got the same message again.

Again, relates to the fact that multipleGroup() is being called rather than bfactor(). 
 
> RIV.DIF <- DIF(RIVbf, c('a1','d1','d2','d3','d4','d5'),scheme="add_sequential",NCYCLES = 2000)
EM cycles terminated after 500 iterations.
Checking for DIF in 5 more items
EM cycles terminated after 500 iterations

Any idea would I could do to solve this issue? could I change the convergence treshold (TOL)?

Yes, there is a generic ... argument which accepts parameters to be passed down the function call stack. So you can pass TOL = # if you'd like and the estimation functions will use it. Cheers.

Phil
 

best,
Michael

--
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.

Michael Paul Grosz

unread,
Sep 8, 2014, 12:20:34 PM9/8/14
to mirt-p...@googlegroups.com, michael.p...@gmail.com
Thanks for the quick reply!

Ok, I will try to do investigate DIF by putting constraints on parameters across groups within the bfactor() function. Then, I might also be able to look at DIF with regard to the grouping factors.

cheers,
Michael

Phil Chalmers

unread,
Sep 8, 2014, 12:31:04 PM9/8/14
to Michael Paul Grosz, mirt-package
Perfect. The only thing you may want to be aware of (and is documented in ?bfactor) is that the mean and variance terms in the specific factors can't be freely estimated; this would severely disrupt the dimensional reduction algorithm. Other than that, everything else is fair game, and you can also define things syntactically by passing elements to the model2 input. E.g.,

```
#constrain first three slopes in general factor to be equal across groups
model <- mirt.model('G=1-9
                                CONSTRAINB = (1-3, a1)')
mod <- bfactor(data, specific, model2=model) 
```

Good hunting.

Phil

Michael Paul Grosz

unread,
Sep 8, 2014, 1:27:58 PM9/8/14
to mirt-p...@googlegroups.com, michael.p...@gmail.com
Thanks for the extra tip!

It's very helpful because I started by counting the number of parameters and specifying it in bfactor().
e.g.:
bfactor(data=ADM, model=specific,model2=modelADM, group=gender,constrain = list(c(1,96)),itemtype='graded')

But your method is way more practical.

郑小楠

unread,
Mar 28, 2024, 1:46:59 PM3/28/24
to mirt-package
Dear Michael,

I read your question and gained a lot. I am trying to fit a bifactor model in mirt package and test different item functioning too. 
But I do not have some "anchor items" to test DIF directly. 
Do you have any idea about this?

sincerely,
Zheng

Reply all
Reply to author
Forward
0 new messages