Confirmatory mIRT error: NAs introduced by coercion

772 views
Skip to first unread message

Danilo Assis Pereira

unread,
Apr 5, 2014, 12:01:16 AM4/5/14
to mirt-p...@googlegroups.com

Hi, I had some problems with my confirmatory mIRT. The following message was ploted:

> cmod<-mirt(resum,cmodel,na.rm=TRUE)
Iteration: 10, Log-Lik: -3010.564, Max-Change: 0.00005
Warning messages:
1: In model.elements(model = model, itemtype = itemtype, factorNames = factorNames,  :
  NAs introduced by coercion
2: In model.elements(model = model, itemtype = itemtype, factorNames = factorNames,  :
  NAs introduced by coercion

> coef(cmod)
$Aprend_Verb
    a1 a2    d1    d2    d3    d4    d5
par  0  0 4.506 3.988 3.644 3.087 1.364

$Fluenc
    a1 a2    d1   d2  d3    d4    d5     d6
par  0  0 3.087 2.72 2.1 1.298 0.405 -0.466


No values on a parameters... What's wrong with my model?
Thanks a lot,

Danilo

Phil Chalmers

unread,
Apr 5, 2014, 12:21:50 AM4/5/14
to Danilo Assis Pereira, mirt-package
Hi Danilo,

What was the syntax you used to define the 'cmodel' object; it looks like the problem is in they mirt.model definition.

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.

Danilo Assis Pereira

unread,
Apr 5, 2014, 12:25:58 AM4/5/14
to mirt-p...@googlegroups.com
#CONFIRMATORY mIRT
cmodel<-mirt.model('
F1 = pbac$Aprend_Verb, pbac$Evoc, pbac$Reco, pbac$REYevoc
F2 = pbac$Fluenc, pbac$Nom, pbac$Sem, pbac$REYcopia, pbac$Orie, pbac$Tril')

cmod<-mirt(resum,cmodel)
coef(cmod)
anova(cmod,mod2)
#check if identified by looking at second order condition
cmod<-mirt(resum,cmodel,SE=T)

Thanks Phil for your help!

Danilo

Phil Chalmers

unread,
Apr 5, 2014, 12:29:05 AM4/5/14
to Danilo Assis Pereira, mirt-package
I see, the mirt.model() definitions only work with numeric inputs (for now at least), so you'd need something more like 

cmodel<-mirt.model('
F1 = 1-10
F2 = 11-20')

Where the numbers indicate which column in the data input should have a non-zero loading for the factor. Hope that helps.

Phil 


--

Danilo Assis Pereira

unread,
Apr 5, 2014, 12:31:09 AM4/5/14
to mirt-p...@googlegroups.com, Danilo Assis Pereira
I will try this solution. Thanks a lot!

Danilo
Brazil

Danilo Assis Pereira

unread,
Apr 5, 2014, 12:41:41 AM4/5/14
to mirt-p...@googlegroups.com, Danilo Assis Pereira
Please, one more question: how can I replace the variable name using a numeric symbol?
a1=pbac$Aprend_Verb (it is OK)
1=pbac$Aprend_Verb (Error in 1 = pbac$Aprend_Verb :  invalid (do_set) left-hand side to assignment)

I am a novice in R language!  :)

Thanks!



Em sábado, 5 de abril de 2014 01h29min05s UTC-3, Phil Chalmers escreveu:

Danilo Assis Pereira

unread,
Apr 5, 2014, 1:07:58 AM4/5/14
to mirt-p...@googlegroups.com, Danilo Assis Pereira
I used edit() to rename the variable and it worked as well... however, a new problem occured (see below)

> anova(cmod,mod2)

Model 1: mirt(data = resum, model = cmodel)
Model 2: mirt(data = resum, model = 2)

       AIC     AICc    SABIC      BIC    logLik      X2 df p
1 5497.552 5537.171 5526.093 5729.025 -2684.776             
2 5277.507 5331.258 5310.062 5541.531 -2565.754 238.045  9 0
> #check if identified by looking at second order condition
> cmod<-mirt(resum,cmodel,SE=T)
Iteration: 1000, Log-Lik: -2684.775, Max-Change: 0.00002
EM iterations terminated after 1000 iterations.


Calculating information matrix...
Error in info[is.latent, , drop = FALSE] : incorrect number of dimensions


Thanks,

Danilo






Em sábado, 5 de abril de 2014 01h29min05s UTC-3, Phil Chalmers escreveu:

Phil Chalmers

unread,
Apr 5, 2014, 5:37:04 PM4/5/14
to Danilo Assis Pereira, mirt-package
I'm not really sure what is going on here, or what exactly you are trying to accomplish (don't really know what you used edit() for.....). Could you provide something more reproducible with data and R code? Perhaps using the simdata() function to generate data, if you can't provide your own. Cheers.

Phil 

Dr. Hans Hansen

unread,
Apr 7, 2014, 8:24:16 AM4/7/14
to mirt-p...@googlegroups.com, Danilo Assis Pereira
I read that Danilo renamed the variables to "1","2" in the data. The numbers in the model definition are NOT the column names, but 1 for the first column, 2 for the second, and so on.

Danilo Assis Pereira

unread,
Apr 8, 2014, 6:19:48 AM4/8/14
to mirt-p...@googlegroups.com
Thank you Dr Hansen... I will study the manual to solve the problem... I really though that numbers referred to column names....

Danilo Assis Pereira

unread,
Apr 10, 2014, 12:17:06 PM4/10/14
to mirt-p...@googlegroups.com
Dear Dr. Phil,

Finally, I run my model, but I saw that it is necessary to use 'mixmodel' when dealing with dichotomous and polythomous data...
Actually, I have 3 questions:

1) How to run a mixed mirt in this model?
cmodel<-mirt.model('
F1 = 11,5,7,12
F2 = 10,9,1,2
F3 = 8,6,4,3')
cmod<-mirt(data,cmodel) #mixedmirt, not mirt
coef(cmod)
#Dichotomous items are 3,4,6, and 8 (data mirt.txt)

2) Is it correct to transform total d (summed) into b (difficulty) calculating b=(-d/number of factors)?

3) How to cite mirt(1.2.1) package in my paper?


