9.2 Attribute Estimation Process

Recall that for CDM analysis, we need to have two required matrices: the item response matrix and the Q-matrix. Let us use the following Q-matrix as an example.

Code
library(GDINA)
## GDINA R Package (version 2.9.4; 2023-07-01)
## For tutorials, see https://wenchao-ma.github.io/GDINA
Code
Q <- sim10GDINA$simQ
Q
##       [,1] [,2] [,3]
##  [1,]    1    0    0
##  [2,]    0    1    0
##  [3,]    0    0    1
##  [4,]    1    0    1
##  [5,]    0    1    1
##  [6,]    1    1    0
##  [7,]    1    0    1
##  [8,]    1    1    0
##  [9,]    0    1    1
## [10,]    1    1    1

Because there are three columns in the Q-matrix, \(K=3\) and there are \(C=2^K=8\) latent classes. The attribute profiles of these \(2^K\) latent classes can be obtained by

Code
K <- ncol(Q)
A <- attributepattern(K)

Let us assume that we have item responses of 1000 students to these 10 items and the responses of the first 6 students are printed below:

Code
Y <- sim10GDINA$simdat
head(Y)
##      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## [1,]    1    0    1    1    0    1    1    1    0     1
## [2,]    1    1    1    1    1    1    1    1    0     1
## [3,]    1    1    1    0    1    1    1    0    1     0
## [4,]    1    0    1    1    1    1    1    1    1     0
## [5,]    0    0    1    1    0    0    1    0    0     0
## [6,]    1    0    0    0    0    0    0    1    0     1

Based on the EM algorithm discussed in previous class, we can fit the G-DINA model to the data to obtain item parameter estimates:

Code
est <- GDINA(dat = Y, Q = Q,verbose = 0)

The item parameters can be obtained via the coef() function:

Code
item.parameters <- coef(est)
item.parameters
## $`Item 1`
## P(0) P(1) 
## 0.21 0.90 
## 
## $`Item 2`
## P(0) P(1) 
## 0.14 0.78 
## 
## $`Item 3`
##  P(0)  P(1) 
## 0.089 0.909 
## 
## $`Item 4`
## P(00) P(10) P(01) P(11) 
##  0.12  0.30  0.47  0.90 
## 
## $`Item 5`
## P(00) P(10) P(01) P(11) 
## 0.106 0.079 0.090 0.823 
## 
## $`Item 6`
## P(00) P(10) P(01) P(11) 
##  0.18  0.90  0.93  0.92 
## 
## $`Item 7`
## P(00) P(10) P(01) P(11) 
## 0.054 0.471 0.392 0.771 
## 
## $`Item 8`
## P(00) P(10) P(01) P(11) 
##  0.11  0.26  0.27  0.90 
## 
## $`Item 9`
## P(00) P(10) P(01) P(11) 
##  0.10  0.37  0.42  0.81 
## 
## $`Item 10`
## P(000) P(100) P(010) P(001) P(110) P(101) P(011) P(111) 
##   0.18   0.13   0.28   0.38   0.49   0.50   0.67   0.90

As we have obtained the item parameters, now we can use this item parameters to estimate the attributes for each examinee.