library("psychotools")
set.seed(1)
## item responses under a Rasch model from
## 6 persons with three different person parameters
## 9 increasingly difficult items
ppar <- rep(-1:1, each = 2)
ipar <- seq(-2, 2, by = 0.5)
sim <- rrm(theta = ppar, beta = ipar)
## 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
$theta
[1] -1 -1 0 0 1 1
$data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 1 0 0 0 1 0 0 0 0
[2,] 1 0 1 0 0 0 1 0 0
[3,] 1 1 0 0 1 0 0 0 0
[4,] 0 1 1 1 1 1 0 0 0
[5,] 1 1 1 1 0 0 0 1 0
[6,] 1 1 0 1 1 0 0 0 1
## print and plot corresponding item response object
iresp <- itemresp(sim$data)
iresp[1] {1,0,0,0,1,0,0,0,0} {1,0,1,0,0,0,1,0,0} {1,1,0,0,1,0,0,0,0}
[4] {0,1,1,1,1,1,0,0,0} {1,1,1,1,0,0,0,1,0} {1,1,0,1,1,0,0,0,1}
plot(iresp)