sim.data.MIRT: Simulate Data from the Multidimensional IRT (MIRT) Model

View source: R/sim.data.MIRT.R

sim.data.MIRTR Documentation

Simulate Data from the Multidimensional IRT (MIRT) Model

Description

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.

Usage

sim.data.MIRT(
  N = 500,
  I = 20,
  D = 2,
  model = "m2pl",
  Q.matrix = NULL,
  Corr = NULL,
  rotate = NULL,
  promax_m = 4
)

Arguments

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 "m1pl", "m2pl" (default), "m3pl", "m4pl".

Q.matrix

An optional I \times D 0/1 matrix. If NULL, a default structure with triangular identification pattern is used.

Corr

An optional D \times D correlation matrix. If NULL, the identity matrix is used (orthogonal factors).

rotate

Optional rotation method name (passed to GPArotation or stats::promax). Applicable only when D > 1 and all Q-matrix entries are non-zero.

promax_m

Integer; power parameter for "promax" rotation (default: 4).

Value

An object of class "data.MIRT", a list containing:

data, response

N \times I binary response matrix (identical).

theta

N \times D matrix of true latent trait values.

par

I \times (D+3) matrix of true item parameters (columns a1..aD, b, c, d).

probability

N \times I matrix of response probabilities.

Q.matrix

I \times D Q-matrix used.

Corr

D \times D correlation matrix.

model, N, I, D

Data-generating parameters.

Data Generation Process

  1. Latent traits: \boldsymbol{\theta}_j \sim N_D(\mathbf{0}, \boldsymbol{\Sigma}), where \boldsymbol{\Sigma} is the D \times D correlation matrix Corr.

  2. 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).

  3. Response probabilities: P_{ij} = P(Y_{ij} = 1 \mid \boldsymbol{\theta}_j) per the specified MIRT model (see fit.MIRT for the IRF equations).

  4. 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.

See Also

fit.MIRT for fitting the MIRT model, model.MIRT for computing response probabilities.

Examples

# 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


ForceChoice documentation built on Sept. 13, 2026, 1:06 a.m.