Getting Started with cdCAT

Overview

cdCAT provides a session-based engine for Cognitive Diagnostic Computerized Adaptive Testing (CD-CAT). It supports DINA, DINO, and GDINA models with multiple item selection criteria and attribute estimation methods.

The typical workflow has four steps:

  1. Define the item bank with cdcat_items()
  2. Start a session with CdcatSession$new()
  3. Loop: select next item → collect response → update session
  4. Extract results with session$result()

1. Defining the Item Bank

The item bank requires a Q-matrix and item parameters. The Q-matrix is a binary matrix where rows are items and columns are attributes. An entry of 1 means the item requires that attribute.

# Q-matrix: 5 items, 2 attributes
Q <- matrix(c(
  1, 0,
  0, 1,
  1, 0,
  0, 1,
  1, 1
), nrow = 5, ncol = 2, byrow = TRUE)

# DINA model parameters
items <- cdcat_items(
  q_matrix = Q,
  model    = "DINA",
  slip     = c(0.10, 0.10, 0.15, 0.10, 0.10),
  guess    = c(0.20, 0.20, 0.15, 0.20, 0.15)
)

print(items)
#> cdCAT Item Bank
#>   Model  : DINA 
#>   Items  : 5 
#>   Attrs  : 2

2. Running a CD-CAT Session

# Start session
session <- CdcatSession$new(
  items     = items,
  method    = "MAP",
  criterion = "PWKL",
  min_items = 2L,
  max_items = 5L,
  threshold = 0.8
)

# Simulate responses (1 = correct, 0 = incorrect)
simulated_responses <- c(1, 1, 0, 1, 0)

repeat {
  item <- session$next_item()
  if (item == 0) break
  session$update(item, simulated_responses[item])
}

3. Extracting Results

res <- session$result()

cat("Estimated profile :", res$alpha_hat, "\n")
#> Estimated profile : 1 1
cat("Items administered:", res$administered, "\n")
#> Items administered: 1 2
cat("Responses         :", res$responses, "\n")
#> Responses         : 1 1
cat("N items           :", res$n_items, "\n")
#> N items           : 2
cat("Stop reason       :", res$stop_reason, "\n")
#> Stop reason       : single threshold reached
cat("Posterior         :", round(res$posterior, 3), "\n")
#> Posterior         : 0.033 0.149 0.149 0.669

4. Item Selection Criteria

All adaptive criteria below are designed for single attribute profile estimation — they select the item that best discriminates the full latent attribute profile α.

Criterion Full Name
"KL" Kullback-Leibler Information (KL) Method
"PWKL" Posterior-Weighted Kullback-Leibler (PWKL) Method
"MPWKL" Modified Posterior-Weighted Kullback-Leibler (MPWKL) Method
"SHE" Shannon Entropy (SHE) Method
"SEQ" Sequential (non-adaptive)
"RANDOM" Random selection

5. Supported Models

# DINO model
items_dino <- cdcat_items(Q, "DINO", slip = slip, guess = guess)

# GDINA model
gdina_params <- list(
  list("0" = 0.1, "1" = 0.9),
  list("0" = 0.1, "1" = 0.9),
  list("00" = 0.1, "10" = 0.5, "01" = 0.5, "11" = 0.9)
)
items_gdina <- cdcat_items(Q[1:3, ], "GDINA", gdina_params = gdina_params)

6. Estimation Methods

Three attribute estimation methods are available via the method argument: