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