get.PVAF.RdThe function is able to calculate the proportion of variance accounted for (\(PVAF\)) for all items
after fitting CDM or directly.
get.PVAF(
Y = NULL,
Q = NULL,
att.str = NULL,
CDM.obj = NULL,
mono.constraint = FALSE,
model = "GDINA"
)A required \(N\) × \(I\) matrix or data.frame consisting of the responses of N individuals
to \(N\) × \(I\) items. Missing values need to be coded as NA.
A required binary \(I\) × \(K\) matrix containing the attributes not required or required
master the items. The ith row of the matrix is a binary indicator vector indicating which
attributes are not required (coded by 0) and which attributes are required (coded by 1) to master
item \(i\).
Specify attribute structures. NULL, by default, means there is no structure. Attribute structure
needs be specified as a list - which will be internally handled by att.structure function.
See examples. It can also be a matrix giving all permissible attribute profiles.
An object of class CDM.obj. Can be NULL, but when it is not NULL, it enables
rapid verification of the Q-matrix without the need for parameter estimation.
Logical indicating whether monotonicity constraints should be fulfilled in estimation.
Default = FALSE.
Type of model to be fitted; can be "GDINA", "LCDM", "DINA", "DINO",
"ACDM", "LLM", or "rRUM". Default = "GDINA".
An object of class matrix, which consisted of \(PVAF\) for each item and each possible q-vector.
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|\boldsymbol{\alpha}_{l}) - \bar{P}_{i})}^2 $$ where \(\pi_{l}\) represents the prior probability of mastery pattern \(l\); \(\bar{P}_{i}=\sum_{k=1}^{2^K}\pi_{l}P(X_{pi}=1|\boldsymbol{\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 \(\boldsymbol{q}_{i}\) is either specified correctly or over-specified, unlike when \(\boldsymbol{q}_{i}\) is under-specified, and that when \(\boldsymbol{q}_{i}\) is over-specified, \(\zeta^{2}\) is larger than but close to the value of \(\boldsymbol{q}_{i}\) when specified correctly. The value of \(\zeta^{2}\) continues to increase slightly as the number of over-specified attributes increases, until \(\boldsymbol{q}_{i}\) becomes \(\boldsymbol{q}_{i1:K}\) (\(\boldsymbol{q}_{i1:K}\) = [11...1]). Thus, \(\zeta^{2} / \zeta_{max}^{2}\) is computed to indicate the proportion of variance accounted for by \(\boldsymbol{q}_{i}\), called the \(PVAF\).
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.
# \donttest{
library(Qval)
set.seed(123)
## generate Q-matrix and data
K <- 3
I <- 20
Q <- sim.Q(K, I)
IQ <- list(
P0 = runif(I, 0.0, 0.2),
P1 = runif(I, 0.8, 1.0)
)
data <- sim.data(Q = 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 = data$dat, Q = Q)
#>
Iter = 1 Max. abs. change = 0.58226 Deviance = 10238.69
Iter = 2 Max. abs. change = 0.09628 Deviance = 8499.25
Iter = 3 Max. abs. change = 0.03447 Deviance = 8474.14
Iter = 4 Max. abs. change = 0.01418 Deviance = 8473.11
Iter = 5 Max. abs. change = 0.01087 Deviance = 8473.00
Iter = 6 Max. abs. change = 0.00870 Deviance = 8472.98
Iter = 7 Max. abs. change = 0.00678 Deviance = 8472.96
Iter = 8 Max. abs. change = 0.00521 Deviance = 8472.96
Iter = 9 Max. abs. change = 0.00398 Deviance = 8472.95
Iter = 10 Max. abs. change = 0.00303 Deviance = 8472.95
Iter = 11 Max. abs. change = 0.00230 Deviance = 8472.95
Iter = 12 Max. abs. change = 0.00174 Deviance = 8472.95
Iter = 13 Max. abs. change = 0.00131 Deviance = 8472.95
Iter = 14 Max. abs. change = 0.00099 Deviance = 8472.95
Iter = 15 Max. abs. change = 0.00075 Deviance = 8472.95
Iter = 16 Max. abs. change = 0.00056 Deviance = 8472.95
Iter = 17 Max. abs. change = 0.00042 Deviance = 8472.95
Iter = 18 Max. abs. change = 0.00032 Deviance = 8472.95
Iter = 19 Max. abs. change = 0.00024 Deviance = 8472.95
Iter = 20 Max. abs. change = 0.00018 Deviance = 8472.95
Iter = 21 Max. abs. change = 0.00014 Deviance = 8472.95
Iter = 22 Max. abs. change = 0.00010 Deviance = 8472.95
Iter = 23 Max. abs. change = 0.00008 Deviance = 8472.95
print(PVAF)
#> 000 100 010 001 110 101 011
#> item 1 0 0.05134842 0.97598092 0.18613188 0.9802896 0.23814530 0.99591812
#> item 2 0 0.86439230 0.03712562 0.31215845 0.8693825 0.98704825 0.32056482
#> item 3 0 0.23522559 0.12012631 0.87241240 0.3072164 0.97309596 0.88203710
#> item 4 0 0.05173563 0.09584344 0.99940807 0.1444852 0.99976115 0.99952689
#> item 5 0 0.62349258 0.04589841 0.40121477 0.6371479 0.99329142 0.40219000
#> item 6 0 0.05227982 0.08435986 0.99854120 0.1405906 0.99863704 0.99882057
#> item 7 0 0.04349359 0.07359227 0.99718460 0.1172816 0.99796681 0.99855439
#> item 8 0 0.02597720 0.99694136 0.10763178 0.9974399 0.14296665 0.99821058
#> item 9 0 0.04993629 0.10633169 0.99876484 0.1533138 0.99930901 0.99947106
#> item 10 0 0.11274442 0.60807722 0.38272025 0.7395862 0.44777927 0.96883130
#> item 11 0 0.16206456 0.78260617 0.24793692 0.9697524 0.34096303 0.88357918
#> item 12 0 0.08352343 0.52403194 0.68508551 0.6127426 0.70103744 0.99293967
#> item 13 0 0.99539650 0.02444805 0.04073177 0.9969569 0.99775210 0.06782181
#> item 14 0 0.04953849 0.07942294 0.99744295 0.1304486 0.99788845 0.99865278
#> item 15 0 0.99641621 0.02076599 0.06163513 0.9970600 0.99685903 0.07066164
#> item 16 0 0.04232723 0.80779556 0.20883071 0.8596830 0.23704989 0.99523695
#> item 17 0 0.11601012 0.79913617 0.25411336 0.9177438 0.30946089 0.93663147
#> item 18 0 0.19555343 0.09020988 0.91032737 0.2704788 0.97843358 0.92269262
#> item 19 0 0.01144746 0.99324032 0.07552435 0.9973500 0.09120313 0.99421796
#> item 20 0 0.26662583 0.73588306 0.22512570 0.9108287 0.41588709 0.79741884
#> 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
## calculate PVAF after fitting CDM
CDM.obj <- CDM(data$dat, Q, model="GDINA")
#>
Iter = 1 Max. abs. change = 0.58226 Deviance = 10238.69
Iter = 2 Max. abs. change = 0.09628 Deviance = 8499.25
Iter = 3 Max. abs. change = 0.03447 Deviance = 8474.14
Iter = 4 Max. abs. change = 0.01418 Deviance = 8473.11
Iter = 5 Max. abs. change = 0.01087 Deviance = 8473.00
Iter = 6 Max. abs. change = 0.00870 Deviance = 8472.98
Iter = 7 Max. abs. change = 0.00678 Deviance = 8472.96
Iter = 8 Max. abs. change = 0.00521 Deviance = 8472.96
Iter = 9 Max. abs. change = 0.00398 Deviance = 8472.95
Iter = 10 Max. abs. change = 0.00303 Deviance = 8472.95
Iter = 11 Max. abs. change = 0.00230 Deviance = 8472.95
Iter = 12 Max. abs. change = 0.00174 Deviance = 8472.95
Iter = 13 Max. abs. change = 0.00131 Deviance = 8472.95
Iter = 14 Max. abs. change = 0.00099 Deviance = 8472.95
Iter = 15 Max. abs. change = 0.00075 Deviance = 8472.95
Iter = 16 Max. abs. change = 0.00056 Deviance = 8472.95
Iter = 17 Max. abs. change = 0.00042 Deviance = 8472.95
Iter = 18 Max. abs. change = 0.00032 Deviance = 8472.95
Iter = 19 Max. abs. change = 0.00024 Deviance = 8472.95
Iter = 20 Max. abs. change = 0.00018 Deviance = 8472.95
Iter = 21 Max. abs. change = 0.00014 Deviance = 8472.95
Iter = 22 Max. abs. change = 0.00010 Deviance = 8472.95
Iter = 23 Max. abs. change = 0.00008 Deviance = 8472.95
PVAF <-get.PVAF(CDM.obj = CDM.obj)
print(PVAF)
#> 000 100 010 001 110 101 011
#> item 1 0 0.05134842 0.97598092 0.18613188 0.9802896 0.23814530 0.99591812
#> item 2 0 0.86439230 0.03712562 0.31215845 0.8693825 0.98704825 0.32056482
#> item 3 0 0.23522559 0.12012631 0.87241240 0.3072164 0.97309596 0.88203710
#> item 4 0 0.05173563 0.09584344 0.99940807 0.1444852 0.99976115 0.99952689
#> item 5 0 0.62349258 0.04589841 0.40121477 0.6371479 0.99329142 0.40219000
#> item 6 0 0.05227982 0.08435986 0.99854120 0.1405906 0.99863704 0.99882057
#> item 7 0 0.04349359 0.07359227 0.99718460 0.1172816 0.99796681 0.99855439
#> item 8 0 0.02597720 0.99694136 0.10763178 0.9974399 0.14296665 0.99821058
#> item 9 0 0.04993629 0.10633169 0.99876484 0.1533138 0.99930901 0.99947106
#> item 10 0 0.11274442 0.60807722 0.38272025 0.7395862 0.44777927 0.96883130
#> item 11 0 0.16206456 0.78260617 0.24793692 0.9697524 0.34096303 0.88357918
#> item 12 0 0.08352343 0.52403194 0.68508551 0.6127426 0.70103744 0.99293967
#> item 13 0 0.99539650 0.02444805 0.04073177 0.9969569 0.99775210 0.06782181
#> item 14 0 0.04953849 0.07942294 0.99744295 0.1304486 0.99788845 0.99865278
#> item 15 0 0.99641621 0.02076599 0.06163513 0.9970600 0.99685903 0.07066164
#> item 16 0 0.04232723 0.80779556 0.20883071 0.8596830 0.23704989 0.99523695
#> item 17 0 0.11601012 0.79913617 0.25411336 0.9177438 0.30946089 0.93663147
#> item 18 0 0.19555343 0.09020988 0.91032737 0.2704788 0.97843358 0.92269262
#> item 19 0 0.01144746 0.99324032 0.07552435 0.9973500 0.09120313 0.99421796
#> item 20 0 0.26662583 0.73588306 0.22512570 0.9108287 0.41588709 0.79741884
#> 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
# }