get.beta.Rd
The function is able to calculate the \(\beta\) index for all items after fitting CDM
or directly.
get.beta(Y = NULL, Q = NULL, CDM.obj = NULL, model = "GDINA")
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
.
A required binary I
× K
matrix containing the attributes not required or required, coded
as 0 or 1, to master the items. The i
th 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
.
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
.
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 \(\beta\) for each item and each possible attribute mastery pattern.
For a item \(i\) with the q-vector of the \(c\)-th type, the \(\beta\) index is computed as follows:
$$ \beta_{ic} = \sum_{l=1}^{2^K} \left| \frac{r_{li}}{n_l} P_{ic}(\mathbf{\alpha_l}) - \left(1 - \frac{r_{li}}{n_l}\right) \left[1 - P_{ic}(\mathbf{\alpha_l})\right] \right| = \sum_{l=1}^{2^K} \left| \frac{r_{li}}{n_l} - \left[1 - P_{ic}(\mathbf{\alpha_l}) \right] \right| $$
In the formula, \(r_{li}\) represents the number of examinees in knowledge state \(l\) who correctly answered item \(i\), while \(n_l\) is the total number of examinees in knowledge state \(l\). \(P_{ic}(\mathbf{\alpha_l})\) denotes the probability that an examinee in knowledge state \(l\) answers item \(i\) correctly when the q-vector for item \(i\) is of the \(c\)-th type. In fact, \(\frac{r_{li}}{n_l}\) is the observed probability that an examinee in knowledge state \(l\) answers item \(i\) correctly, and \(\beta_{jc}\) represents the difference between the actual proportion of correct answers for item \(i\) in each knowledge state and the expected probability of answering the item incorrectly in that state. Therefore, to some extent, \(\beta_{jc}\) can be considered as a measure of discriminability.
Li, J., & Chen, P. (2024). A new Q-matrix validation method based on signal detection theory. British Journal of Mathematical and Statistical Psychology, 00, 1–33. DOI: 10.1111/bmsp.12371
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)
)
model <- "DINA"
example.data <- sim.data(Q = example.Q, N = 500, IQ = IQ, model = model, distribute = "horder")
#> distribute = horder
#> model = DINA
#> 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 beta directly
beta <-get.beta(Y = example.data$dat, Q = example.Q, model = model)
#>
Iter = 1 Max. abs. change = 0.19980 Deviance = 8724.69
Iter = 2 Max. abs. change = 0.04346 Deviance = 7381.42
Iter = 3 Max. abs. change = 0.01281 Deviance = 7370.77
Iter = 4 Max. abs. change = 0.00643 Deviance = 7369.22
Iter = 5 Max. abs. change = 0.00356 Deviance = 7368.80
Iter = 6 Max. abs. change = 0.00206 Deviance = 7368.66
Iter = 7 Max. abs. change = 0.00123 Deviance = 7368.62
Iter = 8 Max. abs. change = 0.00074 Deviance = 7368.61
Iter = 9 Max. abs. change = 0.00045 Deviance = 7368.60
Iter = 10 Max. abs. change = 0.00027 Deviance = 7368.60
Iter = 11 Max. abs. change = 0.00017 Deviance = 7368.60
Iter = 12 Max. abs. change = 0.00010 Deviance = 7368.60
print(beta)
#> 000 100 010 001 110 101 011 111
#> item 1 NA 3.067405 5.826625 2.762520 5.827299 2.893180 5.806947 5.686921
#> item 2 NA 4.909631 4.385990 4.842139 4.922212 6.418098 4.849985 6.431667
#> item 3 NA 4.807016 5.398791 5.324686 5.672972 5.855394 5.811514 6.523584
#> item 4 NA 3.724479 3.724479 7.554881 3.724479 7.566167 7.561285 7.517970
#> item 5 NA 5.631882 5.053182 5.641294 5.613844 7.564338 5.636501 7.555951
#> item 6 NA 3.692283 3.692283 7.295014 3.692283 7.312337 7.294692 7.327066
#> item 7 NA 3.382209 3.382209 6.862914 3.382209 6.761942 6.886833 6.777883
#> item 8 NA 3.783005 7.420922 3.783005 7.377549 3.783005 7.431902 7.389104
#> item 9 NA 2.820942 2.820942 5.741854 2.820942 5.747232 5.684981 5.630822
#> item 10 NA 5.563152 6.367892 6.205020 6.804266 6.803225 6.778795 7.734915
#> item 11 NA 4.305429 4.920799 4.704469 5.208761 5.204914 5.266678 5.993953
#> item 12 NA 3.068368 3.730477 4.237073 3.321118 4.300783 5.347307 4.969072
#> item 13 NA 6.753898 3.652113 3.524261 6.744993 6.805167 3.524261 6.795517
#> item 14 NA 3.290794 3.290794 6.611531 3.290794 6.479670 6.611778 6.591269
#> item 15 NA 6.763125 3.521080 3.521080 6.804188 6.788470 3.521080 6.817160
#> item 16 NA 3.871161 5.512129 5.567375 5.556439 5.596235 7.263037 7.296187
#> item 17 NA 4.048916 4.713141 4.529555 5.110440 5.356908 5.006806 6.068185
#> item 18 NA 3.658672 3.270965 3.582355 3.633683 4.904642 3.601174 4.776157
#> item 19 NA 2.960606 5.982102 2.960606 5.962517 2.960606 5.965924 5.961233
#> item 20 NA 4.111533 4.829750 4.661836 5.141676 5.167853 5.189624 5.955002
## calculate beta after fitting CDM
example.CDM.obj <- CDM(example.data$dat, example.Q, model=model)
#>
Iter = 1 Max. abs. change = 0.19980 Deviance = 8724.69
Iter = 2 Max. abs. change = 0.04346 Deviance = 7381.42
Iter = 3 Max. abs. change = 0.01281 Deviance = 7370.77
Iter = 4 Max. abs. change = 0.00643 Deviance = 7369.22
Iter = 5 Max. abs. change = 0.00356 Deviance = 7368.80
Iter = 6 Max. abs. change = 0.00206 Deviance = 7368.66
Iter = 7 Max. abs. change = 0.00123 Deviance = 7368.62
Iter = 8 Max. abs. change = 0.00074 Deviance = 7368.61
Iter = 9 Max. abs. change = 0.00045 Deviance = 7368.60
Iter = 10 Max. abs. change = 0.00027 Deviance = 7368.60
Iter = 11 Max. abs. change = 0.00017 Deviance = 7368.60
Iter = 12 Max. abs. change = 0.00010 Deviance = 7368.60
beta <-get.beta(CDM.obj = example.CDM.obj)
print(beta)
#> 000 100 010 001 110 101 011 111
#> item 1 NA 3.067405 5.826625 2.762520 5.827299 2.893180 5.806947 5.686921
#> item 2 NA 4.909631 4.385990 4.842139 4.922212 6.418098 4.849985 6.431667
#> item 3 NA 4.807016 5.398791 5.324686 5.672972 5.855394 5.811514 6.523584
#> item 4 NA 3.724479 3.724479 7.554881 3.724479 7.566167 7.561285 7.517970
#> item 5 NA 5.631882 5.053182 5.641294 5.613844 7.564338 5.636501 7.555951
#> item 6 NA 3.692283 3.692283 7.295014 3.692283 7.312337 7.294692 7.327066
#> item 7 NA 3.382209 3.382209 6.862914 3.382209 6.761942 6.886833 6.777883
#> item 8 NA 3.783005 7.420922 3.783005 7.377549 3.783005 7.431902 7.389104
#> item 9 NA 2.820942 2.820942 5.741854 2.820942 5.747232 5.684981 5.630822
#> item 10 NA 5.563152 6.367892 6.205020 6.804266 6.803225 6.778795 7.734915
#> item 11 NA 4.305429 4.920799 4.704469 5.208761 5.204914 5.266678 5.993953
#> item 12 NA 3.068368 3.730477 4.237073 3.321118 4.300783 5.347307 4.969072
#> item 13 NA 6.753898 3.652113 3.524261 6.744993 6.805167 3.524261 6.795517
#> item 14 NA 3.290794 3.290794 6.611531 3.290794 6.479670 6.611778 6.591269
#> item 15 NA 6.763125 3.521080 3.521080 6.804188 6.788470 3.521080 6.817160
#> item 16 NA 3.871161 5.512129 5.567375 5.556439 5.596235 7.263037 7.296187
#> item 17 NA 4.048916 4.713141 4.529555 5.110440 5.356908 5.006806 6.068185
#> item 18 NA 3.658672 3.270965 3.582355 3.633683 4.904642 3.601174 4.776157
#> item 19 NA 2.960606 5.982102 2.960606 5.962517 2.960606 5.965924 5.961233
#> item 20 NA 4.111533 4.829750 4.661836 5.141676 5.167853 5.189624 5.955002