This function will provide the priorities of attributes for all items.
get.priority(
Y = NULL,
Q = NULL,
att.str = NULL,
CDM.obj = NULL,
mono.constraint = FALSE,
model = "GDINA"
)A matrix containing all attribute priorities.
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. When it is not NULL, it enables rapid validation
of the Q-matrix without the need for parameter estimation. @seealso CDM.
Logical indicating whether monotonicity constraints should be fulfilled in estimation.
Default = FALSE.
Type of model to fit; can be "GDINA", "LCDM", "DINA", "DINO"
, "ACDM", "LLM", or "rRUM". Default = "GDINA".
@seealso CDM.
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}]\)
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.
validation
# \donttest{
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=CDM.obj)
head(priority)
# }
Run the code above in your browser using DataLab