gendataIRT {lazy.irt}R Documentation

Generation of Simulated Item Response Data

Description

Generation of Simulated Item Response Data

Usage

gendataIRT(
  Ntot,
  param,
  DinP = 1,
  Nmat = NULL,
  zero = 1,
  theta = NULL,
  npoints = 31,
  thmin = -3,
  thmax = 3,
  thd = NULL,
  thdist = "NORMAL",
  thmean = 0,
  thstd = 1,
  nomiss = 0,
  compress = 0,
  sort = 1,
  thetaname = NULL
)

Arguments

Ntot

# of total observations to be generated If Ntot == 1, one observation per each theta point will be generated,
otherwize, the # of observations per each theta point is
proportional to round(Ntot*thd) where thd is
the npoint x 1 vector of theta distribution.
Therefore, Ntot must be large enough.

param

Item Parameter Data Frame

DinP

= 1 to include D=1.7 in logistic function

Nmat

npoints x nitems matrix consisting of # of trials, or NULL. This will be used only when Ntot=1 and compress=0.

zero

= 0 to exclude zero-th category when not compressed.

theta

Discrete theta values

npoints

# of discrete points for theta, or # of random variables

thmin

Minimum value of discrete thata value

thmax

Maximum value of discrete thata value

thd

theta distribution probability vector

thdist

= "NORMAL" or "UNIFORM" or "rnorm" or "runif"
When "NORMAL" or "rnorm",
thmean and thstd will be used to generate thd.
When "UNIFORM" or "runif",
thmin and thmax will be used to generate thd.
When "rnorm" or "runif", theta will be generated using
npoints random numbers and thd and Ntot is set equal to 1.

thmean

mean of theta distribution

thstd

std of theta distribution

nomiss

= 1 to exclude those theta points with N = 0.

compress

= 1 to compress the data when Ntot = 1.

sort

= 1 to sort the result according to theta.

thetaname

= Name of the variable which will contain theta value or NULL.

Value

A list of
U, N, npoints, theta, thd, Ntot, fromP, toP, type, ncat, thmean, thstd , compress, sort


where

If compress = 0 and Ntot is large,
U is npoints x sum of ncat[j]
U[,fromP[j]:toP[j]] is npoints x ncat[j]
U[,fromP[j]:toP[j]][i,k] contains # of responses to
the k-th category (k=0,1,...,ncat[j]) at theta[i]
to which N[i]=round(Ntot*thd[i]) observations belong.


If compress = 1 and Ntot = 1,
U is npoints x nitems
U[i,j] contains the response to the j-th item at theta[i]
where 0 <= U[i,j] <= ncat[j]-1.
In this case, fromP and toP are not compressed.

(theta, thd, N) are npoints x 1
N[i] is the # of observations at theta[i]

Examples

# 10 observations with theta from N( 0, 1 ): not compressed
set.seed(1702)
res1 <- gendataIRT( 1, paramS1, npoints=10, thdist="rnorm" )
Print(res1$N,res1$U,res1$theta)
#
# 10 observations with theta from N( 0, 1 ): compressed
set.seed(1702)
res1 <- gendataIRT( 1, paramS1, npoints=10, thdist="rnorm", compress=1 )
Print(res1$N,res1$U,res1$theta)
#
# 10 observations with theta from N( 0, 1 ): no zero category
set.seed(1702)
res1 <- gendataIRT( 1, paramS1, npoints=10, thdist="rnorm", zero=0 )
Print(res1$N,res1$U,res1$theta)
#
#
#
# seven theta points in [-3,3]
set.seed(1701)
res1 <- gendataIRT( 1, paramS1, npoints=7, thmin=-3, thmax=3 )
Print(res1$N,res1$U,res1$theta)
#
# seven theta points in [-3,3] and compressed
set.seed(1701)
res1 <- gendataIRT( 1, paramS1, npoints=7, thmin=-3, thmax=3, compress=1 )
Print(res1$N,res1$U,res1$theta)
#
set.seed(1701)
# 100 observations tabulated at seven theta points in [-3,3]
res1 <- gendataIRT( 1000, paramS1, npoints=7, thmin=-3, thmax=3 )
Print(res1$N,res1$U,res1$theta)
#
#
# Using Nmat argument
set.seed(1701)
npoints=20
param=paramS1
nitems=nrow(param)
Nmat=matrix(100,npoints,nitems)
res1 <- gendataIRT( 1, param, Nmat=Nmat, npoints=npoints
                  , thdist="rnorm", compress=1 )
Print(res1$N,res1$U,res1$theta)



[Package lazy.irt version 0.1.6 ]