View source: R/IndexPriority.R
get.priority | R Documentation |
This function will provide the priorities of attributes for all items.
get.priority(Y = NULL, Q = NULL, CDM.obj = NULL, model = "GDINA")
Y |
A required |
Q |
A required binary |
CDM.obj |
An object of class |
model |
Type of model to fit; can be |
The calculation of priorities is straightforward (Qin & Guo, 2025): the priority of an attribute is the regression coefficient obtained from a LASSO multinomial logistic regression, with the attribute as the independent variable and the response data from the examinees as the dependent variable. The formula (Tu et al., 2022) is as follows:
\log[\frac{P(X_{pi} = 1 | \boldsymbol{\Lambda}_{p})}{P(X_{pi} = 0 | \boldsymbol{\Lambda}_{p})}] =
logit[P(X_{pi} = 1 | \boldsymbol{\Lambda}_{p})] =
\beta_{i0} + \beta_{i1} \Lambda_{p1} + \ldots + \beta_{ik} \Lambda_{pk} + \ldots + \beta_{iK} \Lambda_{pK}
Where X_{pi}
represents the response of examinee p
on item i
,
\boldsymbol{\Lambda}_{p}
denotes the marginal mastery probabilities of examinee p
(which can be obtained from the return value alpha.P
of the CDM
function),
\beta_{i0}
is the intercept term, and \beta_{ik}
represents the regression coefficient.
The LASSO loss function can be expressed as:
l_{lasso}(\boldsymbol{X}_i | \boldsymbol{\Lambda}) = l(\boldsymbol{X}_i | \boldsymbol{\Lambda}) - \lambda |\boldsymbol{\beta}_i|
Where l_{lasso}(\boldsymbol{X}_i | \boldsymbol{\Lambda})
is the penalized likelihood,
l(\boldsymbol{X}_i | \boldsymbol{\Lambda})
is the original likelihood,
and \lambda
is the tuning parameter for penalization (a larger value imposes a stronger penalty on
\boldsymbol{\beta}_i = [\beta_{i1}, \ldots, \beta_{ik}, \ldots, \beta_{iK}]
).
The priority for attribute i
is defined as: \boldsymbol{priority}_i = \boldsymbol{\beta}_i = [\beta_{i1}, \ldots, \beta_{ik}, \ldots, \beta_{iK}]
A matrix containing all attribute priorities.
Qin, H., & Guo, L. (2025). Priority attribute algorithm for Q-matrix validation: A didactic. Behavior Research Methods, 57(1), 31. DOI: 10.3758/s13428-024-02547-5.
Tu, D., Chiu, J., Ma, W., Wang, D., Cai, Y., & Ouyang, X. (2022). A multiple logistic regression-based (MLR-B) Q-matrix validation method for cognitive diagnosis models: A confirmatory approach. Behavior Research Methods. DOI: 10.3758/s13428-022-01880-x.
set.seed(123)
library(Qval)
## generate Q-matrix and data
K <- 5
I <- 20
IQ <- list(
P0 = runif(I, 0.1, 0.3),
P1 = runif(I, 0.7, 0.9)
)
Q <- sim.Q(K, I)
data <- sim.data(Q = Q, N = 500, IQ = IQ, model = "GDINA", distribute = "horder")
MQ <- sim.MQ(Q, 0.1)
CDM.obj <- CDM(data$dat, MQ)
priority <- get.priority(data$dat, Q, CDM.obj)
head(priority)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.