dummy_expand {lazy.irtx} | R Documentation |
Dummmy Expantion of Categorical Data
dummy_expand(Uc, ncat = NULL, type = NULL, zero = 1)
Uc |
Item Response matrix |
ncat |
a vector consisting of # of categories of each item |
type |
NOT used. |
zero |
= 0 to exclude the xzero-th category from output |
In compressed format, Uc[i,j]=k means that subject i answers to item j
by selecting option k, k=0,1,...,ncat[j].
This function expands this compressed format to dummy expression:
That is, each item takes ncat[j] colums of U[, fromP[j]:toP[j]],
and the k+fromP[j]-th colum will be 1, and 0 elsewhere.
A list of
U, ncat, type, zero, fromP, toP
set.seed(1701) res <- gendataIRT( 1, paramS1, npoints=7, thmin=-3, thmax=3 ) Print(res$N,res$U,sum(res$N)) set.seed(1701) res1 <- gendataIRT( 1, paramS1, npoints=7, thmin=-3, thmax=3, compress=1 ) Print(res1$N,res1$U,sum(res1$N)) dummy_expand(res1$U)