Skip to contents

Generates item response data using the calibrated parameters from eqc_calibrate() or sac_calibrate() (formerly spc_calibrate()).

The function uses the normalized item design stored in the calibration result. For a fixed-form result this is the calibrated fixed form. For a SAC result with item_scope = "item_superpopulation", it is one stored representative evaluation form; this function does not redraw a new item form or simulate the aggregate item-superpopulation estimand.

Usage

simulate_response_data(
  result,
  n_persons,
  latent_shape = "normal",
  latent_params = list(),
  seed = NULL
)

Arguments

result

A calibration result object of class "eqc_result", "sac_result", or "spc_result" (for backward compatibility), as returned by eqc_calibrate() or sac_calibrate().

n_persons

Integer. Number of persons to simulate.

latent_shape

Character. Shape argument for sim_latentG().

latent_params

List. Additional arguments for sim_latentG().

seed

Optional integer for reproducibility.

Value

A list containing:

response_matrix

N x I matrix of binary responses

theta

True abilities (N x 1)

beta

Item difficulties (I x 1)

lambda

Item discriminations (I x 1)

provenance

List describing the calibration result and simulation settings used to generate the response data, including result class, target and achieved reliability, metric, model, test length, scalar calibration_status, character-vector status_flags, item source/design, calibration call, simulation seed, sample size, latent shape, and latent parameters.

guessing

Item lower asymptotes (I x 1). This additive component is a zero vector for Rasch and 2PL designs.

Examples

if (FALSE) { # \dontrun{
# Example 1: Using EQC calibration result
eqc_result <- eqc_calibrate(
  target_rho = 0.80,
  n_items = 25,
  model = "rasch",
  seed = 42
)

sim_data <- simulate_response_data(
  result = eqc_result,
  n_persons = 1000,
  latent_shape = "normal",
  seed = 123
)

# Example 2: Using SAC calibration result
sac_result <- sac_calibrate(
  target_rho = 0.80,
  n_items = 25,
  model = "rasch",
  reliability_metric = "info",
  c_init = eqc_result,
  resample_items = FALSE,
  n_iter = 200,
  seed = 42
)

sim_data2 <- simulate_response_data(
  result = sac_result,
  n_persons = 1000,
  latent_shape = "normal",
  seed = 123
)

# Use with TAM for validation when TAM is installed
if (requireNamespace("TAM", quietly = TRUE)) {
  tam_rel <- compute_reliability_tam(sim_data$response_matrix, model = "rasch")
}
} # }