imputeMissing: Imputing plausible data for missing values

Description Usage Arguments Author(s) References Examples

View source: R/imputeMissing.R

Description

Given an estimated model from any of mirt's model fitting functions and an estimate of the latent trait, impute plausible missing data values. Returns the original data in a data.frame without any NA values. If a list of Theta values is supplied then a list of complete datasets is returned instead.

Usage

1
imputeMissing(x, Theta, warn = TRUE, ...)

Arguments

x

an estimated model x from the mirt package

Theta

a matrix containing the estimates of the latent trait scores (e.g., via fscores)

warn

logical; print warning messages?

...

additional arguments to pass

Author(s)

Phil Chalmers rphilip.chalmers@gmail.com

References

Chalmers, R., P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29. doi: 10.18637/jss.v048.i06

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
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')

#re-estimate imputed dataset (good to do this multiple times and average over)
fulldata <- imputeMissing(mod, scores)
(fullmod <- mirt(fulldata, 1))

#with multipleGroup
set.seed(1)
group <- sample(c('group1', 'group2'), 1000, TRUE)
mod2 <- multipleGroup(dat, 1, group, TOL=1e-2)
fs <- fscores(mod2)
fulldata2 <- imputeMissing(mod2, fs)


## End(Not run)

Example output

Loading required package: stats4
Loading required package: lattice

Iteration: 1, Log-Lik: -2668.786, Max-Change: 0.18243
Iteration: 2, Log-Lik: -2663.691, Max-Change: 0.13637
Iteration: 3, Log-Lik: -2661.454, Max-Change: 0.10231
Iteration: 4, Log-Lik: -2659.430, Max-Change: 0.04181
Iteration: 5, Log-Lik: -2659.241, Max-Change: 0.03417
Iteration: 6, Log-Lik: -2659.113, Max-Change: 0.02911
Iteration: 7, Log-Lik: -2658.812, Max-Change: 0.00456
Iteration: 8, Log-Lik: -2658.809, Max-Change: 0.00363
Iteration: 9, Log-Lik: -2658.808, Max-Change: 0.00273
Iteration: 10, Log-Lik: -2658.806, Max-Change: 0.00144
Iteration: 11, Log-Lik: -2658.806, Max-Change: 0.00118
Iteration: 12, Log-Lik: -2658.806, Max-Change: 0.00101
Iteration: 13, Log-Lik: -2658.805, Max-Change: 0.00042
Iteration: 14, Log-Lik: -2658.805, Max-Change: 0.00025
Iteration: 15, Log-Lik: -2658.805, Max-Change: 0.00026
Iteration: 16, Log-Lik: -2658.805, Max-Change: 0.00023
Iteration: 17, Log-Lik: -2658.805, Max-Change: 0.00023
Iteration: 18, Log-Lik: -2658.805, Max-Change: 0.00021
Iteration: 19, Log-Lik: -2658.805, Max-Change: 0.00019
Iteration: 20, Log-Lik: -2658.805, Max-Change: 0.00017
Iteration: 21, Log-Lik: -2658.805, Max-Change: 0.00017
Iteration: 22, Log-Lik: -2658.805, Max-Change: 0.00015
Iteration: 23, Log-Lik: -2658.805, Max-Change: 0.00015
Iteration: 24, Log-Lik: -2658.805, Max-Change: 0.00013
Iteration: 25, Log-Lik: -2658.805, Max-Change: 0.00013
Iteration: 26, Log-Lik: -2658.805, Max-Change: 0.00011
Iteration: 27, Log-Lik: -2658.805, Max-Change: 0.00011
Iteration: 28, Log-Lik: -2658.805, Max-Change: 0.00010
Call:
mirt(data = dat, model = 1)

Full-information item factor analysis with 1 factor(s).
Converged within 1e-04 tolerance after 28 EM iterations.
mirt version: 1.25 
M-step optimizer: BFGS 
EM acceleration: Ramsay 
Number of rectangular quadrature: 61

