Finally, (arbitrarily) estimate this model by using pars = sv
, and use the returned object to calculate the factor scores. If you included the response patterns you are interested in then using fscores()
directly work, otherwise use the response.vectorpattern
option to estimate the patterns directly.
mod <- mirt(dat, 1, pars = sv)
fscores(mod)
#more interested in pattern: 0, 1, 1, 0, 1
fscores(mod, response.vectorpattern = c(0,1,1,0,1))
Hope that's helpful.
EDIT: Since I posted this answer a while back, the mirtCAT
package was developed as an extension to mirt
and contains a helper function called generate.mirt_object()
for setting up a suitable mirt
model with known coefficients.
Here's how that can be done using the parameters above.
library(mirtCAT)
pars <- data.frame(a1 = c(1,.9,.8,1,1.1),
d = c(-1,0,1.5,-1.5,0),
g = c(.2,.15,.17,.19,.15))
mod <- generate.mirt_object(pars, itemtype = '3PL')
# trait scores for pattern: 0, 1, 1, 0, 1
fscores(mod, response.pattern = c(0,1,1,0,1))
I think the wrapper version is less error prone, and certainly nicer to look at and understand.