library("psychotools")
set.seed(1)
## item responses under a partial credit model (PCM) with
## 6 persons with three different person parameters
## 8 items with different combinations of two or three threshold parameters
ppar <- rep(-1:1, each = 2)
tpar <- rep(list(-2:0, -1:1, 0:1, 0:2), each = 2)
sim <- rpcm(theta = ppar, delta = tpar)
## simulated item response data along with setting parameters
sim$delta
$delta[[1]]
[1] -2 -1 0
$delta[[2]]
[1] -2 -1 0
$delta[[3]]
[1] -1 0 1
$delta[[4]]
[1] -1 0 1
$delta[[5]]
[1] 0 1
$delta[[6]]
[1] 0 1
$delta[[7]]
[1] 0 1 2
$delta[[8]]
[1] 0 1 2
$theta
[1] -1 -1 0 0 1 1
$data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 0 1 2 1 2 0 1 1
[2,] 1 0 1 0 0 0 0 0
[3,] 2 2 0 1 0 1 1 1
[4,] 3 3 3 2 0 0 2 2
[5,] 3 3 3 2 1 2 3 3
[6,] 3 3 2 3 1 1 2 1
## print and plot corresponding item response object
iresp <- itemresp(sim$data)
iresp[1] {0,1,2,1,2,0,1,1} {1,0,1,0,0,0,0,0} {2,2,0,1,0,1,1,1} {3,3,3,2,0,0,2,2}
[5] {3,3,3,2,1,2,3,3} {3,3,2,3,1,1,2,1}
plot(iresp)