GNPC: Estimation of examinees' attribute profiles using the GNPC...

View source: R/GNPC.R

GNPCR Documentation

Estimation of examinees' attribute profiles using the GNPC method

Description

Function GNPC is used to estimate examinees' attribute profiles using the general nonparametric classification (GNPC) method (Chiu et al., 2018; Chiu & Köhn, 2019). It can be used with data conforming to any cognitive diagnosis models (CDMs).

Usage

GNPC(
  Y,
  Q,
  fixed.w = FALSE,
  initial.dis = "hamming",
  initial.gate = "AND",
  max.iter = 1000,
  tol = 0.001,
  track.convergence = TRUE
)

Arguments

Y

A N \times J binary data matrix consisting of the responses from N examinees to J items.

Q

A J \times K binary Q-matrix where the entry q_{jk} describing whether the kth attribute is required by the jth item.

fixed.w

TRUE or FALSE. When TRUE is specified, fixed weights are used as the initial weights to compute fixed-weight ideal response and there is no need to use NPC to produce the initial values for examinees' attribute profiles. Hence, initial.dis and initial.gate are turned off. The default value is FALSE.

initial.dis

The type of distance used in the NPC to carry out the initial attribute profiles for the GNPC method. Allowable options are "hamming" and "whamming" representing the Hamming and the weighted Hamming distances, respectively.

initial.gate

The type of relation between examinees' attribute profiles and the items. Allowable relations are "AND" and "OR", representing the conjunctive and disjunctive relations, respectively.

max.iter

Maximum number of iterations allowed. Default is 1000.

tol

Convergence tolerance. The algorithm stops when the proportion of examinees whose classification changes is less than this value. Default is 0.001.

track.convergence

Logical. If TRUE, convergence information is tracked and returned for diagnostic purposes. Default is TRUE.

Value

The function returns a list with the following components:

att.est

A N \times K matrix of estimated attribute profiles for examinees

class

A vector of length N containing the estimated class memberships

ideal.response

A 2^K \times J matrix of weighted ideal responses

weight

A 2^K \times J matrix of weights used to compute the weighted ideal responses

convergence

(Only if track.convergence = TRUE) A list containing:

  • iteration: Vector of iteration numbers

  • prop.change: Proportion of examinees whose classification changed at each iteration

  • total.distance: Total squared distance between observed and weighted ideal responses

  • n.iter: Total number of iterations until convergence

  • converged: Logical indicating whether the algorithm converged within max.iter

Details

A weighted ideal response \eta^{(w)}, defined as the convex combination of \eta^{(c)} and \eta^{(d)}, is used in the GNPC method to compute distances. Suppose item j requires K_{j}^* \leq {K} attributes that, without loss of generality, have been moved to the first K_{j}^* positions of the item attribute vector \boldsymbol{q_j}. For each item j and latent class \mathcal{C}_{l}, the weighted ideal response \eta_{lj}^{(w)} is defined as the convex combination \eta_{lj}^{(w)} = w _{lj} \eta_{lj}^{(c)}+(1-w_{lj})\eta_{lj}^{(d)} where 0\leq w_{lj}\leq 1. The distance between the observed responses to item j and the weighted ideal responses w_{lj}^{(w)} of examinees in \mathcal{C}_{l} is defined as the sum of squared deviations: d_{lj} = \sum_{i \in \mathcal {C}_{l}} (y_{ij} - \eta_{lj}^{(w)})^2. \hat{w}_{lj} can then be obtained by minimizing d_{lj}, which can then be used to compute \hat{\eta}_{lj}.

After all the \hat{\eta}_{lj} are obtained, examinees' attribute profiles \boldsymbol{\alpha} can be estimated by minimizing the loss function \hat{d}_{lj} = \sum_{i \in \mathcal{C}_{l}} (y_{ij} - \hat{\eta}_{lj}^{(w)})^2

The algorithm iteratively updates the weighted ideal responses and reclassifies examinees until convergence is achieved. The stopping criterion is based on the proportion of examinees whose classification changes between consecutive iterations: \frac{\sum_{i=1}^{N} I\left[\alpha_i^{(t)} \neq \alpha_i^{(t-1)}\right]}{N} < \epsilon where \epsilon is the tolerance level (default = 0.001).

The default initial values of \boldsymbol{\alpha} are obtained by using the NPC method. Chiu et al. (2018) suggested another viable alternative for obtaining initial estimates of the proficiency classes by using an ideal response with fixed weights defined as \eta_{lj}^{(fw)}=\frac{\sum_{k=1}^{K}\alpha_{k}q_{jk}}{K}\eta_{lj}^{(c)}+(1-\frac{\sum_{k=1}^{K}\alpha_{k}q_{jk}}{K})\eta_{lj}^{(d)}.

References

programs: The general nonparametric classification method. Psychometrika, 83(2), 355–375. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11336-017-9595-4")}

classification method. Psychometrika, 84(3), 830–845. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11336-019-09660-x")}

Examples

## Not run: 
# Example 1: Basic usage
library(GDINA)
set.seed(123)
N <- 500
Q <- sim30GDINA$simQ
gs <- data.frame(guess = rep(0.2, nrow(Q)), slip = rep(0.2, nrow(Q)))
sim <- simGDINA(N, Q, gs.parm = gs, model = "DINA")
Y <- extract(sim, what = "dat")
alpha <- extract(sim, what = "attribute")

# Analyze data using GNPC
result <- GNPC(Y, Q, initial.dis = "hamming", initial.gate = "AND")

# View results
head(result$att.est)
table(result$class)

# Plot overall convergence 
plot(result)

# Plot individual examinee's convergence
plot(result, type = "individual", examinee.id = 1, true.alpha = alpha[1, ])

# Check attribute agreement rate
PAR(alpha, result$att.est)
AAR(alpha, result$att.est)

# Example 2: Without convergence tracking (Convergence tracking is only used for the GNPC plots.)
result2 <- GNPC(Y, Q, track.convergence = FALSE)

## End(Not run)



NPCDTools documentation built on Sept. 1, 2026, 1:08 a.m.

Related to GNPC in NPCDTools...