The function is able to caculate the proportion of variance accounted for (\(PVAF\)) for all items after fitting CDM or directly.

get.PVAF(Y = NULL, Q = NULL, CDM.obj = NULL, model = "GDINA")

Arguments

Y

A required N × I matrix or data.frame consisting of the responses of N individuals to I items. Missing values should be coded as NA.

Q

A required binary I × K matrix containing the attributes not required or required, coded as 0 or 1, to master the items. The ith row of the matrix is a binary indicator vector indicating which attributes are not required (coded as 0) and which attributes are required (coded as 1) to master item i.

CDM.obj

An object of class CDM.obj. Can can be NULL, but when it is not NULL, it enables rapid verification of the Q-matrix without the need for parameter estimation. @seealso CDM.

model

Type of model to be fitted; can be "GDINA", "LCDM", "DINA", "DINO", "ACDM", "LLM", or "rRUM". Default = "GDINA".

Value

An object of class matrix, which consisted of \(PVAF\) for each item and each possible attribute mastery pattern.

Details

The intrinsic essence of the GDI index (as denoted by \(\zeta_{2}\)) is the weighted variance of all \(2^{K\ast}\) attribute mastery patterns' probabilities of correctly responding to item \(i\), which can be computed as: $$ \zeta^2 = \sum_{l=1}^{2^K} \pi_{l}{(P(X_{pi}=1|\mathbf{\alpha}_{l}) - P_{i}^{mean})}^2 $$ where \(\pi_{l}\) represents the prior probability of mastery pattern \(l\); \(P_{i}^{mean}=\sum_{k=1}^{2^K}\pi_{l}P(X_{pi}=1|\mathbf{\alpha}_{l})\) is the weighted average of the correct response probabilities across all attribute mastery patterns. When the q-vector is correctly specified, the calculated \(\zeta^2\) should be maximized, indicating the maximum discrimination of the item.

Theoretically, \(\zeta^{2}\) is larger when \(\mathbf{q}_{i}\) is either specified correctly or over-specified, unlike when \(\mathbf{q}_{i}\) is under-specified, and that when \(\mathbf{q}_{i}\) is over-specified, \(\zeta^{2}\) is larger than but close to the value of \(\mathbf{q}_{i}\) when specified correctly. The value of \(\zeta^{2}\) continues to increase slightly as the number of over-specified attributes increases, until \(\mathbf{q}_{i}\) becomes \(\mathbf{q}_{i1:K}\). Thus, \(\zeta^{2} / \zeta_{max}^{2}\) is computed to indicate the proportion of variance accounted for by \(\mathbf{q}_{i}\) , called the \(PVAF\).

References

de la Torre, J., & Chiu, C. Y. (2016). A General Method of Empirical Q-matrix Validation. Psychometrika, 81(2), 253-273. DOI: 10.1007/s11336-015-9467-8.

See also

Author

Haijiang Qin <Haijiang133@outlook.com>

Examples

library(Qval)

set.seed(123)

## generate Q-matrix and data
K <- 3
I <- 20
example.Q <- sim.Q(K, I)
IQ <- list(
  P0 = runif(I, 0.0, 0.2),
  P1 = runif(I, 0.8, 1.0)
)
example.data <- sim.data(Q = example.Q, N = 500, IQ = IQ, model = "GDINA", distribute = "horder")
#> distribute =  horder 
#>  model =  GDINA 
#>  number of attributes:  3 
#>  number of items:  20 
#>  num of examinees:  500 
#>  average of P0 =  0.083 
#>  average of P1 =  0.894 
#> theta_mean =  -0.055 , theta_sd = 0.996 
#>  a =  1.5 1.5 1.5 
#>  b =  -1.5 1.5 0 

