fit.FCDCM: Fit the Forced-Choice Diagnostic Classification Model (FCDCM)

View source: R/fit.FCDCM.R

fit.FCDCMR Documentation

Fit the Forced-Choice Diagnostic Classification Model (FCDCM)

Description

Fits a higher-order cognitive diagnostic model for forced-choice (paired- comparison) data. Each block presents two statements, and the respondent selects the one they agree with more. The discrete attribute mastery profile \boldsymbol{\alpha}_j for each person is marginalized over all 2^D possible patterns, linking a continuous higher-order latent trait \theta_j to the DCM condensation rule at the statement level.

Usage

fit.FCDCM(
  data,
  Q.matrix,
  block.items = NULL,
  dcm.type = "DINA",
  method = c("iStEM", "stan"),
  control.model = NULL,
  control.method = NULL
)

Arguments

data

An N \times B forced-choice data matrix. Each cell must be a two-statement ranking string such as "1>3" (first is selected over second), or 0/1 coded responses where 1 means selecting the first statement in the block.

Q.matrix

An I \times D binary Q-matrix for the statement- level DCM. q_{id} = 1 if attribute d is required by statement i. Must have exactly 2B rows.

block.items

A list of length B; each element is an integer vector of the two global statement indices in that block. If NULL, parsed from data assuming "A>B" format where A and B are statement indices.

dcm.type

Character vector (length 1 or I): "DINA" (default, conjunctive) or "DINO" (disjunctive). Recycled if scalar.

method

Estimation method: "iStEM" (default) or "stan".

control.model

A named list of model-level hyperparameters for the higher-order DCM. Supported entries:

delta1.mu, delta1.sigma

Prior mean and SD for \delta_{1d} (higher-order discrimination parameters; log-normal). Defaults: 0, 0.5. The log-normal prior constrains \delta_{1d} > 0, reflecting the assumption that higher \theta_j increases the probability of mastering each attribute. Larger values of \delta_{1d} indicate stronger relationships between the continuous trait \theta_j and attribute mastery.

delta0.mu, delta0.sigma

Prior mean and SD for \delta_{0d} (higher-order difficulty/threshold parameters; normal). Defaults: 0, 1. The probability of mastering attribute d at \theta_j = 0 is \{1+\exp(\delta_{1d}\delta_{0d})\}^{-1}. Higher values of \delta_{0d} indicate more difficult attributes.

eta0.mu, eta0.sigma

Prior mean and SD for \eta_{0b} (truncated normal on (0, 0.5)). Defaults: 0.10, 0.10. The prior encodes the expectation that \eta_{0b} is small (rarely choose the lower-mastery statement).

etaAB.mu, etaAB.sigma

Prior mean and SD for \eta_{ABb} (truncated normal on (0, 0.5)). Defaults: 0.30, 0.10. The prior encodes the expectation that \eta_{ABb} is larger (usually choose the higher-mastery statement).

use.prior

Logical; if TRUE (default), the normal priors on the block response parameters are applied during iStEM estimation. Set to FALSE to use flat likelihood updates.

par

Optional initial B \times 2 matrix for iStEM with columns eta0 and etaAB.

L

Theta grid size for numerical integration and the unidimensional iStEM theta Gibbs sampler. Default: 61.

theta.lower, theta.upper

Bounds for the unidimensional theta grid used by marginal log-likelihood computation and iStEM block Gibbs sampling. Defaults: -6, 6.

control.method

A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):

cores

Number of CPU cores for parallel chains (Stan) or ignored (iStEM). Default: the number of chains.

vis

Logical; if TRUE (default), prints progress information to the console.

seed

Random seed for reproducibility. Default: a random integer.

Stan-specific entries:

chains

Number of MCMC chains (default: 2).

iter

Total iterations per chain (default: 5000).

warmup

Warmup/burn-in iterations per chain (default: iter / 2).

thin

Thinning interval (default: 1).

init

Initial values: "random" (default) for uniform(-2, 2) initialization, or a list of initial values per chain.

algorithm

MCMC algorithm: "HMC" (default), "HMC", or "Fixed_param".

adapt_delta

Target average acceptance probability (NUTS; default: 0.95). The discrete attribute-profile marginalization can create a challenging posterior; consider increasing to 0.9–0.95 if divergences occur.

max_treedepth

Maximum tree depth (NUTS; default: 10). Increase if "max treedepth exceeded" warnings appear.

stepsize

Initial step size for the leapfrog integrator (auto-tuned by Stan if not set).

int_time

Total integration time for HMC trajectories (only when algorithm = "HMC").

metric

Mass matrix type: "unit_e", "diag_e" (default), or "dense_e".

adapt_engaged

Logical; if TRUE (default), warmup adaptation is enabled.

adapt_init_buffer, adapt_term_buffer, adapt_window

Warmup adaptation scheduling parameters (defaults: 25, 50, 25).

iStEM-specific entries:

M

Number of burn-in batches retained for Geweke convergence diagnosis (default: 10; must be \ge 2).

B

Batch size: MCMC iterations per batch (default: 20).

burnin.maxitr

Maximum burn-in batches (default: 100).

maxitr

Maximum total batches (default: 2000).

eps1

Geweke z-score convergence threshold for burn-in (default: 1.5).

eps2

Monte Carlo error tolerance for the final chain (default: 0.4).

frac1, frac2

Fractions for the Geweke diagnostic (defaults: 0.1, 0.5).

optim.maxit

Maximum iterations for parameter optimization steps (default: 50). In FCDCM iStEM, the higher-order \delta parameters and block \eta parameters are updated via closed-form or numerical optimization.

fix.corr

Logical; in the FCDCM, the latent trait is unidimensional, so this parameter has no effect (default: FALSE).

estimate.se

