File: rpl.Rd

package info (click to toggle)
r-cran-psychotools 0.6-0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,112 kB
  • sloc: ansic: 139; sh: 13; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 2,192 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
\name{rpl}
\alias{rpl}

\title{Simulate Data under a Parametric Logistic IRT Model}

\description{
  \code{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{
  \item{theta}{numeric vector of person parameters. Can also be a list, then a
    list of length \code{length(theta)} is returned, containing multiple
    simulated data matrices.}
  \item{a}{numeric vector of item discrimination parameters.}
  \item{b}{numeric vector of item difficulty parameters.}
  \item{g}{numeric vector of so-called item guessing parameters.}
  \item{u}{numeric vector of item upper asymptote parameters.}
  \item{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{
  \code{rpl} returns either a list of the following components:
  \item{a}{numeric vector of item discrimination parameters used,}
  \item{b}{numeric vector of item difficulty parameters used,}
  \item{g}{numeric vector of item guessing parameters used,}
  \item{u}{numeric vector of item upper asymptote parameters used,}
  \item{theta}{numeric vector of person parameters used,}
  \item{data}{numeric matrix containing the simulated data,}
  or (if \code{return_setting = FALSE}) only the numeric matrix containing the
  simulated data.
}

\seealso{\code{\link{rrm}}, \code{\link{rgpcm}}, \code{\link{rpcm}},
  \code{\link{rrsm}}}

\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)
}