## calculate PVAF directly
PVAF <-get.PVAF(Y = example.data$dat, Q = example.Q)
#> 
Iter = 1  Max. abs. change = 0.57951  Deviance  = 10238.69                                                                                  
Iter = 2  Max. abs. change = 0.09509  Deviance  = 8501.84                                                                                  
Iter = 3  Max. abs. change = 0.03995  Deviance  = 8478.24                                                                                  
Iter = 4  Max. abs. change = 0.01792  Deviance  = 8477.13                                                                                  
Iter = 5  Max. abs. change = 0.02604  Deviance  = 8477.02                                                                                  
Iter = 6  Max. abs. change = 0.01142  Deviance  = 8476.97                                                                                  
Iter = 7  Max. abs. change = 0.01740  Deviance  = 8476.96                                                                                  
Iter = 8  Max. abs. change = 0.00686  Deviance  = 8476.95                                                                                  
Iter = 9  Max. abs. change = 0.00466  Deviance  = 8476.94                                                                                  
Iter = 10  Max. abs. change = 0.00253  Deviance  = 8476.94                                                                                  
Iter = 11  Max. abs. change = 0.00030  Deviance  = 8476.94                                                                                  
Iter = 12  Max. abs. change = 0.00014  Deviance  = 8476.94                                                                                  
Iter = 13  Max. abs. change = 0.00016  Deviance  = 8476.94                                                                                  
Iter = 14  Max. abs. change = 0.00760  Deviance  = 8476.94                                                                                  
Iter = 15  Max. abs. change = 0.00246  Deviance  = 8476.94                                                                                  
Iter = 16  Max. abs. change = 0.00502  Deviance  = 8476.94                                                                                  
Iter = 17  Max. abs. change = 0.00017  Deviance  = 8476.94                                                                                  
Iter = 18  Max. abs. change = 0.00109  Deviance  = 8476.94                                                                                  
Iter = 19  Max. abs. change = 0.00004  Deviance  = 8476.94                                                                                  
print(PVAF)
#>          000        100        010        001       110        101        011
#> item 1  -Inf 0.05200795 0.97617096 0.18597232 0.9803500 0.23900194 0.99588964
#> item 2  -Inf 0.86258484 0.03768251 0.31301239 0.8673840 0.98691938 0.32148058
#> item 3  -Inf 0.23538077 0.12153176 0.87250475 0.3079287 0.97444297 0.88197677
#> item 4  -Inf 0.05118094 0.09645885 0.99944525 0.1444479 0.99977914 0.99955172
#> item 5  -Inf 0.61967444 0.04634396 0.40114822 0.6340752 0.99292783 0.40218598
#> item 6  -Inf 0.05150476 0.08521455 0.99863037 0.1404493 0.99872632 0.99889345
#> item 7  -Inf 0.04302786 0.07413417 0.99720362 0.1172823 0.99794531 0.99857592
#> item 8  -Inf 0.02645312 0.99707114 0.10788852 0.9975597 0.14388347 0.99828838
#> item 9  -Inf 0.04978628 0.10729370 0.99870662 0.1541773 0.99928813 0.99944277
#> item 10 -Inf 0.11329682 0.60988009 0.38267804 0.7404337 0.44888604 0.96863356
#> item 11 -Inf 0.16252795 0.78512355 0.24785470 0.9700515 0.34201830 0.88499107
#> item 12 -Inf 0.08412574 0.52565713 0.68491774 0.6140911 0.70190926 0.99303516
#> item 13 -Inf 0.99543822 0.02468354 0.04060490 0.9970518 0.99778609 0.06769133
#> item 14 -Inf 0.04892994 0.07984576 0.99743751 0.1302842 0.99788185 0.99867379
#> item 15 -Inf 0.99641298 0.02098946 0.06173904 0.9971472 0.99679660 0.07085647
#> item 16 -Inf 0.04307850 0.80827365 0.20902293 0.8605611 0.23803789 0.99502425
#> item 17 -Inf 0.11898439 0.80125584 0.25400368 0.9206240 0.31229694 0.93674309
#> item 18 -Inf 0.19312807 0.09111948 0.91186601 0.2681952 0.97890622 0.92431327
#> item 19 -Inf 0.01166348 0.99302358 0.07554560 0.9972778 0.09136379 0.99406882
#> item 20 -Inf 0.26878163 0.73646434 0.22459899 0.9125336 0.41706919 0.79645483
#>         111
#> item 1    1
#> item 2    1
#> item 3    1
#> item 4    1
#> item 5    1
#> item 6    1
#> item 7    1
#> item 8    1
#> item 9    1
#> item 10   1
#> item 11   1
#> item 12   1
#> item 13   1
#> item 14   1
#> item 15   1
#> item 16   1
#> item 17   1
#> item 18   1
#> item 19   1
#> item 20   1

