simra: Simulate Response Pattern under Dichotomous and Polytomous...

View source: R/simra.R

simraR Documentation

Simulate Response Pattern under Dichotomous and Polytomous Rasch Model

Description

function for simulation of response patterns following the dichotomous and/or polytomous Rasch model based on the category probabilities given the model parameters. At default, when just calling simra() 1 replication of responses to 5 items with difficulties -2, -1, 0, 1, 2 from 100 persons with ability drawn from N(0|1) are sampled.

Usage

simra(
  itempar = matrix(seq(-2, 2, length = 5)),
  theta = 100,
  pers_obj = NULL,
  replicate = 1,
  seed = seq(1, replicate, 1),
  ...
)

Arguments

itempar

a "matrix" with nrow = k (number of items) and ncol = m (maximum number of thresholds), holding the 'thurstonian' thresholds of the respective item. Some of the rightmost matrix entries may be NA, depending on the number of categories of the respective item.

theta

either one of the following (1) a numeric vector of length n providing the values of the person parameter (ability) for n persons to be used in the simulation. (2) a integer defining the number of values n to draw from N(0|1).

pers_obj

an object of class "pers" as a result from function pers. If an object of class "pers" is assigned to this argument the model parameters in it are taken to simulate the responses. At default (pers_obj = NULL) simulation is done by considering the model parameters given in the other arguments (see above).

replicate

an integer defining how many replicates (data matrices) r to draw based on the model parameters.

seed

a numeric vector with legnth of number of replications used for set.seed prior to each replicate to keep the result repeatable. If seed = NULL no seed is set.

...

arguments passed through.

Details

no details in the moment.

Value

an array with dim(n,k,r) response patterns (k items in colums n persons in rows and r replications in the third dimension).

Examples

########
simra() # 100 dichotomous probabilistic response pattern
### 100 polytomous response pattern (4 items; each 4 answer categories)
v <- c(-1.0,-0.5,0.0,0.5,-0.75,-0.25,0.25,0.75,-0.5,0.0,0.5,1.0)
itempar <- matrix(v,nrow = 4,ncol = 3)
simra(itempar = itempar)
simra(itempar = itempar,replicate = 10) # draw 10 replications


pairwise documentation built on April 18, 2023, 1:10 a.m.