Log-likelihood = -2658.805
Estimated parameters: 10 
AIC = 5337.61; AICc = 5337.833
BIC = 5386.688; SABIC = 5354.927
G2 (21) = 31.7, p = 0.0628
RMSEA = 0.023, CFI = NaN, TLI = NaN
Iteration: 1, Log-Lik: -2658.837, Max-Change: 0.17891
Iteration: 2, Log-Lik: -2653.752, Max-Change: 0.13389
Iteration: 3, Log-Lik: -2651.551, Max-Change: 0.10000
Iteration: 4, Log-Lik: -2649.617, Max-Change: 0.04401
Iteration: 5, Log-Lik: -2649.421, Max-Change: 0.03675
Iteration: 6, Log-Lik: -2649.286, Max-Change: 0.03042
Iteration: 7, Log-Lik: -2648.978, Max-Change: 0.00783
Iteration: 8, Log-Lik: -2648.971, Max-Change: 0.00674
Iteration: 9, Log-Lik: -2648.966, Max-Change: 0.00531
Iteration: 10, Log-Lik: -2648.959, Max-Change: 0.00411
Iteration: 11, Log-Lik: -2648.957, Max-Change: 0.00297
Iteration: 12, Log-Lik: -2648.956, Max-Change: 0.00269
Iteration: 13, Log-Lik: -2648.955, Max-Change: 0.00212
Iteration: 14, Log-Lik: -2648.955, Max-Change: 0.00156
Iteration: 15, Log-Lik: -2648.954, Max-Change: 0.00141
Iteration: 16, Log-Lik: -2648.954, Max-Change: 0.00089
Iteration: 17, Log-Lik: -2648.954, Max-Change: 0.00058
Iteration: 18, Log-Lik: -2648.954, Max-Change: 0.00042
Iteration: 19, Log-Lik: -2648.954, Max-Change: 0.00024
Iteration: 20, Log-Lik: -2648.954, Max-Change: 0.00021
Iteration: 21, Log-Lik: -2648.954, Max-Change: 0.00021
Iteration: 22, Log-Lik: -2648.954, Max-Change: 0.00017
Iteration: 23, Log-Lik: -2648.954, Max-Change: 0.00017
Iteration: 24, Log-Lik: -2648.954, Max-Change: 0.00016
Iteration: 25, Log-Lik: -2648.954, Max-Change: 0.00015
Iteration: 26, Log-Lik: -2648.954, Max-Change: 0.00014
Iteration: 27, Log-Lik: -2648.954, Max-Change: 0.00013
Iteration: 28, Log-Lik: -2648.954, Max-Change: 0.00012
Iteration: 29, Log-Lik: -2648.954, Max-Change: 0.00012
Iteration: 30, Log-Lik: -2648.954, Max-Change: 0.00011
Iteration: 31, Log-Lik: -2648.954, Max-Change: 0.00010
Iteration: 32, Log-Lik: -2648.954, Max-Change: 0.00009
Call:
mirt(data = dat, model = 1)

Full-information item factor analysis with 1 factor(s).
Converged within 1e-04 tolerance after 32 EM iterations.
mirt version: 1.25 
M-step optimizer: BFGS 
EM acceleration: Ramsay 
Number of rectangular quadrature: 61

Log-likelihood = -2648.954
Estimated parameters: 10 
AIC = 5317.907; AICc = 5318.13
BIC = 5366.985; SABIC = 5335.224
Warning message:
In is.na(data) : is.na() applied to non-(list or vector) of type 'closure'

Iteration: 1, Log-Lik: -2671.352, Max-Change: 0.17506
Iteration: 2, Log-Lik: -2666.450, Max-Change: 0.13044
Iteration: 3, Log-Lik: -2664.319, Max-Change: 0.09742
Iteration: 4, Log-Lik: -2662.455, Max-Change: 0.03965
Iteration: 5, Log-Lik: -2662.288, Max-Change: 0.03296
Iteration: 6, Log-Lik: -2662.173, Max-Change: 0.02766
Iteration: 7, Log-Lik: -2661.905, Max-Change: 0.00505
Iteration: 8, Log-Lik: -2661.902, Max-Change: 0.00474
Iteration: 9, Log-Lik: -2661.899, Max-Change: 0.00426
Iteration: 10, Log-Lik: -2661.894, Max-Change: 0.00256
Iteration: 11, Log-Lik: -2661.894, Max-Change: 0.00192
Iteration: 12, Log-Lik: -2661.893, Max-Change: 0.00169
Iteration: 13, Log-Lik: -2661.893, Max-Change: 0.00142
Iteration: 14, Log-Lik: -2661.893, Max-Change: 0.00123
Iteration: 15, Log-Lik: -2661.892, Max-Change: 0.00107
Iteration: 16, Log-Lik: -2661.892, Max-Change: 0.00036
Iteration: 17, Log-Lik: -2661.892, Max-Change: 0.00024
Iteration: 18, Log-Lik: -2661.892, Max-Change: 0.00015
Iteration: 19, Log-Lik: -2661.892, Max-Change: 0.00011
Iteration: 20, Log-Lik: -2661.892, Max-Change: 0.00010
Iteration: 21, Log-Lik: -2661.892, Max-Change: 0.00010
Call:
mirt(data = fulldata, model = 1)

Full-information item factor analysis with 1 factor(s).
Converged within 1e-04 tolerance after 21 EM iterations.
mirt version: 1.25 
M-step optimizer: BFGS 
EM acceleration: Ramsay 
Number of rectangular quadrature: 61

Log-likelihood = -2661.892
Estimated parameters: 10 
AIC = 5343.784; AICc = 5344.006
BIC = 5392.862; SABIC = 5361.101
G2 (21) = 31.2, p = 0.0703
RMSEA = 0.022, CFI = NaN, TLI = NaN
Iteration: 1, Log-Lik: -2658.837, Max-Change: 0.20587
Iteration: 2, Log-Lik: -2652.525, Max-Change: 0.16983
Iteration: 3, Log-Lik: -2650.129, Max-Change: 0.12289
Iteration: 4, Log-Lik: -2648.246, Max-Change: 0.08011
Iteration: 5, Log-Lik: -2647.792, Max-Change: 0.06713
Iteration: 6, Log-Lik: -2647.512, Max-Change: 0.05644
Iteration: 7, Log-Lik: -2646.963, Max-Change: 0.01904
Iteration: 8, Log-Lik: -2646.942, Max-Change: 0.01705
Iteration: 9, Log-Lik: -2646.928, Max-Change: 0.01531
Iteration: 10, Log-Lik: -2646.897, Max-Change: 0.00802Warning message:
In is.na(data) : is.na() applied to non-(list or vector) of type 'closure'

mirt documentation built on June 29, 2021, 1:06 a.m.