Logical; if TRUE (default), standard errors are computed from the final Monte Carlo chain.

Value

An object of class "FCDCM" containing:

npar

Number of free parameters (2D + 2B).

method

"stan" or "iStEM".

theta

List with est, se, Rhat (N \times 1); higher-order trait estimates.

delta

List with est, se, Rhat (D \times 2); higher-order \delta_1, \delta_0 parameters.

par

List with est, se, Rhat (B \times 2); block response parameters eta0 and etaAB.

alpha

List with est, se, Rhat, and prob; est is the binary classified attribute profile (N \times D) and prob contains posterior mastery probabilities.

class.post

Posterior probabilities for all 2^D attribute profiles.

alpha.patterns, zeta.patterns

Full enumeration of attribute mastery patterns and their condensation outputs.

logLik

Marginal log-likelihood (class "logLik").

Model Specification

Higher-order latent structure. A unidimensional continuous trait \theta_j \sim N(0, 1) governs the probability of mastering each attribute d = 1, \dots, D:

P(\alpha_{jd} = 1 \mid \theta_j) = \frac{1}{1 + \exp\bigl[-\bigl(\delta_{1d}\,\theta_j - \delta_{1d}\,\delta_{0d}\bigr)\bigr]},

where \delta_{1d} > 0 is the discrimination and \delta_{0d} is the difficulty (threshold) for attribute d. Attributes are conditionally independent given \theta_j.

Statement-level condensation. For each statement i = 1, \dots, I with Q-vector \mathbf{q}_i = (q_{i1}, \dots, q_{iD})', the latent mastery status \zeta_{ij} \in \{0, 1\} is determined by one of two condensation rules:

DINA (conjunctive):

\zeta_{ij} = \prod_{d: q_{id} = 1} \alpha_{jd}.

All required attributes must be mastered.

DINO (disjunctive):

\zeta_{ij} = 1 - \prod_{d: q_{id} = 1} (1 - \alpha_{jd}).

At least one required attribute must be mastered.

Forced-choice block response. Block b consists of two statements (A_b, B_b). The probability that the respondent selects statement A_b over B_b follows the original FC-DCM specification and fixes equal-condensation probabilities to chance:

P(\text{choose } A_b \mid \zeta_{A_b}, \zeta_{B_b}) = \begin{cases} \eta_{0b}, & \text{if } \zeta_{A_b} < \zeta_{B_b}, \\ 0.5, & \text{if } \zeta_{A_b} = \zeta_{B_b}, \\ 0.5+\eta_{ABb}, & \text{if } \zeta_{A_b} > \zeta_{B_b}. \end{cases}

with 0 < \eta_{0b} < 0.5 and 0 < \eta_{ABb} < 0.5. Thus equal statement-level mastery produces chance choice, choosing the lower mastery statement has probability \eta_{0b}, and choosing the higher mastery statement has probability 0.5+\eta_{ABb}. The probability of choosing B_b is the complement.

The marginal likelihood integrates over all 2^D attribute patterns:

P(\mathbf{Y}_j \mid \theta_j) = \sum_{\boldsymbol{\alpha} \in \{0,1\}^D} P(\boldsymbol{\alpha} \mid \theta_j) \times \prod_{b=1}^{B} P(Y_{jb} \mid \zeta_{A_b}, \zeta_{B_b}).

Design and Identifiability

A block with \zeta_{A_b}=\zeta_{B_b} contributes no direct information for distinguishing the two equal condensation states (both are fixed at 0.5). For single-attribute statements and D=2, if all blocks compare the same ordered attribute pair, the response distribution distinguishes 10 from 01 but leaves 00 and 11 to be separated only by the higher-order structural model. Good global fit can therefore coexist with weak profile classification.

A forced-choice Q/block design should provide repeated cross-attribute comparisons, avoid pairing statements with identical Q-vectors, and keep each attribute represented in both statement positions. A practical numerical target, consistent with the original FC-DCM simulation logic, is that each attribute appears multiple times as the first/predominant statement and multiple times as the second/inferior statement, with comparisons distributed across different attribute pairs. The automatic simulator uses this balanced assembly rule when block.items is not supplied.

Estimation Methods

Stan (method = "stan"):

Full Bayesian inference via HMC. The discrete attribute profile is exactly marginalized in the Stan likelihood.

iStEM (method = "iStEM"):

Improved Stochastic EM. Person sampling considers the joint space of \theta_j and \boldsymbol{\alpha}_j. Parameter updates use closed-form or numerical optimization steps.

References

de la Torre, J., & Douglas, J. A. (2004). Higher-order latent trait models for cognitive diagnosis. Psychometrika, 69(3), 333–353. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02295640")}

Junker, B. W., & Sijtsma, K. (2001). Cognitive assessment models with few assumptions, and connections with nonparametric item response theory. Applied Psychological Measurement, 25(3), 258–272.

See Also

sim.data.FCDCM, get.fit.index.FCDCM, logLik.FCDCM

Examples

sim <- sim.data.FCDCM(N.person = 20, N.block = 3, D = 2,
                      dcm.type = "DINA")
fit <- fit.FCDCM(sim$data, Q.matrix = sim$Q.matrix,
                 block.items = sim$block.items,
                 dcm.type = "DINA", method = "iStEM",
                 control.method = list(
                   seed = 123, vis = FALSE,
                   M = 2, B = 2, burnin.maxitr = 2,
                   maxitr = 3, eps1 = 10, eps2 = 10,
                   estimate.se = FALSE))
head(fit$alpha$est)                # binary attribute profiles (0/1)
head(fit$alpha$prob)               # marginal mastery probabilities
gof <- get.fit.index(fit)
summary(gof)


ForceChoice documentation built on Sept. 13, 2026, 1:06 a.m.