dat <- expand.table(LSAT7)
(original <- mirt(dat, 1))
NAperson <- sample(1:nrow(dat), 20, replace = TRUE)
NAitem <- sample(1:ncol(dat), 20, replace = TRUE)
for(i in 1:20)
dat[NAperson[i], NAitem[i]] <- NA
(mod <- mirt(dat, 1))
scores <- fscores(mod, method = 'MAP', full.scores = TRUE)
#re-estimate imputed dataset (good to do this multiple times and average over)
fulldata <- imputeMissing(mod, scores)
(fullmod <- mirt(fulldata, 1))
#with multipleGroup
group <- rep(c('group1', 'group2'), each=500)
mod2 <- multipleGroup(dat, 1, group, TOL=1e-2)
fs <- fscores(mod2, full.scores=TRUE)
fulldata2 <- imputeMissing(mod2, fs)
#supply list of plausible value estimates (the best approach when Theta's are imprecise)
pv <- fscores(mod, plausible.draws = 5)
fulldata_list <- imputeMissing(mod, pv)
str(fulldata_list)
Run the code above in your browser using DataLab