View source: R/sim.data.MIRT.R
| sim.data.MIRT | R Documentation |
Generates binary response data, latent trait vectors, and item parameters from the multidimensional extension of the 1PL–4PL item response models. The latent traits are drawn from a multivariate normal distribution with a user-specified correlation matrix. Discrimination parameters respect a Q-matrix structure and may be optionally rotated.
sim.data.MIRT(
N = 500,
I = 20,
D = 2,
model = "m2pl",
Q.matrix = NULL,
Corr = NULL,
rotate = NULL,
promax_m = 4
)
N |
Integer; number of examinees (default: 500). |
I |
Integer; number of items (default: 20). |
D |
Integer; number of latent dimensions (default: 2). |
model |
Character; one of |
Q.matrix |
An optional |
Corr |
An optional |
rotate |
Optional rotation method name (passed to
GPArotation or |
promax_m |
Integer; power parameter for |
An object of class "data.MIRT", a list containing:
data, responseN \times I binary response
matrix (identical).
thetaN \times D matrix of true latent trait
values.
parI \times (D+3) matrix of true item parameters
(columns a1..aD, b, c, d).
probabilityN \times I matrix of response
probabilities.
Q.matrixI \times D Q-matrix used.
CorrD \times D correlation matrix.
model, N, I, DData-generating parameters.
Latent traits:
\boldsymbol{\theta}_j \sim N_D(\mathbf{0}, \boldsymbol{\Sigma}),
where \boldsymbol{\Sigma} is the D \times D correlation
matrix Corr.
Item parameters:
a_{id} \sim \text{Lognormal}(0.25, 0.25) for
q_{id} = 1 (M2PL/M3PL/M4PL);
a_{id} = 1 for all items and dimensions in M1PL.
b_i \sim N(0, 1) (difficulty).
c_i \sim U(0, 0.35) (lower asymptote; M3PL/M4PL only).
d_i \sim U(0.65, 1) (upper asymptote; M4PL only).
Response probabilities:
P_{ij} = P(Y_{ij} = 1 \mid \boldsymbol{\theta}_j) per the
specified MIRT model (see fit.MIRT for the IRF
equations).
Binary responses:
Y_{ij} \sim \text{Bernoulli}(P_{ij}).
Optional rotation of the loading matrix a and corresponding
transformation of theta and Corr is applied before
response generation.
fit.MIRT for fitting the MIRT model,
model.MIRT for computing response probabilities.
# Basic 2D 2PL simulation
sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl")
# With correlated factors and rotation
Corr <- matrix(c(1, 0.5, 0.5, 1), 2, 2)
sim_rot <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl",
Q.matrix = matrix(1, 6, 2),
Corr = Corr, rotate = "oblimin")
# Fit the simulated data
fit <- fit.MIRT(
sim$response, model = "m2pl", D = 2, method = "iStEM",
control.method = list(
vis = FALSE, seed = 123,
M = 2, B = 2, burnin.maxitr = 2,
maxitr = 3, eps1 = 10, eps2 = 10,
estimate.se = FALSE)
)
cor(fit$theta$est, sim$theta) # trait recovery
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.