## caculate PVAF after fitting CDM
example.CDM.obj <- CDM(example.data$dat, example.Q, model="GDINA")
#> 
Iter = 1  Max. abs. change = 0.57951  Deviance  = 10238.69                                                                                  
Iter = 2  Max. abs. change = 0.09509  Deviance  = 8501.84                                                                                  
Iter = 3  Max. abs. change = 0.03995  Deviance  = 8478.24                                                                                  
Iter = 4  Max. abs. change = 0.01792  Deviance  = 8477.13                                                                                  
Iter = 5  Max. abs. change = 0.02604  Deviance  = 8477.02                                                                                  
Iter = 6  Max. abs. change = 0.01142  Deviance  = 8476.97                                                                                  
Iter = 7  Max. abs. change = 0.01740  Deviance  = 8476.96                                                                                  
Iter = 8  Max. abs. change = 0.00686  Deviance  = 8476.95                                                                                  
Iter = 9  Max. abs. change = 0.00466  Deviance  = 8476.94                                                                                  
Iter = 10  Max. abs. change = 0.00253  Deviance  = 8476.94                                                                                  
Iter = 11  Max. abs. change = 0.00030  Deviance  = 8476.94                                                                                  
Iter = 12  Max. abs. change = 0.00014  Deviance  = 8476.94                                                                                  
Iter = 13  Max. abs. change = 0.00016  Deviance  = 8476.94                                                                                  
Iter = 14  Max. abs. change = 0.00760  Deviance  = 8476.94                                                                                  
Iter = 15  Max. abs. change = 0.00246  Deviance  = 8476.94                                                                                  
Iter = 16  Max. abs. change = 0.00502  Deviance  = 8476.94                                                                                  
Iter = 17  Max. abs. change = 0.00017  Deviance  = 8476.94                                                                                  
Iter = 18  Max. abs. change = 0.00109  Deviance  = 8476.94                                                                                  
Iter = 19  Max. abs. change = 0.00004  Deviance  = 8476.94                                                                                  
PVAF <-get.PVAF(CDM.obj = example.CDM.obj)
print(PVAF)
#>          000        100        010        001       110        101        011
#> item 1  -Inf 0.05200795 0.97617096 0.18597232 0.9803500 0.23900194 0.99588964
#> item 2  -Inf 0.86258484 0.03768251 0.31301239 0.8673840 0.98691938 0.32148058
#> item 3  -Inf 0.23538077 0.12153176 0.87250475 0.3079287 0.97444297 0.88197677
#> item 4  -Inf 0.05118094 0.09645885 0.99944525 0.1444479 0.99977914 0.99955172
#> item 5  -Inf 0.61967444 0.04634396 0.40114822 0.6340752 0.99292783 0.40218598
#> item 6  -Inf 0.05150476 0.08521455 0.99863037 0.1404493 0.99872632 0.99889345
#> item 7  -Inf 0.04302786 0.07413417 0.99720362 0.1172823 0.99794531 0.99857592
#> item 8  -Inf 0.02645312 0.99707114 0.10788852 0.9975597 0.14388347 0.99828838
#> item 9  -Inf 0.04978628 0.10729370 0.99870662 0.1541773 0.99928813 0.99944277
#> item 10 -Inf 0.11329682 0.60988009 0.38267804 0.7404337 0.44888604 0.96863356
#> item 11 -Inf 0.16252795 0.78512355 0.24785470 0.9700515 0.34201830 0.88499107
#> item 12 -Inf 0.08412574 0.52565713 0.68491774 0.6140911 0.70190926 0.99303516
#> item 13 -Inf 0.99543822 0.02468354 0.04060490 0.9970518 0.99778609 0.06769133
#> item 14 -Inf 0.04892994 0.07984576 0.99743751 0.1302842 0.99788185 0.99867379
#> item 15 -Inf 0.99641298 0.02098946 0.06173904 0.9971472 0.99679660 0.07085647
#> item 16 -Inf 0.04307850 0.80827365 0.20902293 0.8605611 0.23803789 0.99502425
#> item 17 -Inf 0.11898439 0.80125584 0.25400368 0.9206240 0.31229694 0.93674309
#> item 18 -Inf 0.19312807 0.09111948 0.91186601 0.2681952 0.97890622 0.92431327
#> item 19 -Inf 0.01166348 0.99302358 0.07554560 0.9972778 0.09136379 0.99406882
#> item 20 -Inf 0.26878163 0.73646434 0.22459899 0.9125336 0.41706919 0.79645483
#>         111
#> item 1    1
#> item 2    1
#> item 3    1
#> item 4    1
#> item 5    1
#> item 6    1
#> item 7    1
#> item 8    1
#> item 9    1
#> item 10   1
#> item 11   1
#> item 12   1
#> item 13   1
#> item 14   1
#> item 15   1
#> item 16   1
#> item 17   1
#> item 18   1
#> item 19   1
#> item 20   1