A generic function to extract the internal objects from estimated models.
extract.mirt(x, what)
mirt model of class 'SingleGroupClass', 'MultipleGroupClass', 'MixedClass' or 'DiscreteGroupClass'
a string indicating what to extract
Objects which can be extracted from mirt objects include:
observed log-likelihood
log term contributed by prior parameter distributions
goodness of fit statistic
degrees of freedom
p-value for G2 statistic
root mean-square error of approximation based on G2
CFI fit statistic
TLI fit statistic
AIC
BIC
sample size adjusted BIC
HQ
unrotated standardized loadings matrix
factor communality estimates
EM log-likelihood history
a tabular version of the raw response data input. Frequencies are stored
in freq
frequencies associated with tabdata
an integer vector indicating the number of unique elements for each item
an integer vector indicating the lowest category found in the input data
input model syntax
estimation method used
a vector of item types for each respective item (e.g., 'graded', '2PL', etc)
a vector of item names from the input data
a vector of factor names from the model definition
an integer vector indicating all valid row numbers used in the model estimation
(when all cases are used this will be 1:nrow(data)
)
raw input data of item responses
raw input data of data used as covariates
similar to tabdata
, however the responses have been transformed into
dummy coded variables
analogous to tabdatafull
, but for the raw input data instead of the
tabulated frequencies
if saved, extract the EM iteration history
expected probability of the unique response patterns
if supplied, the vector of survey weights used during estimation (NULL if missing)
a logical value indicating whether the model terminated within the convergence criteria
number of iterations it took to reach the convergence criteria
number of freely estimated parameters
vector containing uniquely estimated parameters
parameter covariance matrix (associated with parvec)
the condition number of the Hessian (if computed). Otherwise NA
a list of item parameter constraints to indicate which item parameters were equal during estimation
prior density distribution for the latent traits
posterior distribution for latent traits when using EM algorithm
if supplied, the data scoring key
number of latent traits/factors
number of items
number of groups
character vector of unique group names
a character vector indicating the group membership
a character vector indicating invariance
input from multipleGroup
a logical indicating whether the model passed the second-order test based on the Hessian matrix. Indicates whether model is a potential local maximum solution
logical; check whether the supplemented EM information matrix converged. Will be NA
if not applicable
estimation time, broken into different sections
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
# \donttest{
mod <- mirt(Science, 1)
extract.mirt(mod, 'logLik')
#> [1] -1608.87
extract.mirt(mod, 'F')
#> F1
#> Comfort 0.5220496
#> Work 0.5844686
#> Future 0.8030199
#> Benefit 0.5410276
#multiple group model
grp <- rep(c('G1', 'G2'), each = nrow(Science)/2)
mod2 <- multipleGroup(Science, 1, grp)
grp1 <- extract.group(mod2, 1) #extract single group model
extract.mirt(mod2, 'parvec')
#> [1] 0.8316800 4.8913029 2.5597789 -1.3592138 0.8289135 2.4772334
#> [7] 0.7025447 -2.1135580 2.8809926 5.4820292 2.2126281 -2.5451325
#> [13] 0.6920437 3.0133748 0.8608953 -1.5516666 1.1955161 4.8900152
#> [19] 2.6929286 -1.5545256 1.7621713 3.6416308 1.1724290 -2.5499919
#> [25] 2.4324588 6.4188352 2.6336468 -1.8297283 1.4875546 3.8081350
#> [31] 1.1473714 -1.8343958
extract.mirt(grp1, 'parvec')
#> [1] 0.8316800 4.8913029 2.5597789 -1.3592138 0.8289135 2.4772334
#> [7] 0.7025447 -2.1135580 2.8809926 5.4820292 2.2126281 -2.5451325
#> [13] 0.6920437 3.0133748 0.8608953 -1.5516666
# }