createItem

37 views
Skip to first unread message

Carl Falk

unread,
Nov 17, 2015, 5:37:06 PM11/17/15
to mirt-package
Hi Phil,

Before experimenting with adding a custom item model directly, I'm trying createItem. Wondering if more than one custom item type is not supported or if I just have a silly coding error. Below is an example that under version 1.13 gives me the following error: "Error in customItems[[itemtype[i] == names(customItems)]] :
  attempt to select less than one element"

Thanks!
Carl


name <- 'old2PL'
name2<- 'old2PL2'
par <- c(a = .5, b = -2)
est <- c(TRUE, TRUE)
P.old2PL <- function(par,Theta, ncat){
    a <- par[1]
    b <- par[2]
    P1 <- 1 / (1 + exp(-1*a*(Theta - b)))
    cbind(1-P1, P1)
}

x <- createItem(name, par=par, est=est, P=P.old2PL)

P.old2PL2 <- function(par,Theta, ncat){
    a <- par[1]
    b <- par[2]
    P1 <- 1 / (1 + exp(-1.702*a*(Theta - b)))
    cbind(1-P1, P1)
}

x2 <- createItem(name2, par=par, est=est, P=P.old2PL2)

dat <- expand.table(LSAT7)
sv <- mirt(dat, 1, c(rep('2PL',3), 'old2PL', 'old2PL2'), customItems=list(old2PL=x, old2PL2=x2), pars = 'values')

Phil Chalmers

unread,
Nov 17, 2015, 6:35:02 PM11/17/15
to Carl Falk, mirt-package
Definitely was a bug, just sent a patch to the dev version. Thanks for the report.

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.

Carl Falk

unread,
Nov 18, 2015, 9:22:16 AM11/18/15
to mirt-package, cff...@gmail.com
Ah, I see. Thank you!
Reply all
Reply to author
Forward
0 new messages