Thanks a lot!

Danilo



Em sábado, 5 de abril de 2014 01h01min16s UTC-3, Danilo Assis Pereira escreveu:
mirt.txt

Danilo Assis Pereira

unread,
Apr 10, 2014, 2:14:43 PM4/10/14
to mirt-p...@googlegroups.com
Sorry, this is the right data file: meem2.txt

Danilo






Em sábado, 5 de abril de 2014 01h01min16s UTC-3, Danilo Assis Pereira escreveu:
meem2.txt

Phil Chalmers

unread,
Apr 10, 2014, 4:35:51 PM4/10/14
to Danilo Assis Pereira, mirt-package
On Thu, Apr 10, 2014 at 12:17 PM, Danilo Assis Pereira <dani...@gmail.com> wrote:
Dear Dr. Phil,

Finally, I run my model, but I saw that it is necessary to use 'mixmodel' when dealing with dichotomous and polythomous data...
Actually, I have 3 questions:

1) How to run a mixed mirt in this model?
cmodel<-mirt.model('
F1 = 11,5,7,12
F2 = 10,9,1,2
F3 = 8,6,4,3')
cmod<-mirt(data,cmodel) #mixedmirt, not mirt
coef(cmod)
#Dichotomous items are 3,4,6, and 8 (data mirt.txt)

Run the model with mirt(), mixedmirt() is something very different and will only makes sense if you've analysed IRT data in a mixed effects modelling framework (like models estimated with lme4::glmer()). The functions by default treat the itemtypes as '2PL' models if dichotomous, and 'graded' if polytomous, though these can be overwritten by using the itemtype=... argument.
 

2) Is it correct to transform total d (summed) into b (difficulty) calculating b=(-d/number of factors)?

I think this question is referring to the classical IRT parametrization, in which case no this is no the same. coef(..., IRTpars = TRUE) does the conversions for you, but not for multidimensional models.
 

3) How to cite mirt(1.2.1) package in my paper?

In R, type citation('mirt'). Cheers.

Phil



Thanks a lot!

Danilo



Em sábado, 5 de abril de 2014 01h01min16s UTC-3, Danilo Assis Pereira escreveu:

Hi, I had some problems with my confirmatory mIRT. The following message was ploted:

> cmod<-mirt(resum,cmodel,na.rm=TRUE)
Iteration: 10, Log-Lik: -3010.564, Max-Change: 0.00005
Warning messages:
1: In model.elements(model = model, itemtype = itemtype, factorNames = factorNames,  :
  NAs introduced by coercion
2: In model.elements(model = model, itemtype = itemtype, factorNames = factorNames,  :
  NAs introduced by coercion

> coef(cmod)
$Aprend_Verb
    a1 a2    d1    d2    d3    d4    d5
par  0  0 4.506 3.988 3.644 3.087 1.364

$Fluenc
    a1 a2    d1   d2  d3    d4    d5     d6
par  0  0 3.087 2.72 2.1 1.298 0.405 -0.466


No values on a parameters... What's wrong with my model?
Thanks a lot,

Danilo

--
Reply all
Reply to author
Forward
0 new messages