data.pgdina | R Documentation |
Dataset for the estimation of the polytomous GDINA model.
data(data.pgdina)
The dataset is a list with the item response data and the Q-matrix. The format is:
List of 2
$ dat : num [1:1000, 1:30] 1 1 1 1 1 0 1 1 1 1 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:30] "I1" "I2" "I3" "I4" ...
$ q.matrix: num [1:30, 1:5] 1 0 0 0 0 1 0 0 0 2 ...
The dataset was simulated by the following R code:
set.seed(89)
# define Q-matrix
Qmatrix <- matrix(c(1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,
1,1,2,0,0,0,0,1,2,0,0,0,0,1,2,0,0,0,0,1,1,2,0,0,0,1,2,2,0,1,0,2,
1,0,0,1,1,0,2,2,0,0,2,1,0,1,0,0,2,2,1,2,0,0,0,0,0,2,0,0,0,0,0,2,
0,0,0,0,0,2,0,0,0,0,0,1,2,0,2,0,0,0,2,0,2,0,0,0,2,0,1,2,0,0,2,0,
0,2,0,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,0,1),
nrow=30, ncol=5, byrow=TRUE )
# define covariance matrix between attributes
Sigma <- matrix(c(1,.6,.6,.3,.3,.6,1,.6,.3,.3,.6,.6,1,
.3,.3,.3,.3,.3,1,.8,.3,.3,.3,.8,1), 5,5, byrow=TRUE )
# define thresholds for attributes
q1 <- c( -.5, .9 ) # attributes 1,...,4
q2 <- c(0) # attribute 5
# number of persons
N <- 1000
# simulate latent attributes
alpha1 <- mvrnorm(n=N, mu=rep(0,5), Sigma=Sigma)
alpha <- 0*alpha1
for (aa in 1:4){
alpha[ alpha1[,aa] > q1[1], aa ] <- 1
alpha[ alpha1[,aa] > q1[2], aa ] <- 2
}
aa <- 5 ; alpha[ alpha1[,aa] > q2[1], aa ] <- 1
# define item parameters
guess <- c(.07,.01,.34,.07,.11,.23,.27,.07,.08,.34,.19,.19,.25,.04,.34,
.03,.29,.05,.01,.17,.15,.35,.19,.16,.08,.18,.19,.07,.17,.34)
slip <- c(0,.11,.14,.09,.03,.09,.03,.1,.14,.07,.06,.19,.09,.19,.07,.08,
.16,.18,.16,.02,.11,.12,.16,.14,.18,.01,.18,.14,.05,.18)
# simulate item responses
I <- 30 # number of items
dat <- latresp <- matrix( 0, N, I, byrow=TRUE)
for (ii in 1:I){
# ii <- 2
# latent response matrix
latresp[,ii] <- 1*( rowMeans( alpha >=matrix( Qmatrix[ ii, ], nrow=N,
ncol=5, byrow=TRUE ) )==1 )
# response probability
prob <- ifelse( latresp[,ii]==1, 1-slip[ii], guess[ii] )
# simulate item responses
dat[,ii] <- 1 * ( runif(N ) < prob )
}
colnames(dat) <- paste0("I",1:I)
Chen, J., & de la Torre, J. (2013). A general cognitive diagnosis model for expert-defined polytomous attributes. Applied Psychological Measurement, 37, 419-437.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.