Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rpl

Simulate Data under a Parametric Logistic IRT Model


Description

rpl simulates IRT data under a parametric logistic IRT model of type "2PL", "3PL", "3PLu", "4PL", and "Rasch/1PL".

Usage

rpl(theta, a, b, g, u, return_setting = TRUE)

Arguments

theta

numeric vector of person parameters. Can also be a list, then a list of length length(theta) is returned, containing multiple simulated data matrices.

a

numeric vector of item discrimination parameters.

b

numeric vector of item difficulty parameters.

g

numeric vector of so-called item guessing parameters.

u

numeric vector of item upper asymptote parameters.

return_setting

logical. Should a list containing slots of "a", "b", "g", "u", and "theta", as well as the simulated data matrix "data" be returned (default) or only the simulated data matrix.

Value

rpl returns either a list of the following components:

a

numeric vector of item discrimination parameters used,

b

numeric vector of item difficulty parameters used,

g

numeric vector of item guessing parameters used,

u

numeric vector of item upper asymptote parameters used,

theta

numeric vector of person parameters used,

data

numeric matrix containing the simulated data,

or (if return_setting = FALSE) only the numeric matrix containing the simulated data.

See Also

Examples

set.seed(1)
## item responses under a 2PL (two-parameter logistic) model from
## 6 persons with three different person parameters
## 9 increasingly difficult items and corresponding discrimination parameters
## no guessing (= 0) and upper asymptote 1
ppar <- rep(c(-2, 0, 2), each = 2)
ipar <- seq(-2, 2, by = 0.5)
dpar <- rep(c(0.5, 1, 1.5), each = 3)
sim <- rpl(theta = ppar, a = dpar, b = ipar, g = rep(0, 9), u = rep(1, 9))

## simulated item response data along with setting parameters
sim

## print and plot corresponding item response object
iresp <- itemresp(sim$data)
iresp
plot(iresp)

psychotools

Psychometric Modeling Infrastructure

v0.6-0
GPL-2 | GPL-3
Authors
Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>), Carolin Strobl [aut], Florian Wickelmaier [aut], Basil Komboz [aut], Julia Kopf [aut], Lennart Schneider [aut] (<https://orcid.org/0000-0003-4152-5308>), Rudolf Debelak [aut]
Initial release
2020-11-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.