Questions about using the createItem() and the mirt.model() at the same time

28 views
Skip to first unread message

Yingbin Zhang

unread,
Apr 24, 2017, 10:50:13 PM4/24/17
to mirt-package
Dear Dr. Chalmers,

  Hello!

  When I used the createItem() and the mirt.model() at the same time, I met a problem.

 
  Below is an example under version 1.23.

  It seems that the mirt.model() becomes invalid. If the mirt.model() works, 'a2' of Item1-Item16 and 'a1' of Item17-Item32 ought to be 0. However, it's not the case. Maybe I just have a silly coding error.
 
  May I ask for your help?
 
  Thank you.

 
Kind Regards.

Yingbin Zhang

> SAT12missing <- SAT12
> SAT12missing[SAT12missing == 8] <- NA
> data <- key2binary(SAT12missing,
+                    key = c(1,4,5,2,3,1,2,1,3,1,2,4,2,1,5,3,4,4,1,4,3,3,4,1,3,5,1,3,1,5,4,5))
> name <- 'old2PL' > par <- c(a1 =0.5,a2=0.5, b = 0) > est <- c(TRUE, TRUE,TRUE) > P.old2PL <- function(par,Theta,ncat){ + a1 <- par[1] + a2 <- par[2] + b <- par[3] + P1 <- 1 / (1 + exp(-1*(a1*Theta[,1] + a2*Theta[,2] - b))) + cbind(1-P1, P1) + }
> x <- createItem(name, par=par, est=est, P=P.old2PL)
> model<-mirt.model(' + F1=1-16 + F2=17-32 + COV=F1*f2') > sat <- mirt(data, model, 'old2PL', customItems=list(old2PL=x))
Iteration: 60, Log-Lik: -9441.928, Max-Change: 0.00008
> coef(sat) $Item.1 a1 a2 b par 0.778 0.351 1.059 $Item.2 a1 a2 b par 1.147 0.989 -0.441 $Item.3 a1 a2 b par 0.729 0.798 1.145

......

$Item.16 a1 a2 b par 0.753 0.288 0.388 $Item.17 a1 a2 b par 0.773 1.355 -4.203 $Item.18 a1 a2 b par 1.125 1.283 0.86

......

$Item.31 a1 a2 b par 1.756 1.604 -2.821 $Item.32 a1 a2 b par 0.048 0.142 1.653

 

Phil Chalmers

unread,
Apr 24, 2017, 10:55:25 PM4/24/17
to Yingbin Zhang, mirt-package
Hi Yingbin,

I'm fairly certain that custom itemtypes ignore the loadings syntax in mirt.model to build the Q-matrix. After all, you could define a model with no slopes at all, and mirt would have no way of knowing that beforehand. 

You should probably define two different custom models instead with the correct loadings, and supply each correct model to the associated item. HTH.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yingbin Zhang

unread,
Apr 24, 2017, 11:58:54 PM4/24/17
to mirt-package, yingbi...@gmail.com
Dear Dr. Chalmers,

  I see.
  It works well when defining two different custom models.
  Thanks for your help!
  Kind regards.

Yingbin Zhang



> P.old2PL <- function(par,Theta,ncat){
+     a1 <- par[1]
+     a2 <- par[2]
+     b  <- par[3]
+     P1 <- 1 / (1 + exp(-1*(a1*Theta[,1] + a2*Theta[,2] - b)))
+     cbind(1-P1, P1)
+   }

> name <- 'old2PL'
> par <- c(a1 =0.5,a2=0, b = 0)
> est <- c(TRUE, FALSE,TRUE)
>
x <- createItem(name, par=par, est=est, P=P.old2PL)
>
name2 <- 'old2PL2' > par2 <- c(a1 =0,a2=0.5, b = 0) > est2 <- c(FALSE,TRUE, TRUE) > x2 <- createItem(name2, par=par2, est=est2, P=P.old2PL)
>
sat <- mirt(data, 2, c(rep('old2PL',16),rep('old2PL2',16)), customItems=list(old2PL=x,old2PL2=x2)) Iteration: 25, Log-Lik: -9695.016, Max-Change: 0.00009 > coef(sat) $Item.1 a1 a2 b par 0.822 0 1.054 $Item.2 a1 a2 b par 1.486 0 -0.408 $Item.3 a1 a2 b par 1.068 0 1.147

...

$Item.16 a1 a2 b par 0.691 0 0.384 $Item.17 a1 a2 b par 0 1.351 -4.017 $Item.18 a1 a2 b par 0 1.818 0.925

......

$Item.31 a1 a2 b par 0 2.197 -2.709 $Item.32 a1 a2 b par 0 0.1 1.649

在 2017年4月25日星期二 UTC+8上午10:55:25,Phil Chalmers写道:

Phil

To unsubscribe from this group and stop receiving emails from it, send an email to mirt-package...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages