simData: Simulate Item Response Data

Description Usage Arguments Value Examples

View source: R/simData.R

Description

Simulate data from many different IRMs.

Usage

1
2
simData(n=NULL, v=NULL ,l=NULL, p=1, scaling=1.7, seed=666, sequence=F,
        model="rasch", dist="norm", interaction=F, weight="normal")

Arguments

n

Sample size.

v

The number of variables.

l

The number of response keys.

p

Indicates which parameter-logistic model will be fitted if the argument model is equal to "plm". When p = 1, the function returns the One-Parameter Logistic Model (1PLM). When p = 2, the function returns the 2PLM. p = 3 returns the 3PLM, p = 4 returns the 4PLM, and p = 5 returns the 5PLM.

scaling

The scaling parameter for when simulating the one-parameter logistic model (p = 1 and model="plm").

seed

The random seed for guaranteeing replicable results. As most examples in LaplacesDemon, it defaults to 666.

sequence

If the true scores and true difficulties should be a sequence (sequence = T) or if they should be random values (sequence = F) according to the base distribution (the value of the "dist" argument).

model

Which model to use to simulate the data. It defaults to the rasch model, with value "rasch". It can also be the SIRM, "sirm", or the Parameter-Logistic Models, "plm".

dist

Which distribution to base the sequence or random draw of the parameters. It defaults to "norm", the normal distribution with mean 0 and sd 1. It can also be "beta", the beta distribution with parameters 1 and 1.

interaction

Set this argument to TRUE if a simulated dataset with an interaction term is desired. Defaults to FALSE and only used if model = "rasch".

weight

If interaction is set to TRUE, then a weight term will be added to the model. The default, "normal", draws the weight parameter from a 0 mean, 1 sd normal distribution. It can also be "pos" or "neg", returning a positive or negative value, respectively, draw from a truncated 0 mean, 1 sd normal distribution. Only used if model = "rasch".

Value

A list containing a dataset and the parameters used to create the dataset.

Examples

1
2
3
4
5
6
7
### Random Data with 100 observations and 10 variables with 2 levels of response
n = 100; v = 10; l = 2
RaschData <- simData(n, v, l, model="rasch")

Data <- RaschData$data
Abil <- RaschData$abil
Diff <- RaschData$diff

vthorrf/birm documentation built on Dec. 24, 2021, 2:22 a.m.