This command generates item responses patterns for a given matrix of item parameters of any specified dichotomous or polytomous IRT model and a given (set of) ability value(s).
numeric: a vector of true underlynig ability values (can be a singlre value too).
numeric: a suitable matrix of item parameters. See Details.
numeric: the metric constant. Default is
either the random seed value or
This function permits to randomly generate item responses for a set of given ability levels, specified by the argument
thr, and for a given matrix of item parameters, specified by the argument
it. Both dichotomous and polytomous IRT models can be considered and item responses are generated accordingly.
For dichotomous models, item responses are generated from Bernoulli draws, using the
rbinom function. For polytomous models they are generated from darws from a multinomial distribution, using the
rmultinom function. In both cases, success probabilities are obtained from the
Note that for polytomous models, item responses are coded as 0 (for the first response category), 1 (for the second category), ..., until g_j (for the last category), in agreement with the notations used in the help files of, e.g., the
Dichotomous IRT models are considered whenever
model is set to
NULL (default value). In this case,
it must be a matrix with one row per item and four columns, with the values of the discrimination, the difficulty, the pseudo-guessing and the inattention parameters (in this order). These are the parameters of the four-parameter logistic (4PL) model
(Barton and Lord, 1981).
Polytomous IRT models are specified by their respective acronym:
"GRM" for Graded Response Model,
"MGRM" for Modified Graded Response Model,
"PCM" for Partical Credit Model,
"GPCM" for Generalized Partial Credit Model,
"RSM" for Rating Scale Model and
"NRM" for Nominal Response Model. The
it still holds one row per item, end the number of columns and their content depends on the model. See
genPolyMatrix for further information and illustrative examples of suitable polytomous item banks.
The random pattern generation can be fixed by setting
seed to some numeric value. By default,
NULL and the random seed is not fixed.
th holds a single value, output is a vector with the item responses in the order of appearance of the items in the
it matrix. If
th is a vector of numeric values, output is a response matrix with one row per
th value and one column per item.
Department of Education, University of Liege, Belgium
Barton, M.A., and Lord, F.M. (1981). An upper asymptote for the three-parameter logistic item-response model. Research Bulletin 81-20. Princeton, NJ: Educational Testing Service.
Haley, D.C. (1952). Estimation of the dosage mortality relationship when the dose is subject to error. Technical report no 15. Palo Alto, CA: Applied Mathematics and Statistics Laboratory, Stanford University.
Magis, D. and Barrada, J. R. (2017). Computerized Adaptive Testing with R: Recent Updates of the Package catR. Journal of Statistical Software, Code Snippets, 76(1), 1-18. doi: 10.18637/jss.v076.c01
Magis, D., and Raiche, G. (2012). Random Generation of Response Patterns under Computerized Adaptive Testing with the R Package catR. Journal of Statistical Software, 48 (8), 1-31. doi: 10.18637/jss.v048.i08
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
## Dichotomous models ## # Loading the 'tcals' parameters data(tcals) # Selecting item parameters only tcals <- as.matrix(tcals[,1:4]) # Generation of a response pattern for ability level 0 genPattern(th = 0, tcals) # Generation of 10 response patterns for ability levels randomly drawn from N(0,1) genPattern(th = rnorm(10), tcals) # Generation of a single response for the first item only genPattern(th = 0, tcals[1,]) ## Polytomous models ## # Generation of an item bank under GRM with 100 items and at most 4 categories m.GRM <- genPolyMatrix(100, 4, "GRM") m.GRM <- as.matrix(m.GRM) # Generation of a response pattern for ability level 0 genPattern(0, m.GRM, model = "GRM") # Generation of 10 response patterns for ability levels randomly drawn from N(0,1) genPattern(rnorm(10), m.GRM, model = "GRM") # Generation of a single response for the first item only genPattern(0, m.GRM[1,], model = "GRM") # Generation of a item bank under PCM with 20 items and at most 3 categories m.PCM <- genPolyMatrix(20, 3, "PCM") m.PCM <- as.matrix(m.PCM) # Generation of a response pattern for ability level 0 genPattern(0, m.PCM, model = "PCM") # Generation of a single response for the first item only genPattern(0, m.PCM[1,], model = "PCM")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.