comparing mirt and catR scores

83 views
Skip to first unread message

balazs...@gmail.com

unread,
Dec 11, 2021, 12:08:00 PM12/11/21
to mirt-package
I am trying to compare mirt and catR scores.
I have a feeling that while their Theta estimates are very similar their Sem estimates are very different. I get strange patterns though for both comparison, and can't figure out why.

library(mirt)
library(mirtCAT)
nitems <- 100
a1 <- rlnorm(nitems, .2,.2)
d <- rnorm(nitems)
mirt.pars <- data.frame(a1=a1, d=d)
mirt.mod <- generate.mirt_object(mirt.pars, '2PL')

itemtype <- rep('2PL', nrow(mirt.pars))
nperson <- 100

dat <- simdata(a1, d, nperson, itemtype)
mirt.scores<-fscores(mirt.mod,response.pattern = dat)


library(catR)
cat.pars<-as.data.frame(coef(mirt.mod , simplify = TRUE, IRTpars = TRUE)$items[,c('a','b')])
cat.pars$d<-1
cat.pars$c<-0
cat.pars=as.matrix(cat.pars)

cat.scores<-
  do.call(
    rbind, apply(dat, 1, function(x) {
      cF1=thetaEst(cat.pars, x)
      cSem=semTheta(cF1, cat.pars)
      data.frame(cF1=cF1, cSem=cSem)
    })
  )

all.scores<-cbind(mirt.scores,cat.scores)

plot(all.scores$F1, all.scores$cF1)
plot(all.scores$SE_F1, all.scores$cSem)

Phil Chalmers

unread,
Dec 11, 2021, 8:36:14 PM12/11/21
to balazs...@gmail.com, mirt-package
You're comparing mirt's EAP and the PSD estimates to catR's EAP and SE estimates, which won't be the same since the SE does not contain information about the prior. You might have meant to use catR::eapSem(). 

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mirt-package/3aaa33ed-3b5f-4291-a057-dde05ba3aa0cn%40googlegroups.com.

balazs...@gmail.com

unread,
Dec 12, 2021, 7:47:56 AM12/12/21
to mirt-package
Woww .. I didn't realize catR had these two methods.
Thanks a lot for pointing this out!

I have the errors now lined up correctly, but still have the Thetas in the wrong diagonal.
Any idea what I might be messing up here?

library(mirt)
library(mirtCAT)
nitems <- 100
a1 <- rlnorm(nitems, .2,.2)
d <- rnorm(nitems)
mirt.pars <- data.frame(a1=a1, d=d)
mirt.mod <- generate.mirt_object(mirt.pars, '2PL')

itemtype <- rep('2PL', nrow(mirt.pars))
nperson <- 100

dat <- simdata(a1, d, nperson, itemtype)
mirt.scores<-fscores(mirt.mod,response.pattern = dat)


library(catR)
cat.pars<-as.data.frame(coef(mirt.mod , simplify = TRUE, IRTpars = TRUE)$items[,c('a','b')])
cat.pars$d<-1
cat.pars$c<-0
cat.pars=as.matrix(cat.pars)

cat.scores<-
  do.call(
    rbind,
    apply(dat, 1, function(x) {
      cF1=thetaEst(cat.pars, x)
      #cSem=semTheta(cF1, cat.pars)
      cEapSem=eapSem(cF1, cat.pars, x)
      data.frame(cF1=cF1, cEapSem=cEapSem)

    })
  )

all.scores<-cbind(mirt.scores,cat.scores)
plot(all.scores$F1, all.scores$cF1)
plot(all.scores$SE_F1, all.scores$cEapSem)

all.params<-cbind(mirt.pars, cat.pars)
Reply all
Reply to author
Forward
0 new messages