Off-line run with polytomous items

The following code block uses mirt to define population parameters for 250 graded response IRT models. This will be used to set up a CAT interface that can be used for on-line use or off-line use (for testing or Monte Carlo simulation research).

library('mirtCAT')

set.seed(1)
bank <- 250 #bank size
N <- 500 #calibration sample size

a <- matrix(rlnorm(bank*2, .2,.3), bank)
a[1:75, 1] <- a[250:175, 2] <- 0
d <- matrix(seq(1.25, -1.25, length.out=4), bank, 4, byrow=TRUE) + rnorm(bank)
pars <- data.frame(a, d)
colnames(pars) <- c('a1', 'a2', paste0('d', 1:4))
mod <- generate.mirt_object(pars, itemtype = 'graded')
head(coef(mod, simplify=TRUE)$items)
##        a1       a2         d1         d2         d3         d4
## Item.1  0 1.272351 1.32730312  0.4939698 -0.3393635 -1.1726969
## Item.2  0 1.380092 0.95313136  0.1197980 -0.7135353 -1.5468686
## Item.3  0 1.196145 0.06675776 -0.7665756 -1.5999089 -2.4332422
## Item.4  0 1.133943 1.26129269  0.4279594 -0.4053740 -1.2387073
## Item.5  0 1.504808 2.24160104  1.4082677  0.5749344 -0.2583990
## Item.6  0 1.722658 2.84396745  2.0106341  1.1773008  0.3439675

This next section generates a plausible response vector given \(\theta_1 = -1\) and \(\theta_2 = 0.5\), and passes the response vector to mirtCAT() for off-line use.

## generate random response pattern
set.seed(1)
pattern <- generate_pattern(mod, Theta = c(-1, 0.5))
head(pattern[1L,])
## [1] 2 2 2 4 2 4
# use adaptive method using Kullback-Leibler item selection with root-N adjustment
#   with MAP estimation of latent traits
result <- mirtCAT(mo=mod, local_pattern=pattern, criteria='KLn',
                  design = list(min_SEM=.2), method = 'MAP')
print(result)
##  n.items.answered   Theta_1   Theta_2 SE.Theta_1 SE.Theta_2 True.Theta_1
##               119 -1.008349 0.3731586  0.1994405  0.1831658           -1
##  True.Theta_2
##           0.5
plot(result, scales = list(x = list(at = NULL)), SE = 1.96) #95% confidence interval

plot of chunk unnamed-chunk-2