sim.data.MGPCM: Simulate Data from the Multidimensional Generalized Partial...

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

sim.data.MGPCMR Documentation

Simulate Data from the Multidimensional Generalized Partial Credit Model

Description

Generates polytomous (multi-category) response data from the MGPCM. Category probabilities use the same softmax formulation as model.MGPCM: \log P(Y=k) is proportional to k\,\mathbf{a}_i'\boldsymbol{\theta}_j + d_{ik}. The requested category counts are retained even when a finite sample does not contain every possible category.

Usage

sim.data.MGPCM(
  N = 500,
  I = 20,
  D = 2,
  length.poly = 5,
  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).

length.poly

Integer vector or scalar; number of categories per item. Recycled to length I if scalar (default: 5).

Q.matrix

Optional I \times D 0/1 matrix. NULL uses a triangular identification pattern.

Corr

Optional D \times D correlation matrix.

rotate

Optional rotation method (GPArotation or "promax").

promax_m

Power parameter for Promax (default: 4).

Value

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

data, response

N \times I integer response matrices with categories coded from 0 to K_i - 1.

theta

N \times D matrix of true latent traits.

par

I \times (D + \max_i K_i) matrix of item parameters; discrimination columns are followed by category intercept columns.

probability

N \times \sum_i K_i matrix of stacked category probabilities.

Q.matrix, length.poly, Corr

Design matrix, category counts, and latent correlation matrix used to generate the data.

model, N, I, D, call

Data-generating metadata.

Data Generation Process

  1. Latent traits: \boldsymbol{\theta}_j \sim N_D(\mathbf{0}, \boldsymbol{\Sigma}).

  2. Item parameters: a_{id} \sim \text{Lognormal}(0.25, 0.25) (active dimensions), d_{i0}=0, and d_{i1},\dots,d_{i,K_i-1} are sorted draws from N(0,1) used as category intercepts.

  3. Responses: Y_{ij} \sim \text{Categorical}(P(Y_{ij} = k \mid \boldsymbol{\theta}_j)) for k = 0, \dots, K_i - 1.

See Also

fit.MGPCM, model.MGPCM

Examples

set.seed(123)
sim <- sim.data.MGPCM(N = 20, I = 5, D = 2, length.poly = 4)
str(sim$response)
dim(sim$probability)
sim$length.poly


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