gendataIRT {lazy.irtx} | R Documentation |
Generation of Simulated Item Response Data
gendataIRT(Ntot, param, DinP = 1, Nmat = NULL, theta = NULL, npoints = 31, thmin = -3, thmax = 3, thd = NULL, thdist = "NORMAL", thmean = 0, thstd = 1, nomiss = 0, compress = 0, sort = 1, thetaname = NULL)
Ntot |
# of total observations to be generated
If Ntot == 1, one observation per each theta point
will be generated, |
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. |
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" |
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. |
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]
# 10 observations with theta from N( 0, 1 ) set.seed(1701) res1 <- gendataIRT( 1, paramS1, npoints=10, thdist="rnorm", compress=1 ) Print(res1$N,res1$U,sum(res1$N)) set.seed(1701) # 100 observations tabulated at seven theta points in [-3,3] res <- gendataIRT( 1000, paramS1, npoints=7, thmin=-3, thmax=3 ) Print(res$N,res$U,sum(res$N)) # seven theta points in [-3,3] set.seed(1701) res1 <- gendataIRT( 1, paramS1, npoints=7, thmin=-3, thmax=3 ) Print(res1$N,res1$U,sum(res1$N)) # 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,sum(res1$N)) # 10 observations with theta from N( 0, 1 ) set.seed(1701) res1 <- gendataIRT( 1, paramS1, npoints=10, thdist="rnorm", compress=1 , thetaname="theta" ) Print(res1$N,res1$U,sum(res1$N)) # 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,sum(res1$N))