Skip to main content

Simulate Data under a Rating Scale Model

Description

rrsm simulates IRT data under a rating scale model.

Usage

rrsm(theta, beta, tau, nullcats = FALSE, 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 sets.
beta numeric vector of item difficulty parameters.
tau numeric vector of threshold parameters.
nullcats logical. Should null categories be allowed?
return_setting logical. Should a list containing slots of "beta", "tau", and "theta", as well as the simulated data matrix "data" be returned (default) or only the simulated data matrix?

Value

rrsm returns either a list of the following components:

beta numeric vector of item difficulty parameters used,
tau numeric vector of threshold parameters used,
theta numeric vector (or list) 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

rpcm, rgpcm, rrm, rpl

Examples

library("psychotools")

set.seed(1)
## item responses under a rating scale model (RSM) with
## 6 persons with three different person parameters
## 9 increasingly difficult items
## 3 different threshold parameters
ppar <- rep(-1:1, each = 2)
ipar <- seq(-2, 2, by = 0.5)
tpar <- 0:2
sim <- rrsm(theta = ppar, beta = ipar, tau = tpar)

## simulated item response data along with setting parameters
sim
$beta
[1] -2.0 -1.5 -1.0 -0.5  0.0  0.5  1.0  1.5  2.0

$tau
[1] 0 1 2

$theta
[1] -1 -1  0  0  1  1

$data
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]    0    0    1    2    2    0    0    2    0
[2,]    1    1    0    1    0    0    1    0    0
[3,]    2    3    3    3    1    1    0    0    0
[4,]    3    2    2    0    0    2    2    1    2
[5,]    3    3    2    2    3    3    3    3    1
[6,]    3    3    3    1    2    1    0    0    3
## print and plot corresponding item response object
iresp <- itemresp(sim$data)
iresp
[1] {0,0,1,2,2,0,0,2,0} {1,1,0,1,0,0,1,0,0} {2,3,3,3,1,1,0,0,0}
[4] {3,2,2,0,0,2,2,1,2} {3,3,2,2,3,3,3,3,1} {3,3,3,1,2,1,0,0,3}
plot(iresp)