| Title: | Forced-Choice Modeling Based on Item Response Theory and Cognitive Diagnostic Models |
|---|---|
| Description: | Fits, simulates, and evaluates forced-choice and traditional item response theory (IRT) models for noncognitive assessment. Eight model families are supported, spanning dominance (multidimensional IRT (MIRT) 1PL--4PL; multidimensional generalized partial credit model (MGPCM)), ideal-point unfolding (multidimensional generalized graded unfolding model (MGGUM)), and forced-choice designs (forced-choice multidimensional IRT (FCMIRT), forced-choice generalized graded unfolding model (FCGGUM), Thurstonian IRT (TIRT), forced-choice diagnostic classification model (FCDCM), forced-choice generalized deterministic inputs, noisy "and" gate model (FCGDINA)) that mitigate response biases such as acquiescence and social desirability. Core estimation backends include full Bayesian inference via Hamiltonian Monte Carlo (Stan) and a fast improved stochastic expectation-maximization (iStEM) algorithm suitable for large-scale data; FCGDINA also provides a deterministic expectation-maximization (EM) estimator. Comprehensive model evaluation uses the limited-information M2 family of goodness-of-fit statistics (Maydeu-Olivares and Joe, 2005 <doi:10.1198/016214504000002069>; 2006 <doi:10.1007/s11336-005-1295-9>) together with root mean square error of approximation (RMSEA), comparative fit index (CFI), Tucker-Lewis index (TLI), and standardized root mean square residual (SRMSR). |
| Authors: | Haijiang Qin [aut, cre, cph] (ORCID: <https://orcid.org/0009-0000-6721-5653>), Lei Guo [aut, cph] (ORCID: <https://orcid.org/0000-0002-8273-3587>) |
| Maintainer: | Haijiang Qin <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.1 |
| Built: | 2026-10-12 13:46:17 UTC |
| Source: | https://github.com/cran/ForceChoice |
The ForceChoice package provides a unified framework for fitting, simulating, and evaluating forced-choice and traditional item response models. It supports eight model families spanning dominance (MIRT), ideal-point/unfolding (MGGUM), polytomous (MGPCM), and forced-choice (FCMIRT, FCGGUM, TIRT, FCDCM, FCGDINA) paradigms, with full Bayesian estimation via Stan, fast improved stochastic EM (iStEM), and a deterministic EM backend for FCGDINA.
Traditional (single-stimulus) models:
fit.MIRTMultidimensional IRT (1PL–4PL). Binary responses with optional Q-matrix structure.
fit.MGPCMMultidimensional Generalized Partial Credit Model. Polytomous ordered-category responses.
fit.MGGUMMultidimensional Generalized Graded Unfolding Model. Ideal-point polytomous responses.
Forced-choice (comparative) models:
fit.FCMIRTForced-choice MIRT. Item-level dominance model with sequential ranking over item endorsement logits at the block level.
fit.FCGGUMForced-choice GGUM. Item-level ideal-point model with sequential ranking over binary GGUM endorsement logits.
fit.TIRTThurstonian IRT for forced-choice. Pairwise probit comparison of latent utility differences.
fit.FCDCMForced-choice DCM. Higher-order cognitive diagnostic model with exact attribute-profile marginalization.
fit.FCGDINAForced-choice GDINA. General CDM item-response structure with forced-choice block likelihood.
Model families support a common estimation interface:
method = "stan"):Full Bayesian inference via Hamiltonian Monte Carlo
(NUTS/HMC). Provides posterior means, standard deviations,
and convergence diagnostics ().
method = "iStEM"):Improved Stochastic EM (iStEM) algorithm combining finite-grid block Gibbs person sampling with L-BFGS-B item-parameter optimization. Scales well to moderate data sets.
method = "EM"):Deterministic posterior-weight EM for FCGDINA. Useful as a reproducible baseline or fast diagnostic estimator.
A typical analysis follows four steps:
Simulate (or load) data with sim.data.*().
Fit a model with fit.*().
Rotate the solution if needed with
the rotate S3 generic.
Evaluate fit with get.fit.index()
and summary.good.of.fit().
The package uses the limited-information M2 framework
(Maydeu-Olivares & Joe, 2005, 2006) implemented in
good.of.fit. Fit indices include:
Information criteria: AIC, AICc, BIC, CAIC, SABIC, HQIC
Absolute fit: M2, RMSEA (with CI), SRMSR, McDonald NCI
Comparative fit: CFI, TLI, IFI
Pseudo-: McFadden, Cox–Snell, Nagelkerke, etc.
Local dependence: Yen's Q3 (raw and adjusted)
Classification: posterior entropy, mean max posterior
The package is designed so that simulation, estimation, extraction, and
model checking can be scripted end to end. Simulation functions return the
true parameters and the effective call arguments; fitted objects retain the
original input arguments, estimates, convergence diagnostics, and
likelihood-related quantities used by logLik and
get.fit.index. For computationally expensive Stan or iStEM
workflows, manuscript replication code should set seeds explicitly and use
a small demonstration configuration in addition to any full-scale analysis.
Maintainer: Haijiang Qin [email protected] (ORCID) [copyright holder]
Authors:
Haijiang Qin [email protected] (ORCID) [copyright holder]
Lei Guo [email protected] (ORCID) [copyright holder]
set.seed(123) sim <- sim.data.FCGDINA(N.person = 12, N.block = 2, I.block = 2, D = 2, model = "DINA") str(sim$response) head(sim$Q.matrix)set.seed(123) sim <- sim.data.FCGDINA(N.person = 12, N.block = 2, I.block = 2, D = 2, model = "DINA") str(sim$response) head(sim$Q.matrix)
Extract estimated model coefficients (item, statement, or block parameters) from fitted ForceChoice model objects. This provides a standard R interface for retrieving parameter estimates, standard errors, and convergence diagnostics in a consistent format across all eight model families.
## S3 method for class 'MIRT' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'MGPCM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'MGGUM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCMIRT' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCDCM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCGDINA' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCGGUM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'TIRT' coef(object, type = c("par", "theta", "Corr", "all"), ...)## S3 method for class 'MIRT' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'MGPCM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'MGGUM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCMIRT' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCDCM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCGDINA' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'FCGGUM' coef(object, type = c("par", "theta", "Corr", "all"), ...) ## S3 method for class 'TIRT' coef(object, type = c("par", "theta", "Corr", "all"), ...)
object |
An object of one of the following classes:
|
type |
Character string specifying which parameters to extract:
|
... |
Additional arguments (currently ignored). |
For FCDCM objects, type = "par" returns a list with
components delta (higher-order parameters, ) and
par (block parameters, ), reflecting
the hierarchical structure of the model.
type = "par"A matrix of item/statement/block parameter
estimates. Rows index items/statements/blocks and columns index
parameter types. Column names indicate the parameter (e.g.,
"a1", "b", "d0", "tau1", "eta0").
type = "theta"An matrix of person
parameter (latent trait) estimates.
type = "Corr"A inter-trait correlation
matrix.
type = "all"A named list with components par,
theta, and Corr.
coef(MIRT): Extract coefficients from MIRT objects.
Returns matrix with columns a1..aD, b, c, d.
coef(MGPCM): Extract coefficients from MGPCM objects.
Returns matrix with columns a1..aD, d0..d(K-1).
coef(MGGUM): Extract coefficients from MGGUM objects.
Returns matrix with columns a1..aD, delta1..deltaD, tau0..tau(K-1).
coef(FCMIRT): Extract coefficients from FCMIRT objects.
Returns statement parameter matrix with columns a1..aD, b, c, d.
coef(FCDCM): Extract coefficients from FCDCM objects.
Returns a list with delta ( higher-order
parameters) and par ( block
parameters). type = "theta" returns the higher-order trait,
and type = "Corr" returns a scalar 1.
coef(FCGDINA): Extract coefficients from FCGDINA objects.
type = "par" returns CDM delta parameters,
type = "theta" returns posterior attribute mastery probabilities,
type = "Corr" returns NA (no continuous latent trait).
coef(FCGGUM): Extract coefficients from FCGGUM objects.
Returns matrix with columns a1..aD, delta1..deltaD, tau0..tau(K-1).
coef(TIRT): Extract coefficients from TIRT objects.
Returns matrix with columns lambda1..lambdaD, psi2.
sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) coef(fit) # item parameter estimates coef(fit, type = "theta") # person trait estimates coef(fit, type = "Corr") # factor correlation matrix coef(fit, type = "all") # everything in a listsim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) coef(fit) # item parameter estimates coef(fit, type = "theta") # person trait estimates coef(fit, type = "Corr") # factor correlation matrix coef(fit, type = "all") # everything in a list
Computes Wald-type confidence intervals for the model parameters of a
fitted ForceChoice model object. Intervals are constructed as
, where
is the point estimate and is
the standard error of the -th free parameter.
## S3 method for class 'MIRT' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'MGPCM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'MGGUM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCMIRT' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCDCM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCGDINA' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCGGUM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'TIRT' confint(object, parm = NULL, level = 0.95, ...)## S3 method for class 'MIRT' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'MGPCM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'MGGUM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCMIRT' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCDCM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCGDINA' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'FCGGUM' confint(object, parm = NULL, level = 0.95, ...) ## S3 method for class 'TIRT' confint(object, parm = NULL, level = 0.95, ...)
object |
A fitted model object. |
parm |
Optional numeric indices or character names selecting free parameters. By default, intervals are returned for all free parameters. |
level |
Numeric; confidence level (default: |
... |
Additional arguments (currently ignored). |
A numeric matrix with two columns, 2.5% and
97.5% (column names adjust automatically for non-default
level). Each row corresponds to one free parameter.
confint(MIRT): Confidence intervals for MIRT parameters.
confint(MGPCM): Confidence intervals for MGPCM parameters.
confint(MGGUM): Confidence intervals for MGGUM parameters.
confint(FCMIRT): Confidence intervals for FCMIRT parameters.
confint(FCDCM): Confidence intervals for FCDCM parameters.
confint(FCGDINA): Confidence intervals for FCGDINA parameters.
confint(FCGGUM): Confidence intervals for FCGGUM parameters.
confint(TIRT): Confidence intervals for TIRT parameters.
Returns the model deviance, defined as where
is the marginal log-likelihood evaluated at the parameter estimates.
## S3 method for class 'MIRT' deviance(object, ...) ## S3 method for class 'MGPCM' deviance(object, ...) ## S3 method for class 'MGGUM' deviance(object, ...) ## S3 method for class 'FCMIRT' deviance(object, ...) ## S3 method for class 'FCDCM' deviance(object, ...) ## S3 method for class 'FCGDINA' deviance(object, ...) ## S3 method for class 'FCGGUM' deviance(object, ...) ## S3 method for class 'TIRT' deviance(object, ...)## S3 method for class 'MIRT' deviance(object, ...) ## S3 method for class 'MGPCM' deviance(object, ...) ## S3 method for class 'MGGUM' deviance(object, ...) ## S3 method for class 'FCMIRT' deviance(object, ...) ## S3 method for class 'FCDCM' deviance(object, ...) ## S3 method for class 'FCGDINA' deviance(object, ...) ## S3 method for class 'FCGGUM' deviance(object, ...) ## S3 method for class 'TIRT' deviance(object, ...)
object |
A fitted model object. |
... |
Additional arguments (currently ignored). |
A numeric scalar: .
deviance(MIRT): Model deviance () for MIRT objects.
deviance(MGPCM): Model deviance for MGPCM objects.
deviance(MGGUM): Model deviance for MGGUM objects.
deviance(FCMIRT): Model deviance for FCMIRT objects.
deviance(FCDCM): Model deviance for FCDCM objects.
deviance(FCGDINA): Model deviance for FCGDINA objects.
deviance(FCGGUM): Model deviance for FCGGUM objects.
deviance(TIRT): Model deviance for TIRT objects.
A generic S3 extractor function designed to retrieve internal components from fitted model objects produced by the ForceChoice package. This function provides a consistent interface across all eight model classes, allowing users to access estimated parameters, fit statistics, latent trait estimates, convergence diagnostics, and model configuration data without directly manipulating the internal list structure.
## S3 method for class 'MIRT' extract(object, what, ...) ## S3 method for class 'MGPCM' extract(object, what, ...) ## S3 method for class 'MGGUM' extract(object, what, ...) ## S3 method for class 'FCMIRT' extract(object, what, ...) ## S3 method for class 'FCDCM' extract(object, what, ...) ## S3 method for class 'FCGDINA' extract(object, what, ...) ## S3 method for class 'FCGGUM' extract(object, what, ...) ## S3 method for class 'TIRT' extract(object, what, ...)## S3 method for class 'MIRT' extract(object, what, ...) ## S3 method for class 'MGPCM' extract(object, what, ...) ## S3 method for class 'MGGUM' extract(object, what, ...) ## S3 method for class 'FCMIRT' extract(object, what, ...) ## S3 method for class 'FCDCM' extract(object, what, ...) ## S3 method for class 'FCGDINA' extract(object, what, ...) ## S3 method for class 'FCGGUM' extract(object, what, ...) ## S3 method for class 'TIRT' extract(object, what, ...)
object |
An object of one of the following classes:
|
what |
A character string specifying the name of the component to
extract. Valid choices depend on the class of |
... |
Additional arguments passed to methods (currently ignored). |
This function supports extraction from the eight ForceChoice model classes. Below are the available components for each:
MIRT, MGPCM, MGGUMTraditional (single-stimulus) models. Available components:
parList (est, se, Rhat, free)
of item parameter arrays.
thetaList (est, se, Rhat) of
person parameter matrices.
CorrList (est, se, Rhat) of
inter-trait correlation matrices.
logLikMarginal log-likelihood (class "logLik").
nparNumber of free parameters.
methodEstimation method ("stan" or "iStEM").
Q.matrixThe Q-matrix.
length.polyVector of category counts per item (MGPCM, MGGUM only).
stan.objThe stanfit object (Stan only).
MCMC.objThe MCMC extract list (Stan only).
iStEMList of iStEM diagnostics (iStEM only).
callThe matched call.
argumentsList of arguments used for fitting.
FCMIRT, FCGGUMForced-choice models. In addition to the traditional-model components listed above, the following are available:
block.itemsList of item indices in each block.
responseThe forced-choice response matrix.
patternsList of permissible ranking patterns per block.
patterns.totalList of all possible ranking patterns per block.
fc.typeCharacter vector of forced-choice formats
("RANK", "MOLE", "PICK").
FCDCMForced-Choice DCM. Available components:
parList (est, se, Rhat, free)
of block parameter matrices ().
deltaList (est, se, Rhat) of
higher-order parameters ().
thetaList (est, se, Rhat) of
higher-order trait estimates.
alphaPosterior mean attribute profile
().
alpha.patternsFull enumeration of
attribute mastery patterns.
zeta.patternsCondensation outputs for each pattern.
dcm.typeDCM condensation rule ("DINA" or
"DINO").
responseThe binary block response matrix.
block.itemsList of two-statement blocks.
patternsList of binary response patterns per block.
logLikMarginal log-likelihood (class "logLik").
nparNumber of free parameters.
methodEstimation method.
Q.matrixThe Q-matrix.
stan.obj, MCMC.obj, iStEM, EM
Estimation backend objects.
callThe matched call.
argumentsList of arguments used for fitting.
FCGDINAForced-Choice GDINA. Available components:
deltaList (est, se, Rhat) of
item-level CDM delta parameters.
alphaPosterior attribute summaries, including posterior class probabilities when available.
alpha.patternsFull enumeration of
attribute mastery patterns.
design.matrix.listPer-item CDM design matrices.
response, block.items, patterns,
patterns.total, fc.type
Forced-choice data structures.
TIRTThurstonian IRT. Available components:
parList (est, se, Rhat, free)
of statement-level parameter matrices ().
thetaList (est, se, Rhat) of
person parameter matrices.
gammaList (est, se, Rhat,
free) of pairwise parameters.
gamma.matrixList (est, se, Rhat)
of skew-symmetric matrices.
CorrList (est, se, Rhat) of
inter-trait correlation matrices.
pairs.matrixMatrix of pairwise comparison indices.
pairs.valuePerson-specific pair data (MOLE/PICK).
responseThe pairwise
response matrix.
block.itemsList of item indices in each block.
fc.typeCharacter vector of forced-choice formats.
Q.matrixThe statement-level Q-matrix.
logLikMarginal log-likelihood (class "logLik").
nparNumber of free parameters.
methodEstimation method.
stan.obj, MCMC.obj, iStEM
Estimation backend objects.
callThe matched call.
argumentsList of arguments used for fitting.
The requested component. Return type varies depending on
what and the class of object. If an invalid what
is provided, an informative error is thrown listing valid options.
extract(MIRT): Extract components from MIRT objects.
extract(MGPCM): Extract components from MGPCM objects.
extract(MGGUM): Extract components from MGGUM objects.
extract(FCMIRT): Extract components from FCMIRT objects.
extract(FCDCM): Extract components from FCDCM objects.
extract(FCGDINA): Extract components from FCGDINA objects.
extract(FCGGUM): Extract components from FCGGUM objects.
extract(TIRT): Extract components from TIRT objects.
sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) extract(fit, "par") # item parameter estimates extract(fit, "theta") # person trait estimates extract(fit, "Corr") # factor correlation matrix extract(fit, "npar") # number of free parameters extract(fit, "logLik") # marginal log-likelihood extract(fit, "iStEM") # iStEM convergence diagnosticssim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) extract(fit, "par") # item parameter estimates extract(fit, "theta") # person trait estimates extract(fit, "Corr") # factor correlation matrix extract(fit, "npar") # number of free parameters extract(fit, "logLik") # marginal log-likelihood extract(fit, "iStEM") # iStEM convergence diagnostics
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 for each person is marginalized over
all possible patterns, linking a continuous higher-order latent
trait to the DCM condensation rule at the statement level.
fit.FCDCM( data, Q.matrix, block.items = NULL, dcm.type = "DINA", method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.FCDCM( data, Q.matrix, block.items = NULL, dcm.type = "DINA", method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
Q.matrix |
An |
block.items |
A list of length |
dcm.type |
Character vector (length 1 or |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters for the higher-order DCM. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "FCDCM" containing:
nparNumber of free parameters ().
method"stan" or "iStEM".
thetaList with est, se, Rhat
(); higher-order trait estimates.
deltaList with est, se, Rhat
(); higher-order ,
parameters.
parList with est, se, Rhat
(); block response parameters
eta0 and etaAB.
alphaList with est, se, Rhat, and
prob; est is the binary classified attribute profile
() and prob contains posterior mastery
probabilities.
class.postPosterior probabilities for all
attribute profiles.
alpha.patterns, zeta.patterns
Full enumeration of attribute mastery patterns and their condensation outputs.
logLikMarginal log-likelihood (class "logLik").
Higher-order latent structure.
A unidimensional continuous trait governs the
probability of mastering each attribute :
where is the discrimination and
is the difficulty (threshold) for attribute .
Attributes are conditionally independent given .
Statement-level condensation.
For each statement with Q-vector
, the latent mastery status
is determined by one of two condensation
rules:
DINA (conjunctive):
All required attributes must be mastered.
DINO (disjunctive):
At least one required attribute must be mastered.
Forced-choice block response.
Block consists of two statements . The probability
that the respondent selects statement over follows
the original FC-DCM specification and fixes equal-condensation
probabilities to chance:
with and . Thus
equal statement-level mastery produces chance choice, choosing the lower
mastery statement has probability , and choosing the higher
mastery statement has probability . The probability
of choosing is the complement.
The marginal likelihood integrates over all attribute patterns:
A block with contributes no direct
information for distinguishing the two equal condensation states
(both are fixed at 0.5). For single-attribute statements and ,
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.
method = "stan"):Full Bayesian inference via HMC. The discrete attribute profile is exactly marginalized in the Stan likelihood.
method = "iStEM"):Improved Stochastic EM. Person sampling considers the joint space of
and . Parameter updates
use closed-form or numerical optimization steps.
de la Torre, J., & Douglas, J. A. (2004). Higher-order latent trait models for cognitive diagnosis. Psychometrika, 69(3), 333–353. 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.
sim.data.FCDCM, get.fit.index.FCDCM,
logLik.FCDCM
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)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)
Fits a forced-choice cognitive diagnostic model (FCGDINA) to comparative
response data. The statement-level cognitive diagnosis component can be
DINA, DINO, ACDM, or GDINA, and the block-level response model transforms
statement endorsement probabilities into forced-choice probabilities for
full rankings ("RANK"), most-least choices ("MOLE"), or
best-only choices ("PICK").
fit.FCGDINA( data, Q.matrix, model = c("GDINA", "DINA", "DINO", "ACDM"), block.items = NULL, fc.type = NULL, method = c("EM", "stan", "iStEM"), control.model = NULL, control.method = NULL )fit.FCGDINA( data, Q.matrix, model = c("GDINA", "DINA", "DINO", "ACDM"), block.items = NULL, fc.type = NULL, method = c("EM", "stan", "iStEM"), control.model = NULL, control.method = NULL )
data |
An |
Q.matrix |
An |
model |
CDM item model: |
block.items |
A list of length |
fc.type |
Forced-choice response type: |
method |
Estimation method. |
control.model |
Optional list of model-level controls. For Stan,
|
control.method |
Optional list of method-specific controls. |
An object of class "FCGDINA", a list containing:
nparNumber of free CDM delta parameters.
methodEstimation method actually used:
"stan", "iStEM", or "EM".
alphaList with est, se, Rhat, and
prob. est is an matrix of posterior
attribute mastery probabilities; prob contains posterior
probabilities for all attribute profiles.
deltaList with est, se, and Rhat.
For Stan fits, each element is the probability-scale transform of
the identified minimum-norm logit coefficient vector. Absolute
statement endorsement probabilities are not identified by
forced-choice data alone.
delta.identificationStan-only rank, nullity, blockwise rank diagnostics, and the identifying convention.
delta.storeStored posterior, iStEM, or bootstrap delta draws when available.
Q.matrix, block.items, patterns,
patterns.total, design.matrix.list,
alpha.patterns, fc.type, response
Processed model and data structures used by prediction, fit indices, and S3 methods.
stan.obj, MCMC.obj
Stan fit and extracted posterior
draws for method = "stan"; otherwise NULL.
iStEMiStEM convergence diagnostics and chains for
method = "iStEM"; otherwise NULL.
EMEM convergence diagnostics, log-likelihood trace, and
bootstrap summary for method = "EM"; otherwise
NULL.
logLikMarginal log-likelihood with class "logLik".
call, arguments
Matched call and effective fitting arguments.
Let denote the latent attribute
profile for person . For statement , the binary Q-vector
selects the required attributes and the reduced
attribute pattern is mapped to a CDM design row .
For Stan estimation, is represented directly
as the item-specific CDM effect vector on the logit scale: intercept,
attribute main effects, and interaction effects. The item-level endorsement
probability for attribute class is
so main effects and interactions may be negative while probabilities remain
in . Forced-choice observations identify only within-block
utility contrasts, not the absolute endorsement logits of individual
statements. The Stan implementation therefore removes the exact null space
of those contrasts and reports the unique minimum-norm coefficient
representative. The design matrix is generated according to model:
"DINA", "DINO", "ACDM", or "GDINA". EM and
iStEM retain the existing probability-scale CDM parameterisation.
For each forced-choice block, the statement endorsement probabilities are
converted to ranking-pattern probabilities by the same sequential
Luce–Plackett transformation used by fit.FCMIRT and
fit.FCGGUM. The likelihood marginalizes over all
attribute profiles using a uniform latent-class prior:
data must be an matrix, with one column per
forced-choice block. Entries may be character rankings such as
"2>1>3" or 1-based integer pattern indices. If integer pattern
indices are supplied, block.items must be provided because item
identities cannot be recovered from indices alone. For "MOLE" and
"PICK" character data, supplying block.items is recommended
and required whenever partial rankings do not identify all items in a
block.
Common control.method entries are:
seedInteger random seed.
coresNumber of cores used by Stan chains; ignored by the deterministic EM updates.
visLogical progress flag.
delta.lower, delta.upper
Lower and upper bounds for delta optimization in EM and iStEM. Defaults are -4 and 4.
Stan-specific entries include chains, iter, warmup,
thin, init, algorithm, and the usual Stan
control entries such as adapt_delta, max_treedepth,
stepsize, and metric. Defaults are inherited from the common
ForceChoice Stan helper: 4 chains, 2000 iterations, and half the iterations
used as warmup. The default init = 0 is valid for Stan FCGDINA
because it implies under the logit link.
iStEM-specific entries include M, B, burnin.maxitr,
maxitr, eps1, eps2, frac1, frac2,
optim.maxit, and estimate.se. Each iStEM update samples
discrete attribute classes from the current posterior and optimises
parameters given the sampled class memberships.
EM-specific entries are:
maxitrMaximum EM iterations; default 500.
minitrMinimum EM iterations before convergence checks; default 2.
tolAbsolute log-likelihood change tolerance; default
1e-6.
par.tolMaximum absolute delta-parameter change tolerance;
default 1e-4.
optim.maxitMaximum L-BFGS-B iterations for blockwise delta updates; default 200.
estimate.seLogical; whether to estimate standard errors by
nonparametric bootstrap. Default FALSE.
bootstrapNumber of bootstrap samples when
estimate.se = TRUE. Default 100; must be at least 2.
de la Torre, J. (2011). The generalized DINA model framework. Psychometrika, 76(2), 179–199. doi:10.1007/s11336-011-9207-7
Templin, J., & Henson, R. A. (2006). Measurement of psychological disorders using cognitive diagnosis models. Psychological Methods, 11(3), 287–305. doi:10.1037/1082-989X.11.3.287
sim.data.FCGDINA, model.FCGDINA,
get.fit.index.FCGDINA, fit.FCDCM,
fit.FCMIRT, fit.FCGGUM
sim <- sim.data.FCGDINA(N.person = 20, N.block = 2, I.block = 2, D = 2, model = "DINA", fc.type = "RANK") fit <- fit.FCGDINA( sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, model = "DINA", fc.type = sim$fc.type, method = "EM", control.method = list(seed = 123, vis = FALSE, maxitr = 2, estimate.se = FALSE) ) coef(fit, type = "par") head(fit$alpha$est) logLik(fit) # stan code, long time fit.stan <- fit.FCGDINA( sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, model = "GDINA", method = "stan", control.method = list(seed = 123, cores = 2, chains = 1, iter = 200, warmup = 100) )sim <- sim.data.FCGDINA(N.person = 20, N.block = 2, I.block = 2, D = 2, model = "DINA", fc.type = "RANK") fit <- fit.FCGDINA( sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, model = "DINA", fc.type = sim$fc.type, method = "EM", control.method = list(seed = 123, vis = FALSE, maxitr = 2, estimate.se = FALSE) ) coef(fit, type = "par") head(fit$alpha$est) logLik(fit) # stan code, long time fit.stan <- fit.FCGDINA( sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, model = "GDINA", method = "stan", control.method = list(seed = 123, cores = 2, chains = 1, iter = 200, warmup = 100) )
Fits a forced-choice variant of the multidimensional generalized graded unfolding model (GGUM) to comparative ranking data. Unlike dominance-based FC models, the FCGGUM uses an ideal-point (unfolding) item response process: endorsement probability peaks when the person and item locations coincide, and the block-level ranking follows the Luce–Plackett model.
fit.FCGGUM( data, Q.matrix = NULL, block.items = NULL, D = NULL, fc.type = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.FCGGUM( data, Q.matrix = NULL, block.items = NULL, D = NULL, fc.type = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
Q.matrix |
An optional |
block.items |
A list of length |
D |
Integer; number of latent dimensions. If |
fc.type |
Forced-choice response type: |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters for the GGUM unfolding model in a forced-choice framework. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "FCGGUM" containing:
nparNumber of free parameters.
method"stan" or "iStEM".
thetaList with est, se, Rhat
().
parList with est, se, Rhat,
free ().
CorrList with est, se, Rhat
().
block.items, patterns, patterns.total,
response
Block structure.
logLikMarginal log-likelihood (class "logLik").
Item-level unfolding process.
For statement with Q-vector ,
the category response function is the GGUM (see fit.MGGUM
for the full polytomous specification). For the forced-choice context,
each item is binary (). Define
The binary GGUM endorsement probability used by the code is:
where is the first (and only free) threshold.
Block-level forced-choice ranking.
Within each block , the probability of the observed ranking is
computed by applying the sequential Luce/Plackett rule to
:
MOLE and PICK probabilities are sums over compatible full rankings, normalized over the observed block patterns by the C++ probability helper.
Q-matrix for unfolding. The Q-matrix serves a dual role:
entries of activate both the slope and the
location ; the sign of determines the
sign of (positive vs. negative side of dimension
).
method = "stan"):Full Bayesian inference via HMC. The GGUM likelihood involves summation terms that are handled in the Stan model block.
method = "iStEM"):Improved Stochastic EM. Person sampling uses finite-grid block Gibbs;
GGUM item parameters updated via constrained L-BFGS-B with
monotonicity constraints on and sign constraints on
.
Roberts, J. S., Donoghue, J. R., & Laughlin, J. E. (2000). A general item response theory model for unfolding unidimensional polytomous responses. Applied Psychological Measurement, 24(1), 3–32.
sim.data.FCGGUM, get.fit.index.FCGGUM,
logLik.FCGGUM, fit.MGGUM
sim <- sim.data.FCGGUM(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") fit <- fit.FCGGUM(sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, D = 2, fc.type = "RANK", method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) gof <- get.fit.index(fit) summary(gof)sim <- sim.data.FCGGUM(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") fit <- fit.FCGGUM(sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, D = 2, fc.type = "RANK", method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) gof <- get.fit.index(fit) summary(gof)
Fits a forced-choice variant of the multidimensional item response theory model to comparative ranking data. In forced-choice (FC) formats, respondents compare items within blocks rather than rating each item in isolation. The FCMIRT model couples an item-level MIRT endorsement model with a block-level ranking mechanism to recover latent trait estimates from comparative responses.
fit.FCMIRT( data, model = "2PL", Q.matrix = NULL, block.items = NULL, D = NULL, fc.type = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.FCMIRT( data, model = "2PL", Q.matrix = NULL, block.items = NULL, D = NULL, fc.type = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
model |
MIRT model type: |
Q.matrix |
An optional |
block.items |
A list of length |
D |
Integer; number of latent dimensions. If |
fc.type |
Character vector (length 1 or |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "FCMIRT" containing:
nparNumber of free parameters.
method"stan" or "iStEM".
thetaList with est, se, Rhat
(); person trait estimates.
parList with est, se, Rhat,
free (); item parameters
a1..aD, b, c, d.
CorrList with est, se, Rhat
().
block.items, patterns, patterns.total,
response
Block structure and response data.
logLikMarginal log-likelihood (class "logLik").
Item-level endorsement.
Each statement is governed by a MIRT model
(1PL through 4PL). For a person with trait ,
the probability of endorsing statement in isolation is:
Block-level ranking.
Let block consist of items
and define the implemented
statement utility as the logit of the item-level endorsement probability,
The probability that an examinee
produces the ranking
(read as " is preferred over over ...") is:
The Stan code evaluates the same choice kernel as
within each remaining set,
which is algebraically equivalent to a softmax over
.
Partial rankings (MOLE / PICK). For MOLE (most-least) data, only the best and worst items in each block are identified; for PICK data, only the best item. The probability of a partial ranking is obtained by marginalizing (summing) the full-ranking probabilities over all completions consistent with the partial constraint; the C++ probability helper returns probabilities normalized over the observed RANK/MOLE/PICK patterns for each block.
Identification constraint (2PLM-RANK). Block intercepts
are constrained to sum to zero within each block:
so that only difficulties are freely estimated per block.
method = "stan"):Full Bayesian inference via HMC. The forced-choice likelihood is
evaluated over the ranking pattern probabilities. By default,
a.sigma is set to 1.0 (wider prior) to avoid spurious
shrinkage of within-block slopes toward equality.
method = "iStEM"):Improved Stochastic EM with finite-grid block Gibbs person-sampling and item optimization (L-BFGS-B). Block-level identification constraints are enforced during each item-parameter update.
Brown, A., & Maydeu-Olivares, A. (2011). Item response modeling of forced-choice questionnaires. Educational and Psychological Measurement, 71(3), 460–502. doi:10.1177/0013164410375112
Luce, R. D. (1959). Individual choice behavior: A theoretical analysis. Wiley.
Plackett, R. L. (1975). The analysis of permutations. Journal of the Royal Statistical Society: Series C, 24(2), 193–202.
sim.data.FCMIRT, get.fit.index.FCMIRT,
logLik.FCMIRT, fit.MIRT
# Simulate forced-choice data sim <- sim.data.FCMIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, model = "m2pl", fc.type = "RANK") # Fit via iStEM fit <- fit.FCMIRT(sim$data, model = "m2pl", Q.matrix = sim$Q.matrix, block.items = sim$block.items, D = 2, fc.type = "RANK", method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) # Examine trait recovery cor(fit$theta$est, sim$theta) # Fit indices (nominal binary expansion) gof <- get.fit.index(fit) summary(gof)# Simulate forced-choice data sim <- sim.data.FCMIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, model = "m2pl", fc.type = "RANK") # Fit via iStEM fit <- fit.FCMIRT(sim$data, model = "m2pl", Q.matrix = sim$Q.matrix, block.items = sim$block.items, D = 2, fc.type = "RANK", method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) # Examine trait recovery cor(fit$theta$est, sim$theta) # Fit indices (nominal binary expansion) gof <- get.fit.index(fit) summary(gof)
Fits a multidimensional generalization of the generalized graded unfolding model (GGUM) to polytomous response data. Unlike dominance (cumulative) IRT models, the MGGUM belongs to the ideal-point (unfolding) model family where the probability of endorsement is highest when the person and item locations match, decreasing as the person moves away in either direction. Two estimation backends are provided: Bayesian MCMC (Stan) and iStEM.
fit.MGGUM( data, D = NULL, Q.matrix = NULL, length.poly = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.MGGUM( data, D = NULL, Q.matrix = NULL, length.poly = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
D |
Integer; number of latent dimensions ( |
Q.matrix |
An optional |
length.poly |
Integer vector (length |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters for the GGUM unfolding model. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "MGGUM" containing:
nparNumber of free parameters.
method"stan" or "iStEM".
thetaList with est, se, Rhat
().
parList with est, se, Rhat,
free ().
Columns: a1..aD, delta1..deltaD, tau0..tau_{K_{max}-1}.
CorrList with est, se, Rhat
().
length.polyPer-item category counts.
logLikMarginal log-likelihood (class "logLik").
Let be the categorical response
of person to item , with categories.
Let denote the -dimensional latent
trait vector.
The category response probability implemented by model.MGGUM,
iStEM, and Stan is the distance-based MGGUM form. Define
Let and
. With
, the probability of category
is
Here are discrimination parameters,
are item-location parameters (signed positive when
,
negative when ), and threshold parameters
satisfying and
.
Q-matrix sign convention:
Active dimension;
(item located on the positive side of dimension ).
Active dimension;
(item located on the negative side of dimension ).
Inactive dimension;
.
The sign of controls the item-location side, not the sign of
the slope. Both and reflect the item's
relevance to dimension .
method = "stan"):Full Bayesian inference via HMC. All parameters are jointly sampled from the posterior distribution.
method = "iStEM"):Improved Stochastic EM with finite-grid block Gibbs person-sampling
and item optimization via L-BFGS-B.
The threshold parameters are constrained to maintain
monotonicity during optimization.
Roberts, J. S., Donoghue, J. R., & Laughlin, J. E. (2000). A general item response theory model for unfolding unidimensional polytomous responses. Applied Psychological Measurement, 24(1), 3–32. doi:10.1177/01466216000241001
Usami, S. (2011). Generalized graded unfolding model with structural equation for subject parameters. Japanese Psychological Research, 53(3), 221–232.
sim.data.MGGUM, get.fit.index.MGGUM,
logLik.MGGUM
sim <- sim.data.MGGUM(N = 20, I = 6, D = 2, length.poly = 4) fit <- fit.MGGUM(sim$response, D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) gof <- get.fit.index(fit) summary(gof)sim <- sim.data.MGGUM(N = 20, I = 6, D = 2, length.poly = 4) fit <- fit.MGGUM(sim$response, D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) gof <- get.fit.index(fit) summary(gof)
Fits a multidimensional generalization of the partial credit model to polytomous (multi-category) response data. Two estimation backends are provided: full Bayesian inference via Hamiltonian Monte Carlo (Stan) and a fast stochastic-EM algorithm (iStEM).
fit.MGPCM( data, D = NULL, Q.matrix = NULL, length.poly = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.MGPCM( data, D = NULL, Q.matrix = NULL, length.poly = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
D |
Integer; number of latent dimensions ( |
Q.matrix |
An optional |
length.poly |
Optional integer scalar or length- |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "MGPCM" with components:
nparNumber of free parameters.
method"stan" or "iStEM".
thetaList with est, se, Rhat
().
parList with est, se, Rhat,
free (). Columns are
a1..aD, d0, d1, ..., d_{K_{max}-1}.
CorrList with est, se, Rhat
().
length.polyInteger vector of per-item category counts.
logLikMarginal log-likelihood (class "logLik").
call, arguments
Call and argument records.
Let denote the categorical
response of person to item ,
where is the number of response categories for item
. Let be the -dimensional
latent trait vector.
The category response probability implemented in both the C++ and Stan backends is a softmax over category scores:
where
The discrimination parameters satisfy when
and when . The
values are category intercepts, not cumulative step
difficulties; is fixed for identification and
are free.
This formulation nests the standard (unidimensional) generalized partial
credit model (Muraki, 1992) when and all .
Prior distributions:
(free)Log-normal:
(free)Normal:
for ;
is fixed. The same normal penalty is used by
Stan and by the iStEM item update when use.prior = TRUE.
Multivariate normal:
method = "stan"):Full Bayesian inference via HMC. The joint posterior is sampled
with multiple chains, providing posterior means, standard deviations,
and diagnostics.
method = "iStEM"):Improved Stochastic EM alternating finite-grid block Gibbs person-sampling and item-parameter optimization (L-BFGS-B). Convergence monitored via Geweke diagnostics and batch-means MC error.
Muraki, E. (1992). A generalized partial credit model: Application of an EM algorithm. Applied Psychological Measurement, 16(2), 159–176. doi:10.1177/014662169201600206
Yao, L., & Schwarz, R. D. (2006). A multidimensional partial credit model for polytomous data. Applied Psychological Measurement, 30(4), 295–318.
sim.data.MGPCM, get.fit.index.MGPCM,
logLik.MGPCM, rotate
sim <- sim.data.MGPCM(N = 20, I = 6, D = 2, length.poly = 4) fit <- fit.MGPCM(sim$response, D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) fit$par$est[1:5, ] gof <- get.fit.index(fit) summary(gof)sim <- sim.data.MGPCM(N = 20, I = 6, D = 2, length.poly = 4) fit <- fit.MGPCM(sim$response, D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) fit$par$est[1:5, ] gof <- get.fit.index(fit) summary(gof)
Fits a multidimensional extension of the 1PL, 2PL, 3PL, or 4PL item response model to binary response data. Two estimation backends are provided: full Bayesian inference via Hamiltonian Monte Carlo (Stan) and a fast stochastic-EM algorithm (iStEM) that scales to large data sets.
fit.MIRT( data, model = "2PL", D = NULL, Q.matrix = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.MIRT( data, model = "2PL", D = NULL, Q.matrix = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
model |
Character string specifying the model type. Accepts both
internal codes ( |
D |
Integer; number of latent dimensions ( |
Q.matrix |
An optional |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "MIRT" containing the following
components:
nparInteger; number of free parameters (= freely estimated item parameters + free correlation elements).
methodCharacter; "stan" or "iStEM".
thetaList with matrices est, se,
Rhat (); person parameter estimates.
parList with matrices est, se,
Rhat, free (); item parameter
arrays. Columns are a1..aD, b, c, d.
CorrList with matrices est, se,
Rhat (); inter-trait correlation matrix.
Q.matrixThe Q-matrix used.
stan.objThe stanfit object (Stan only;
NULL for iStEM).
MCMC.objThe list returned by rstan::extract()
(Stan only; NULL for iStEM).
logLikThe marginal log-likelihood computed via
Gauss–Hermite-type quadrature (class "logLik").
callThe matched call.
argumentsList of arguments used in fitting.
iStEMList of iStEM diagnostic quantities (iStEM only), including burn-in size, convergence flags, and theta grid length.
Let denote the binary response of person
to item , and let
denote the -dimensional latent trait vector. The item response
function (IRF) for the four model variants is:
M1PL (Rasch / one-parameter logistic):
The M1PL implementation fixes the slope to 1 and is restricted to
; fixed unit slopes do not identify separate dimensions.
M2PL (two-parameter logistic):
The discrimination (slope) parameters are freely estimated
subject to the Q-matrix pattern and a log-normal prior.
M3PL (three-parameter logistic):
where is the lower-asymptote (pseudo-guessing) parameter.
M4PL (four-parameter logistic):
where is the lower asymptote and
is the upper asymptote (1 - slippage).
In the unidimensional case (), these reduce to the standard
1PL–4PL models. For , the Q-matrix governs which dimensions
load on each item, enabling both exploratory (default triangular
identification) and confirmatory (user-specified Q-matrix) structures.
Prior distributions (Bayesian / MAP):
(free)Log-normal: .
Defaults: , .
Normal: .
Defaults: , .
Uniform: .
Defaults: , .
Uniform: .
Defaults: , .
Multivariate normal:
,
with and
a correlation matrix.
method = "stan"):Full Bayesian inference via Hamiltonian Monte Carlo (NUTS/HMC).
The joint posterior of all parameters is explored using multiple
Markov chains. Output includes posterior means, standard deviations,
and convergence diagnostics for all parameters.
Marginal log-likelihood is approximated via Gauss–Hermite-type
quadrature over the latent space.
method = "iStEM"):An improved Stochastic EM (iStEM) algorithm that
alternates between (a) sampling from its
finite-grid full conditional as one -dimensional block using
the person's complete response likelihood and (b) maximizing the
complete-data posterior for item parameters via L-BFGS-B.
The inter-trait correlation matrix is estimated
by constrained unit-diagonal normal-likelihood optimization.
Convergence is monitored using Geweke (1992) convergence diagnostics
and batch-means Monte Carlo error estimates. Standard errors are
obtained from the final Monte Carlo chain.
Reckase, M. D. (2009). Multidimensional Item Response Theory. Springer. doi:10.1007/978-0-387-89976-3
Birnbaum, A. (1968). Some latent trait models and their use in inferring an examinee's ability. In F. M. Lord & M. R. Novick, Statistical theories of mental test scores (pp. 397–479). Addison-Wesley.
Barton, M. A., & Lord, F. M. (1981). An upper asymptote for the three-parameter logistic item-response model. ETS Research Report Series, 1981(1), i–21.
Geweke, J. (1992). Evaluating the accuracy of sampling-based approaches to the calculation of posterior moments. In J. M. Bernardo et al. (Eds.), Bayesian Statistics 4 (pp. 169–193). Oxford University Press.
good.of.fit for goodness-of-fit evaluation,
get.fit.index.MIRT for MIRT-specific fit indices,
sim.data.MIRT for simulating data from this model,
rotate for post-hoc rotation of MIRT solutions,
logLik.MIRT for marginal log-likelihood extraction.
# Simulate data from a 2-dimensional 2PL model sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") # Fit via iStEM (fast, large-data friendly) fit_istem <- fit.MIRT(sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) # stan code, long time # Fit via Stan (full Bayesian inference, computationally heavier) fit_stan <- fit.MIRT(sim$response, model = "m2pl", D = 2, method = "stan", control.method = list( chains = 1, iter = 200, warmup = 100, cores = 1, seed = 123)) # Extract results print(fit_istem$par$est) # item parameter estimates print(fit_istem$theta$est) # person trait estimates print(fit_istem$Corr$est) # factor correlation matrix # Compute goodness-of-fit indices gof <- get.fit.index(fit_istem) summary(gof)# Simulate data from a 2-dimensional 2PL model sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") # Fit via iStEM (fast, large-data friendly) fit_istem <- fit.MIRT(sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) # stan code, long time # Fit via Stan (full Bayesian inference, computationally heavier) fit_stan <- fit.MIRT(sim$response, model = "m2pl", D = 2, method = "stan", control.method = list( chains = 1, iter = 200, warmup = 100, cores = 1, seed = 123)) # Extract results print(fit_istem$par$est) # item parameter estimates print(fit_istem$theta$est) # person trait estimates print(fit_istem$Corr$est) # factor correlation matrix # Compute goodness-of-fit indices gof <- get.fit.index(fit_istem) summary(gof)
Fits the Thurstonian IRT model for forced-choice data. Unlike the FCMIRT/FCGGUM models that operate on the item-level endorsement probabilities, the TIRT model works directly at the level of paired comparisons: each pairwise comparison is treated as a binary outcome governed by a latent difference process with a probit link.
fit.TIRT( data, Q.matrix, block.items = NULL, fc.type = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )fit.TIRT( data, Q.matrix, block.items = NULL, fc.type = NULL, method = c("iStEM", "stan"), control.model = NULL, control.method = NULL )
data |
An |
Q.matrix |
An |
block.items |
A list of length |
fc.type |
Forced-choice response type: |
method |
Estimation method: |
control.model |
A named list of model-level hyperparameters for the Thurstonian IRT model. Supported entries:
|
control.method |
A named list of method-specific tuning parameters. Common entries (used by both Stan and iStEM):
Stan-specific entries:
iStEM-specific entries:
|
An object of class "TIRT" containing:
nparNumber of free parameters.
method"stan" or "iStEM".
thetaList with est, se, Rhat
().
parList with est, se, Rhat,
free (). Columns include the
loading on the design dimension and
.
CorrList with est, se, Rhat
().
gamma.matrixList with est, se, Rhat
(); pairwise intercept matrix.
pairs.matrix, pairs.value, response,
response.total
Pairwise and response data structures.
logLikMarginal log-likelihood (class "logLik").
Pairwise utility difference.
For a pair of statements in block , the latent
comparative judgment is:
where:
is the pairwise intercept (unfolding threshold
parameter). Skew-symmetry requires .
is the loading magnitude of statement
; the sign of the statement direction is carried by
.
is the Q-matrix entry; each row
has exactly one non-zero entry.
is the uniqueness
(error) of statement .
Binary pairwise response. The observed response is
Under the normality of errors, the probability is:
where is the standard normal CDF.
Identification constraints. Several standard constraints are applied:
Case A (): All
are fixed.
Case B (): The first
block's are fixed to 0.80, all
are fixed.
General case: The last item in each block has
fixed. Pairwise
parameters for comparisons that are never observed under the
supplied RANK/MOLE/PICK design are fixed to gamma.mu.
Correlation structure. The inter-trait correlation matrix
is estimated as in the MIRT model. In the Stan
file, is centered at zero; the iStEM backend
uses control.model$theta.mu as the mean in the normal kernel.
method = "stan"):Full Bayesian inference via HMC. The probit likelihood is evaluated over all pairwise comparisons.
method = "iStEM"):Improved Stochastic EM. Person sampling uses finite-grid block Gibbs;
structural parameters (, , )
updated via optimization or closed-form steps.
Brown, A., & Maydeu-Olivares, A. (2011). Item response modeling of forced-choice questionnaires. Educational and Psychological Measurement, 71(3), 460–502. doi:10.1177/0013164410375112
Maydeu-Olivares, A., & Brown, A. (2010). Item response modeling of paired comparison and ranking data. Multivariate Behavioral Research, 45(6), 935–974.
Thurstone, L. L. (1927). A law of comparative judgment. Psychological Review, 34(4), 273–286.
sim.data.TIRT, get.fit.index.TIRT,
logLik.TIRT
sim <- sim.data.TIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") fit <- fit.TIRT(sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, fc.type = "RANK", method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) cor(fit$theta$est, sim$theta) gof <- get.fit.index(fit) summary(gof)sim <- sim.data.TIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") fit <- fit.TIRT(sim$data, Q.matrix = sim$Q.matrix, block.items = sim$block.items, fc.type = "RANK", method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) head(fit$theta$est) cor(fit$theta$est, sim$theta) gof <- get.fit.index(fit) summary(gof)
Extract model-implied response probabilities from fitted
ForceChoice model objects. Returns the conditional probability of
each observed response given each person's estimated latent trait
, evaluated via the model's response
function.
## S3 method for class 'MIRT' fitted(object, ...) ## S3 method for class 'MGPCM' fitted(object, ...) ## S3 method for class 'MGGUM' fitted(object, ...) ## S3 method for class 'FCMIRT' fitted(object, ...) ## S3 method for class 'FCDCM' fitted(object, ...) ## S3 method for class 'FCGDINA' fitted(object, ...) ## S3 method for class 'FCGGUM' fitted(object, ...) ## S3 method for class 'TIRT' fitted(object, ...)## S3 method for class 'MIRT' fitted(object, ...) ## S3 method for class 'MGPCM' fitted(object, ...) ## S3 method for class 'MGGUM' fitted(object, ...) ## S3 method for class 'FCMIRT' fitted(object, ...) ## S3 method for class 'FCDCM' fitted(object, ...) ## S3 method for class 'FCGDINA' fitted(object, ...) ## S3 method for class 'FCGGUM' fitted(object, ...) ## S3 method for class 'TIRT' fitted(object, ...)
object |
A fitted model object of class |
... |
Additional arguments (currently ignored). |
For binary-response models, each entry is the endorsement probability
. For polytomous
models, probabilities are returned in stacked format (one column per
category). For forced-choice models, each entry is the probability of
the observed ranking pattern in the given block.
A numeric matrix of model-implied probabilities. Dimensions:
Binary models (MIRT, TIRT):
Polytomous models (MGPCM, MGGUM):
(stacked category probabilities)
Forced-choice models (FCMIRT, FCGDINA, FCGGUM):
(block-pattern probabilities)
FCDCM: (marginal block-choice probabilities
after integrating over attribute patterns)
fitted(MIRT): Fitted probabilities for MIRT objects.
Returns matrix of endorsement probabilities.
fitted(MGPCM): Fitted probabilities for MGPCM objects.
Returns stacked category probability matrix.
fitted(MGGUM): Fitted probabilities for MGGUM objects.
fitted(FCMIRT): Fitted probabilities for FCMIRT objects.
Returns block-pattern probability matrix.
fitted(FCDCM): Fitted probabilities for FCDCM objects.
Returns matrix of marginal block-choice probabilities
after integrating over attribute patterns.
fitted(FCGDINA): Fitted probabilities for FCGDINA objects.
Returns block-pattern probability matrix after integrating over posterior
attribute classes.
fitted(FCGGUM): Fitted probabilities for FCGGUM objects.
fitted(TIRT): Fitted probabilities for TIRT objects.
Returns matrix of pairwise comparison
probabilities.
Documents the three data objects used by the forced-choice conversion
helpers: human-readable data, block definitions
block.items, and model-ready response matrices. This
overview is intended as the starting point before using
get.response.from.data,
get.data.from.response, the TIRT-specific converters, or
the FCDCM-specific converters.
The package uses two layers of forced-choice representation:
dataAn matrix or data frame that is easy
to read and edit. Rows are persons and columns are forced-choice
blocks. A cell records the observed ordering with item labels separated
by ">". For example, "3>4>5" means item 3 was ranked
above item 4, which was ranked above item 5.
block.itemsA list of length . Element
gives the item labels appearing in column of data. This
object is the bridge between column order in the data file and item rows
in model parameter matrices such as Q.matrix.
responseThe compact numeric representation consumed by
model fitting code. Its meaning depends on the model family. For
FCGGUM, FCMIRT, and FCGDINA, response is an
matrix of 1-based pattern indices. For TIRT, response is an
matrix of pairwise binary outcomes. For FCDCM,
response is an binary matrix for two-item
blocks.
Use
get.response.from.data to convert character strings to
pattern indices, and get.data.from.response for the
inverse conversion.
Use get.response.from.data.TIRT and
get.data.from.response.TIRT. TIRT expands each block to
pairwise comparisons, so its response columns are pairs rather
than block-level pattern numbers.
Use get.response.from.data.FCDCM and
get.data.from.response.FCDCM. Each block has exactly two
statements, so response = 1 means the first statement in
block.items[[b]] was preferred and response = 0 means the
second statement was preferred.
block.items
Use
get.block.items.from.data for generic multi-item
forced-choice data and get.block.items.from.data.FCDCM
for FCDCM pair data. Recovery is only possible for item labels that
actually appear in the observed strings.
The th element of block.items always corresponds to
the th column of data or response.
fc.type = "RANK" expects a complete ranking such as
"3>4>5" for a three-item block.
fc.type = "MOLE" expects a most-least string such as
"3>5": item 3 is most preferred and item 5 is least preferred.
fc.type = "PICK" expects a single most-preferred item such
as "3".
Generic FC pattern-index responses are 1-based. They are row
numbers in the deterministic pattern matrix generated internally; see
generate_fc_permutation_patterns for the public pattern
generator.
TIRT data should use consecutive item labels across blocks, for
example list(1:2, 3:5, 6:8). This is the format returned by
sim.data.TIRT and expected by the TIRT conversion
routines.
get.block.items.from.data,
get.response.from.data,
get.data.from.response,
get.response.from.data.TIRT,
get.data.from.response.TIRT,
get.response.from.data.FCDCM,
get.data.from.response.FCDCM
# Generic FC conversion: response is a block-level pattern index. block.items <- list(1:2, 3:5) dat <- data.frame( block.1 = c("1>2", "2>1"), block.2 = c("3>4>5", "5>4>3"), stringsAsFactors = FALSE ) resp <- get.response.from.data(dat, block.items, fc.type = "RANK") resp get.data.from.response(resp, block.items, fc.type = "RANK") # TIRT conversion: response is pairwise 0/1 data. tirt <- get.response.from.data.TIRT(dat, block.items, fc.type = "RANK") tirt$response get.data.from.response.TIRT( tirt$response, block.items, fc.type = "RANK", pairs.value = tirt$pairs.value ) # FCDCM conversion: response is binary within each two-item block. fcdcm.items <- list(c(1L, 3L), c(2L, 4L)) fcdcm.dat <- data.frame( block.1 = c("1>3", "3>1"), block.2 = c("2>4", "4>2"), stringsAsFactors = FALSE ) fcdcm.resp <- get.response.from.data.FCDCM(fcdcm.dat, fcdcm.items) fcdcm.resp$response get.data.from.response.FCDCM(fcdcm.resp$response, fcdcm.items)# Generic FC conversion: response is a block-level pattern index. block.items <- list(1:2, 3:5) dat <- data.frame( block.1 = c("1>2", "2>1"), block.2 = c("3>4>5", "5>4>3"), stringsAsFactors = FALSE ) resp <- get.response.from.data(dat, block.items, fc.type = "RANK") resp get.data.from.response(resp, block.items, fc.type = "RANK") # TIRT conversion: response is pairwise 0/1 data. tirt <- get.response.from.data.TIRT(dat, block.items, fc.type = "RANK") tirt$response get.data.from.response.TIRT( tirt$response, block.items, fc.type = "RANK", pairs.value = tirt$pairs.value ) # FCDCM conversion: response is binary within each two-item block. fcdcm.items <- list(c(1L, 3L), c(2L, 4L)) fcdcm.dat <- data.frame( block.1 = c("1>3", "3>1"), block.2 = c("2>4", "4>2"), stringsAsFactors = FALSE ) fcdcm.resp <- get.response.from.data.FCDCM(fcdcm.dat, fcdcm.items) fcdcm.resp$response get.data.from.response.FCDCM(fcdcm.resp$response, fcdcm.items)
Infers the item composition of each forced-choice block from a character
data matrix. Each cell should encode the within-block item ordering
(e.g. "2>1>3" for a rank-3 block). The function parses all
non-missing cells per block and returns sorted, unique item indices.
This function is the recommended way to recover block.items when
only character-rank data are available. It works for all forced-choice
types ("RANK", "MOLE", "PICK") as long as every
item appears at least once across persons.
get.block.items.from.data(data)get.block.items.from.data(data)
data |
An |
The returned block.items list defines the block layout used by the
other converters. If data has columns, the result has
elements, and result element belongs to data column
. Item labels are treated as global item indices; they are not
recoded to local positions.
The function scans observed strings only. Therefore, for partial-response formats, it can only recover items that appear in the observed partial strings:
For "RANK", a complete ranking normally contains every item
in the block, so one valid row can be sufficient.
For "MOLE", only most- and least-preferred items appear in
each cell. An item that is never chosen as most or least cannot be
recovered from data alone.
For "PICK", only picked items appear. Items that are never
picked cannot be recovered from data alone.
In those partial-response cases, pass a complete user-defined
block.items list to the fitting or conversion function when the raw
data do not mention every item.
A list of length . Each element is an integer vector of
global item indices appearing in that block, sorted in ascending order.
get.block.items.from.data.FCDCM for the FCDCM (binary-pair)
variant.
get.response.from.data to convert character data to an
integer pattern-index matrix.
# 3 persons, 2 blocks. # Block 1 contains items 1 and 2; block 2 contains items 3, 4, and 5. dat <- data.frame( block.1 = c("1>2", "2>1", "1>2"), block.2 = c("3>4>5", "5>4>3", "4>3>5"), stringsAsFactors = FALSE ) get.block.items.from.data(dat)# 3 persons, 2 blocks. # Block 1 contains items 1 and 2; block 2 contains items 3, 4, and 5. dat <- data.frame( block.1 = c("1>2", "2>1", "1>2"), block.2 = c("3>4>5", "5>4>3", "4>3>5"), stringsAsFactors = FALSE ) get.block.items.from.data(dat)
Recovers the two-item composition of each FCDCM block from a character
data matrix of "a>b" / "b>a" preference strings. Because
every FCDCM block always compares exactly two statements, this function
only needs to inspect the first non-missing row of each column.
get.block.items.from.data.FCDCM(data)get.block.items.from.data.FCDCM(data)
data |
An |
The returned item pair is sorted in ascending order. For example, both
"1>3" and "3>1" imply c(1L, 3L) for that block. This
sorted pair is then the default coding direction used by
get.response.from.data.FCDCM: response value 1 means the
first element of the pair was preferred, and response value 0 means the
second element was preferred.
This helper assumes the two compared statements are fixed within each column. If a column accidentally mixes different item pairs, only the first parseable non-missing cell determines the returned pair, so such data should be cleaned before conversion.
A list of length . Each element is a two-element integer
vector c(a, b) with a < b.
get.block.items.from.data for the generic multi-item
variant used by FCGGUM, FCMIRT, and TIRT.
get.response.from.data.FCDCM to convert FCDCM data strings
to a 0/1 response matrix.
dat <- data.frame( b1 = c("1>3", "3>1", "1>3"), b2 = c("2>4", "2>4", "4>2"), stringsAsFactors = FALSE ) get.block.items.from.data.FCDCM(dat)dat <- data.frame( b1 = c("1>3", "3>1", "1>3"), b2 = c("2>4", "2>4", "4>2"), stringsAsFactors = FALSE ) get.block.items.from.data.FCDCM(dat)
Converts an integer matrix of pattern indices back to human-readable forced-choice data strings. This is the generic converter used by FCGGUM, FCMIRT, and FCGDINA where each column of the response matrix is an index into the block's observed permutation-pattern list.
get.data.from.response(response, block.items, fc.type = "RANK")get.data.from.response(response, block.items, fc.type = "RANK")
response |
An |
block.items |
A list of length |
fc.type |
Character vector of length |
A data frame with rows and columns. Column
names are "block.1", ..., "block.B". Cell values
are character strings: full rankings ("2>5>8") for
"RANK", "best>worst" pairs for "MOLE", and
single integers for "PICK".
For a block with items, the set of possible response patterns
depends on the forced-choice type:
All full permutations of the items
are generated. The patterns are listed in lexicographic order
of the within-block item positions. For example, a 3-item
block with items c(2,5,8) produces patterns:
(2,5,8), (2,8,5), (5,2,8), (5,8,2),
(8,2,5), (8,5,2). Pattern index 1 means the
first pattern was observed.
For a -item block, most-least
observation patterns are possible: choices for the most
preferred item times choices for the least preferred
item. Pattern means item was most
preferred and item was least preferred.
For a -item block, exactly patterns
exist: one for each possible most-preferred item.
In all cases the pattern index (an integer from 1 to the number of
observed patterns) is the row number in the matrix returned by
the internal permutation helper for that block. The same deterministic
pattern construction is exposed by
generate_fc_permutation_patterns.
This format is a compact block-level encoding. One response column equals one forced-choice block, even when the block contains more than two items. This is the representation expected by the generic forced-choice model families FCGGUM, FCMIRT, and FCGDINA. It should not be confused with the TIRT pairwise format, where one block usually expands to several pair columns.
get.response.from.data for the reverse conversion.
generate_fc_permutation_patterns for pattern generation.
get.data.from.response.TIRT for the TIRT-specific
converter.
# 2 persons, 2 RANK blocks. items <- list(1:2, 3:5) resp <- cbind(c(1, 2), c(1, 6)) get.data.from.response(resp, items, fc.type = "RANK") # Mixed block formats: first block is most-least, second block is pick. mixed.items <- list(1:3, 4:6) mixed.resp <- cbind(c(1, 6), c(1, 3)) get.data.from.response( mixed.resp, mixed.items, fc.type = c("MOLE", "PICK") )# 2 persons, 2 RANK blocks. items <- list(1:2, 3:5) resp <- cbind(c(1, 2), c(1, 6)) get.data.from.response(resp, items, fc.type = "RANK") # Mixed block formats: first block is most-least, second block is pick. mixed.items <- list(1:3, 4:6) mixed.resp <- cbind(c(1, 6), c(1, 3)) get.data.from.response( mixed.resp, mixed.items, fc.type = c("MOLE", "PICK") )
Converts a binary FCDCM response matrix (0/1 or 1/2 coding) back to
human-readable "a>b" / "b>a" preference strings. Each
block compares exactly two items; the response indicates which item
was selected.
get.data.from.response.FCDCM(response, block.items)get.data.from.response.FCDCM(response, block.items)
response |
An |
block.items |
A list of length |
A data frame with rows and columns. Each
cell is a character string "a>b" or "b>a".
Two coding conventions are accepted:
0/1 coding: 1 means the first-named item in
block.items was preferred; 0 means the second-named
item was preferred.
1/2 coding: 1 means the first-named item; 2 means the second-named item. This is auto-detected and converted.
The output always uses "a>b" format where a and
b are the two item indices in the comparison order.
The direction is controlled by block.items. If
block.items[[1]] = c(1L, 3L), then response value 1 becomes
"1>3" and response value 0 becomes "3>1". With 1/2 coding,
value 1 has the same meaning as above and value 2 means the second item.
A response matrix must use one coding convention consistently; mixed
0/1/2 values are rejected.
get.response.from.data.FCDCM for the reverse
conversion.
get.data.from.response for the generic multi-item
converter.
items <- list(c(1L, 3L), c(2L, 4L)) resp <- cbind(c(1, 0, 1), c(0, 1, 1)) dat <- get.data.from.response.FCDCM(resp, items) dat get.response.from.data.FCDCM(dat, items)$response # The same preferences can also be supplied as 1/2 responses. resp12 <- cbind(c(1, 2, 1), c(2, 1, 1)) get.data.from.response.FCDCM(resp12, items)items <- list(c(1L, 3L), c(2L, 4L)) resp <- cbind(c(1, 0, 1), c(0, 1, 1)) dat <- get.data.from.response.FCDCM(resp, items) dat get.response.from.data.FCDCM(dat, items)$response # The same preferences can also be supplied as 1/2 responses. resp12 <- cbind(c(1, 2, 1), c(2, 1, 1)) get.data.from.response.FCDCM(resp12, items)
Converts a Thurstonian IRT pairwise-response matrix back to the
human-readable forced-choice strings used in data. This is the
inverse of get.response.from.data.TIRT.
get.data.from.response.TIRT( response, block.items, fc.type = NULL, pairs.value = NULL )get.data.from.response.TIRT( response, block.items, fc.type = NULL, pairs.value = NULL )
response |
An |
block.items |
A list of length |
fc.type |
Character vector of length |
pairs.value |
A list of length |
TIRT differs from the generic FC converters because the model is expressed
through pairwise comparisons. The input response is therefore not a
block-level pattern-index matrix. It is an binary matrix,
where each column is one observed item pair and each entry is coded:
1: the first item in that pair was preferred;
0: the second item in that pair was preferred.
The number of response columns contributed by a block with items is
determined by fc.type:
All unordered pairs are observed. Pair columns
are generated in the order using the
item labels in block.items[[b]].
Only the pairs needed to identify the most- and least-preferred
items are retained. The block contributes response columns
per person.
Only the pairs involving the picked item are retained. The
block contributes response columns per person.
For "MOLE" and "PICK", the identities of the retained pairs
can vary by person. The pairs.value object records those
person-specific pair definitions and is required to reconstruct data
strings without ambiguity. It is normally copied directly from the
pairs.value component returned by
get.response.from.data.TIRT.
TIRT conversion assumes consecutive item labels across blocks, for example
list(1:2, 3:5). This is the layout returned by
sim.data.TIRT.
A data frame with rows and columns. Column names
are "block.1", "block.2", etc. Cell values are character
strings encoding the within-block ordering: full rankings for
"RANK", "best>worst" for "MOLE", and single
integers for "PICK".
get.response.from.data.TIRT for the reverse conversion.
get.data.from.response for the generic (non-TIRT) converter
used by FCGGUM and FCMIRT.
# 2 RANK blocks: block 1 has items 1,2; block 2 has items 3,4,5. items <- list(1:2, 3:5) resp <- cbind( c(1, 0), # block 1 pair: 1 vs 2 c(1, 0), # block 2 pair: 3 vs 4 c(1, 0), # block 2 pair: 3 vs 5 c(1, 0) # block 2 pair: 4 vs 5 ) get.data.from.response.TIRT(resp, items, fc.type = "RANK")# 2 RANK blocks: block 1 has items 1,2; block 2 has items 3,4,5. items <- list(1:2, 3:5) resp <- cbind( c(1, 0), # block 1 pair: 1 vs 2 c(1, 0), # block 2 pair: 3 vs 4 c(1, 0), # block 2 pair: 3 vs 5 c(1, 0) # block 2 pair: 4 vs 5 ) get.data.from.response.TIRT(resp, items, fc.type = "RANK")
Generic function to compute a comprehensive suite of model-fit diagnostics
for fitted ForceChoice model objects. The function dispatches on the class
of the fitted model and returns an object of class "good.of.fit"
containing likelihood-based, limited-information, and residual-based
diagnostics.
## S3 method for class 'FCDCM' get.fit.index(object, ...) ## S3 method for class 'FCGDINA' get.fit.index(object, ...) ## S3 method for class 'FCGGUM' get.fit.index(object, ...) ## S3 method for class 'FCMIRT' get.fit.index(object, ...) ## S3 method for class 'MGGUM' get.fit.index(object, ...) ## S3 method for class 'MGPCM' get.fit.index(object, ...) ## S3 method for class 'MIRT' get.fit.index(object, ...) ## S3 method for class 'TIRT' get.fit.index(object, ...)## S3 method for class 'FCDCM' get.fit.index(object, ...) ## S3 method for class 'FCGDINA' get.fit.index(object, ...) ## S3 method for class 'FCGGUM' get.fit.index(object, ...) ## S3 method for class 'FCMIRT' get.fit.index(object, ...) ## S3 method for class 'MGGUM' get.fit.index(object, ...) ## S3 method for class 'MGPCM' get.fit.index(object, ...) ## S3 method for class 'MIRT' get.fit.index(object, ...) ## S3 method for class 'TIRT' get.fit.index(object, ...)
object |
A fitted model object (class |
... |
Additional arguments passed to |
An object of class "good.of.fit". Use
summary.good.of.fit and print.good.of.fit
for formatted output. Key components:
LogLik, deviance, AIC, AICc,
BIC, CAIC, SABIC, HQIC
M2.value, df, p.value
RMSEA2, RMSEA.lower, RMSEA.upper,
RMSEA.p.close
SRMSR
CFI, TLI, IFI
McFadden.R2, CoxSnell.R2, Nagelkerke.R2
q3.mean, q3.abs.max, q3.adjusted.abs.max
posterior.entropy, posterior.entropy.normalized
get.fit.index(FCDCM): FCDCM model: binary block responses with
quadrature over higher-order and exact marginalization
over attribute patterns.
get.fit.index(FCGDINA): FCGDINA model: forced-choice CDM with nominal
binary expansion; within-block pairs excluded.
get.fit.index(FCGGUM): FCGGUM model: forced-choice unfolding with nominal
binary expansion; within-block pairs excluded.
get.fit.index(FCMIRT): FCMIRT model: forced-choice ranking data expanded
to nominal binary indicators; within-block pairs excluded from bivariate
moments.
get.fit.index(MGGUM): MGGUM model: polytomous unfolding responses with
M2* category-collapsed construction.
get.fit.index(MGPCM): MGPCM model: polytomous responses with M2*
category-collapsed construction.
get.fit.index(MIRT): MIRT model: binary responses with Gauss–Hermite
quadrature over -dimensional latent space.
get.fit.index(TIRT): TIRT model: pairwise binary responses with
within-block pairs excluded via bivariate.groups.
Following Maydeu-Olivares and Joe (2005, 2006), the test statistic uses first- and second-order marginal moments rather than the full contingency table, making it suitable for sparse high-dimensional responses.
Let be the vector of
model-implied univariate and bivariate moments,
the observed moments, and
the Jacobian. The M2 statistic is:
where with the orthogonal
complement of . Under the null,
asymptotically.
Information criteria (Akaike 1974; Schwarz 1978; Bozdogan 1987; Sclove 1987; Hannan & Quinn 1979):
RMSEA (Browne & Cudeck 1993):
Confidence intervals via non-central inversion; close-fit
test .
SRMSR:
CFI / TLI / IFI (Bentler 1990; Tucker & Lewis 1973; Bollen 1989):
Pseudo-:
Yen's Q3 (Yen 1984):
Posterior diagnostics (Celeux & Soromenho 1996):
RMSEA: close, reasonable
SRMSR: acceptable (Hu & Bentler 1999)
CFI / TLI: good, acceptable
Normalized entropy: acceptable separation
Akaike, H. (1974). IEEE Trans. Autom. Control, 19, 716–723. Bozdogan, H. (1987). Psychometrika, 52, 345–370. Browne, M. W., & Cudeck, R. (1993). In Bollen & Long (Eds.), Testing structural equation models (pp. 136–162). Sage. Celeux, G., & Soromenho, G. (1996). J. Classification, 13, 195–212. Hu, L. T., & Bentler, P. M. (1999). Struct. Equ. Modeling, 6, 1–55. Maydeu-Olivares, A., & Joe, H. (2005). JASA, 100, 1009–1020. Maydeu-Olivares, A., & Joe, H. (2006). Psychometrika, 71, 713–732. Schwarz, G. (1978). Ann. Statist., 6, 461–464. Yen, W. M. (1984). Appl. Psychol. Meas., 8, 125–145.
good.of.fit for the underlying engine,
summary.good.of.fit for formatted summary tables.
sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) gof <- get.fit.index(fit) summary(gof) # Custom RMSEA confidence level (99%) gof99 <- get.fit.index(fit, alpha = 0.005) summary(gof99)sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) gof <- get.fit.index(fit) summary(gof) # Custom RMSEA confidence level (99%) gof99 <- get.fit.index(fit, alpha = 0.005) summary(gof99)
For Stan-fitted models, returns the posterior draws of pointwise
log-likelihood (an matrix for most models,
or for FCDCM and FCGDINA). For EM and iStEM fits,
returns NULL.
get.log_lik(object, ...) ## Default S3 method: get.log_lik(object, ...)get.log_lik(object, ...) ## Default S3 method: get.log_lik(object, ...)
object |
A fitted ForceChoice model object. |
... |
Additional arguments (currently ignored). |
The returned matrix can be passed directly to loo or
waic for model comparison.
An matrix of pointwise log-likelihood draws
(Stan), or NULL (EM / iStEM).
get.log_lik(default): Default method; returns object$log_lik
when present and NULL otherwise.
# stan code, long time sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "2PL") fit <- fit.MIRT(sim$response, model = "2PL", D = 2, method = "stan") log_lik <- get.log_lik(fit) loo::loo(log_lik) loo::waic(log_lik)# stan code, long time sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "2PL") fit <- fit.MIRT(sim$response, model = "2PL", D = 2, method = "stan") log_lik <- get.log_lik(fit) loo::loo(log_lik) loo::waic(log_lik)
Parses human-readable forced-choice data strings into integer pattern indices. This is the generic converter used by FCGGUM, FCMIRT, and FCGDINA. Each data cell is matched against the full set of permutation/observation patterns for that block, and the resulting row index is stored in the response matrix.
get.response.from.data(data, block.items, fc.type = "RANK")get.response.from.data(data, block.items, fc.type = "RANK")
data |
An |
block.items |
A list of length |
fc.type |
Character vector of length |
An integer matrix. Each entry is a 1-based
pattern index (row number in the block's pattern matrix). Column
names are "block.1", ..., "block.B".
The conversion first generates all possible observation patterns for each block via the internal permutation helper:
RANK ( items): all full rankings,
ordered lexicographically by within-block position.
MOLE: most-least observation patterns.
PICK: best-only patterns.
Each data cell string is parsed into an integer vector of global item indices, which is then matched (as an ordered sequence) against the pattern matrix. The 1-based row index of the match becomes the response value. Pattern ordering is deterministic and reproducible.
A non-missing cell that cannot be matched to a valid pattern is returned as
NA_integer_. This is useful for data-screening workflows: after
conversion, check anyNA(response) before passing the response matrix
to a fitting function.
get.data.from.response for the reverse conversion.
generate_fc_permutation_patterns for pattern generation
details.
get.response.from.data.TIRT for the TIRT-specific
converter.
# 2 persons, 2 RANK blocks. items <- list(1:2, 3:5) dat <- data.frame( block.1 = c("1>2", "2>1"), block.2 = c("3>4>5", "5>4>3"), stringsAsFactors = FALSE ) resp <- get.response.from.data(dat, items, fc.type = "RANK") resp get.data.from.response(resp, items, fc.type = "RANK") # Mixed block formats: most-least plus pick. dat.mixed <- data.frame( mole = c("1>3", "3>2"), pick = c("4", "6"), stringsAsFactors = FALSE ) mixed.items <- list(1:3, 4:6) get.response.from.data( dat.mixed, mixed.items, fc.type = c("MOLE", "PICK") )# 2 persons, 2 RANK blocks. items <- list(1:2, 3:5) dat <- data.frame( block.1 = c("1>2", "2>1"), block.2 = c("3>4>5", "5>4>3"), stringsAsFactors = FALSE ) resp <- get.response.from.data(dat, items, fc.type = "RANK") resp get.data.from.response(resp, items, fc.type = "RANK") # Mixed block formats: most-least plus pick. dat.mixed <- data.frame( mole = c("1>3", "3>2"), pick = c("4", "6"), stringsAsFactors = FALSE ) mixed.items <- list(1:3, 4:6) get.response.from.data( dat.mixed, mixed.items, fc.type = c("MOLE", "PICK") )
Parses FCDCM preference strings ("a>b" / "b>a") into a
0/1 binary response matrix. Each block compares exactly two items.
get.response.from.data.FCDCM(data, block.items)get.response.from.data.FCDCM(data, block.items)
data |
An |
block.items |
A list of length |
For each block, only two strings are valid: "a>b" and "b>a",
where a = block.items[[b]][1] and b = block.items[[b]][2].
Leading and trailing whitespace is ignored. Missing values or strings that
do not match the block-specific item pair produce an error, because FCDCM
fitting requires a complete binary response matrix.
If block.items was obtained from
get.block.items.from.data.FCDCM, the pair is sorted in
ascending order. In that common workflow, response value 1 means the
smaller item index was preferred and response value 0 means the larger item
index was preferred.
A named list with component response, an
integer matrix coded 0/1.
The output uses 0/1 coding: 1 indicates preference for the
first-named item in block.items[[b]]; 0 indicates preference
for the second-named item. This coding is the native format expected
by the FCDCM model estimation functions.
get.data.from.response.FCDCM for the reverse conversion.
get.response.from.data for the generic multi-item
converter.
items <- list(c(1L, 3L), c(2L, 4L)) dat <- data.frame( b1 = c("1>3", "3>1", "1>3"), b2 = c("2>4", "2>4", "4>2"), stringsAsFactors = FALSE ) get.response.from.data.FCDCM(dat, items) get.data.from.response.FCDCM( get.response.from.data.FCDCM(dat, items)$response, items )items <- list(c(1L, 3L), c(2L, 4L)) dat <- data.frame( b1 = c("1>3", "3>1", "1>3"), b2 = c("2>4", "2>4", "4>2"), stringsAsFactors = FALSE ) get.response.from.data.FCDCM(dat, items) get.data.from.response.FCDCM( get.response.from.data.FCDCM(dat, items)$response, items )
Parses human-readable forced-choice data strings (full rankings, most-least choices, or best-only picks) into the Thurstonian IRT pairwise binary response format. Each unordered item pair within a block receives a 1/0 outcome indicating which item was preferred.
get.response.from.data.TIRT(data, block.items, fc.type = NULL)get.response.from.data.TIRT(data, block.items, fc.type = NULL)
data |
An |
block.items |
A list of length |
fc.type |
Character vector of length |
This function expands each block column in data into one or more
pairwise response columns. Pair columns are grouped by block in the same
order as block.items. Within a pair column, the coding is always
1 if the first item in the pair is preferred, and 0 if the second item is
preferred.
Item labels must match the values supplied in block.items; they do
not need to be consecutive. For example, if
block.items = list(c(2, 7), c(10, 20, 30)), the second block can
contain "10>20>30", "30>10", or "20", depending on
fc.type.
A list with two components:
An integer matrix of pairwise
binary outcomes (1/0). For block , the number of contributed
columns is for RANK, for MOLE, and
for PICK.
A list of length , each element being
a list of length of integer pair-definition matrices.
Required as input for
get.data.from.response.TIRT.
For a block with items, the number of pair columns depends on
fc.type: for "RANK", for
"MOLE", and for "PICK". For each retained pair:
RANK: the item ranked earlier in the ordering is
preferred. For block.items[[b]] = 3:5, pair order is
(3,4), (3,5), (4,5). The string
"3>4>5" therefore produces pairwise responses
1, 1, 1.
MOLE: only the most- and least-preferred items are
identified (e.g. "3>2" in a 3-item block). The
remaining items are treated as tied in the middle, producing
preference relations consistent with the partial ordering.
PICK: only the most-preferred item is identified
(e.g. "3" in a 3-item block). All other items are
treated as equally less preferred.
The pairs.value component records the actual pair matrices used for
each person and block. It is essential for converting MOLE/PICK responses
back to data, because the retained pair set can differ across
persons.
get.data.from.response.TIRT for the reverse conversion.
get.response.from.data for the generic (non-TIRT)
converter used by FCGGUM and FCMIRT.
# 2 persons, 2 RANK blocks. dat <- data.frame( block.1 = c("1>2", "2>1"), block.2 = c("3>4>5", "5>4>3"), stringsAsFactors = FALSE ) items <- list(1:2, 3:5) result <- get.response.from.data.TIRT(dat, items, fc.type = "RANK") result$response result$pairs.value[[1]] get.data.from.response.TIRT( result$response, items, fc.type = "RANK", pairs.value = result$pairs.value ) # Mixed partial-response blocks. dat.partial <- data.frame( mole = c("1>3", "2>1"), pick = c("4", "5"), stringsAsFactors = FALSE ) items.partial <- list(1:3, 4:6) partial <- get.response.from.data.TIRT( dat.partial, items.partial, fc.type = c("MOLE", "PICK") ) partial$response get.data.from.response.TIRT( partial$response, items.partial, fc.type = c("MOLE", "PICK"), pairs.value = partial$pairs.value )# 2 persons, 2 RANK blocks. dat <- data.frame( block.1 = c("1>2", "2>1"), block.2 = c("3>4>5", "5>4>3"), stringsAsFactors = FALSE ) items <- list(1:2, 3:5) result <- get.response.from.data.TIRT(dat, items, fc.type = "RANK") result$response result$pairs.value[[1]] get.data.from.response.TIRT( result$response, items, fc.type = "RANK", pairs.value = result$pairs.value ) # Mixed partial-response blocks. dat.partial <- data.frame( mole = c("1>3", "2>1"), pick = c("4", "5"), stringsAsFactors = FALSE ) items.partial <- list(1:3, 4:6) partial <- get.response.from.data.TIRT( dat.partial, items.partial, fc.type = c("MOLE", "PICK") ) partial$response get.data.from.response.TIRT( partial$response, items.partial, fc.type = c("MOLE", "PICK"), pairs.value = partial$pairs.value )
Computes a comprehensive suite of model-fit diagnostics for probability
models used in IRT, CDM, latent class, and forced-choice applications.
Indices include likelihood-based information criteria, limited-information
goodness-of-fit statistics (M2, RMSEA, SRMSR), incremental/comparative fit
indices (CFI, TLI), pseudo- measures, residual diagnostics,
local-dependence statistics (Yen's Q3), and posterior classification
diagnostics.
good.of.fit( par.vec, loglik.fun, prob.fun, response, npar, pi, pi.fun = NULL, alpha = 0.05, response.type = c("auto", "binary", "polytomous", "nominal", "ordinary"), response.K = NULL, bivariate.groups = NULL, nominal.groups = NULL, exclusive.groups = NULL, n.boot = 1000L, ... )good.of.fit( par.vec, loglik.fun, prob.fun, response, npar, pi, pi.fun = NULL, alpha = 0.05, response.type = c("auto", "binary", "polytomous", "nominal", "ordinary"), response.K = NULL, bivariate.groups = NULL, nominal.groups = NULL, exclusive.groups = NULL, n.boot = 1000L, ... )
par.vec |
Numeric vector of free model parameters. |
loglik.fun |
Function returning the fitted model log-likelihood. |
prob.fun |
Function returning conditional response probabilities at the latent support points. |
response |
An |
npar |
Integer; number of free parameters in the model. |
pi |
Numeric vector of latent support weights (summing to 1). |
pi.fun |
Optional function returning latent support weights given
|
alpha |
Tail probability for the RMSEA confidence interval.
Default |
response.type |
Character string specifying the response coding:
|
response.K |
Integer vector of length |
bivariate.groups |
Optional integer vector of length |
nominal.groups |
Integer vector of length matching the number of
expanded binary indicators for |
exclusive.groups |
Deprecated alias for |
n.boot |
Integer; number of bootstrap replicates for bootstrapped
diagnostics. Default |
... |
Additional arguments passed to |
An object of class "good.of.fit" (a list). Key components:
LogLik, deviance
Log-likelihood and deviance.
npar, N, nitems
Parameter count, sample size, number of items/indicators.
AIC, AICc, BIC, CAIC, SABIC,
HQIC
Information criteria.
M2.value, df, p.value
M2 statistic, degrees of freedom, asymptotic p-value.
RMSEA2, RMSEA.lower, RMSEA.upper,
RMSEA.CI.level, RMSEA.p.close
RMSEA estimate, confidence interval, interval level, close-fit test p-value.
SRMSR, RMSR
Standardized and raw root mean square residuals.
CFI, TLI, IFI
Incremental fit indices.
McFadden.R2, Nagelkerke.R2, CoxSnell.R2,
AldrichNelson.R2, VeallZimmermann.R2
Pseudo-
measures.
residuals, residuals.standardized,
correlation.residuals
Residual vectors.
moments.observed, moments.predicted
First- and second-order marginal moments.
q3.mean, q3.abs.max, q3.adjusted.abs.max,
q3.p95
Yen's Q3 local dependence statistics.
mean.max.posterior, median.max.posterior,
min.max.posterior
Posterior classification diagnostics.
null.LogLik, null.M2.value, null.df
Null (independence) model diagnostics.
LRT, LRT.df, LRT.p
Likelihood ratio test against the null model.
Let be the maximized
log-likelihood, the sample size, and the number of free
parameters (npar).
Deviance:
AIC (Akaike, 1974):
AICc (Hurvich & Tsai, 1989), small-sample correction:
BIC (Schwarz, 1978):
CAIC (Bozdogan, 1987), consistent AIC:
SABIC (Sclove, 1987), sample-size adjusted BIC:
HQIC (Hannan & Quinn, 1979):
The limited-information framework (Maydeu-Olivares & Joe, 2005, 2006) uses
first- and second-order marginal moments rather than the full
-way contingency table. This is essential for sparse high-dimensional
categorical responses where full-information tests break down.
Let be the vector of model-implied
univariate and bivariate moments (dimension ), and let
be their asymptotic covariance matrix
under the model.
M2 statistic:
where
is the vector of marginal residuals, and
with the orthogonal complement of the Jacobian
matrix .
Under correct model specification,
asymptotically.
RMSEA (Root Mean Square Error of Approximation):
Confidence intervals are obtained via non-central inversion.
The close-fit test evaluates .
SRMSR (Standardized Root Mean Square Residual):
where are the observed and model-implied correlation residuals,
summed over unique off-diagonal pairs.
McDonald's NCI (Non-Centrality Index):
CFI (Comparative Fit Index):
where the null (independence) model has with
degrees of freedom.
TLI (Tucker–Lewis Index, a.k.a. NNFI):
IFI (Incremental Fit Index, a.k.a. BFI):
MeasuresMcFadden's :
McFadden's adjusted :
Cox–Snell :
Nagelkerke :
Aldrich–Nelson :
Veall–Zimmermann :
where is the null-model (independence) log-likelihood and
the corresponding deviance.
For each pair of items , the residual correlation is
where residuals are computed from posterior expected scores. Adjusted Q3 values subtract the mean Q3 across all pairs to center the distribution (Christensen, Makransky, & Horton, 2017).
The print.summary.good.of.fit() method reports descriptive
recommended ranges based on common conventions. These are heuristics,
not decision rules; fit cutoffs depend on model family, dimensionality,
category sparsity, local dependence, and sample size.
RMSEA: close fit; reasonable;
mediocre (Browne & Cudeck, 1993)
SRMSR: acceptable (Hu & Bentler, 1999)
CFI / TLI: good; acceptable
Akaike, H. (1974). A new look at the statistical model identification. IEEE Transactions on Automatic Control, 19, 716–723.
Bozdogan, H. (1987). Model selection and Akaike's Information Criterion (AIC): The general theory and its analytical extensions. Psychometrika, 52, 345–370. doi:10.1007/BF02294361
Browne, M. W., & Cudeck, R. (1993). Alternative ways of assessing model fit. In K. A. Bollen & J. S. Long (Eds.), Testing structural equation models (pp. 136–162). Sage.
Christensen, K. B., Makransky, G., & Horton, M. C. (2017). Critical values for Yen's Q3. Applied Psychological Measurement, 41, 178–194. doi:10.1177/0146621616677520
Hannan, E. J., & Quinn, B. G. (1979). The determination of the order of an autoregression. Journal of the Royal Statistical Society: Series B, 41, 190–195.
Hu, L. T., & Bentler, P. M. (1999). Cutoff criteria for fit indexes in covariance structure analysis. Structural Equation Modeling, 6, 1–55. doi:10.1080/10705519909540118
Hurvich, C. M., & Tsai, C. L. (1989). Regression and time series model selection in small samples. Biometrika, 76, 297–307. doi:10.1093/biomet/76.2.297
MacCallum, R. C., Browne, M. W., & Sugawara, H. M. (1996). Power analysis and determination of sample size for covariance structure modeling. Psychological Methods, 1, 130–149.
Maydeu-Olivares, A., & Joe, H. (2005). Limited- and full-information estimation and goodness-of-fit testing in 2^n contingency tables: A unified framework. Journal of the American Statistical Association, 100, 1009–1020.
Maydeu-Olivares, A., & Joe, H. (2006). Limited information goodness-of-fit testing in multidimensional contingency tables. Psychometrika, 71, 713–732. doi:10.1007/s11336-005-1295-9
McFadden, D. (1974). Conditional logit analysis of qualitative choice behavior. In P. Zarembka (Ed.), Frontiers in econometrics (pp. 105–142). Academic Press.
Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6, 461–464. doi:10.1214/aos/1176344136
Sclove, S. L. (1987). Application of model-selection criteria to some problems in multivariate analysis. Psychometrika, 52, 333–343.
Yen, W. M. (1984). Effects of local item dependence on the fit and equating performance of the three-parameter logistic model. Applied Psychological Measurement, 8, 125–145. doi:10.1177/014662168400800201
get.fit.index for model-specific wrappers,
summary.good.of.fit for formatted fit tables,
print.good.of.fit for the print method.
Extracts the number of observations (persons) from a fitted ForceChoice model object. Returns the number of rows in the response matrix used for model fitting.
## S3 method for class 'MIRT' nobs(object, ...) ## S3 method for class 'MGPCM' nobs(object, ...) ## S3 method for class 'MGGUM' nobs(object, ...) ## S3 method for class 'FCMIRT' nobs(object, ...) ## S3 method for class 'FCDCM' nobs(object, ...) ## S3 method for class 'FCGDINA' nobs(object, ...) ## S3 method for class 'FCGGUM' nobs(object, ...) ## S3 method for class 'TIRT' nobs(object, ...)## S3 method for class 'MIRT' nobs(object, ...) ## S3 method for class 'MGPCM' nobs(object, ...) ## S3 method for class 'MGGUM' nobs(object, ...) ## S3 method for class 'FCMIRT' nobs(object, ...) ## S3 method for class 'FCDCM' nobs(object, ...) ## S3 method for class 'FCGDINA' nobs(object, ...) ## S3 method for class 'FCGGUM' nobs(object, ...) ## S3 method for class 'TIRT' nobs(object, ...)
object |
A fitted model object. |
... |
Additional arguments (currently ignored). |
An integer: the sample size .
nobs(MIRT): Number of observations (persons) for MIRT objects.
nobs(MGPCM): Number of observations for MGPCM objects.
nobs(MGGUM): Number of observations for MGGUM objects.
nobs(FCMIRT): Number of observations for FCMIRT objects.
nobs(FCDCM): Number of observations for FCDCM objects.
nobs(FCGDINA): Number of observations for FCGDINA objects.
nobs(FCGGUM): Number of observations for FCGGUM objects.
nobs(TIRT): Number of observations for TIRT objects.
Draws log-likelihood trace plots for fitted ForceChoice model objects. Stan, iStEM, and EM fits are visualised through the same convergence target: the total log-likelihood recorded across iterations of the corresponding estimation algorithm.
## S3 method for class 'MIRT' plot(x, y = NULL, ...) ## S3 method for class 'MGPCM' plot(x, y = NULL, ...) ## S3 method for class 'MGGUM' plot(x, y = NULL, ...) ## S3 method for class 'FCMIRT' plot(x, y = NULL, ...) ## S3 method for class 'FCDCM' plot(x, y = NULL, ...) ## S3 method for class 'FCGGUM' plot(x, y = NULL, ...) ## S3 method for class 'FCGDINA' plot(x, y = NULL, ...) ## S3 method for class 'TIRT' plot(x, y = NULL, ...)## S3 method for class 'MIRT' plot(x, y = NULL, ...) ## S3 method for class 'MGPCM' plot(x, y = NULL, ...) ## S3 method for class 'MGGUM' plot(x, y = NULL, ...) ## S3 method for class 'FCMIRT' plot(x, y = NULL, ...) ## S3 method for class 'FCDCM' plot(x, y = NULL, ...) ## S3 method for class 'FCGGUM' plot(x, y = NULL, ...) ## S3 method for class 'FCGDINA' plot(x, y = NULL, ...) ## S3 method for class 'TIRT' plot(x, y = NULL, ...)
x |
A fitted model object of class |
y |
Ignored. |
... |
Ignored. |
The horizontal axis is the saved Stan iteration, iStEM iteration, or EM
iteration. The vertical axis is the summed log-likelihood. Stan plots use
log_lik or log_lik_group from generated quantities and draw
all chains in one panel. iStEM plots use the iteration-level
iStEM$logLik.trace, and the stable chain is the final
M * B iStEM iterations. EM plots use EM$logLik.trace. For
Stan and iStEM fits, a vertical dashed line marks the stable-chain
boundary. EM fits do not have a stable-chain boundary.
Invisibly returns NULL. Plots are produced as a side
effect on the current graphics device.
plot(MIRT): Log-likelihood trace plot for MIRT objects.
plot(MGPCM): Log-likelihood trace plot for MGPCM objects.
plot(MGGUM): Log-likelihood trace plot for MGGUM objects.
plot(FCMIRT): Log-likelihood trace plot for FCMIRT objects.
plot(FCDCM): Log-likelihood trace plot for FCDCM objects.
plot(FCGGUM): Log-likelihood trace plot for FCGGUM objects.
plot(FCGDINA): Log-likelihood trace plot for FCGDINA objects.
plot(TIRT): Log-likelihood trace plot for TIRT objects.
Predict response probabilities from fitted ForceChoice model
objects. Given a fitted model and optionally new person parameter
(latent trait) values, returns the model-implied response probabilities.
When newdata is not provided, predictions are made at the
estimated latent trait values for each person.
## S3 method for class 'MIRT' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'MGPCM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'MGGUM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCMIRT' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCDCM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCGDINA' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCGGUM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'TIRT' predict(object, newdata = NULL, type = c("probability", "response"), ...)## S3 method for class 'MIRT' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'MGPCM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'MGGUM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCMIRT' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCDCM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCGDINA' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'FCGGUM' predict(object, newdata = NULL, type = c("probability", "response"), ...) ## S3 method for class 'TIRT' predict(object, newdata = NULL, type = c("probability", "response"), ...)
object |
A fitted model object of class |
newdata |
An optional |
type |
Character; |
... |
Additional arguments (currently ignored). |
type = "probability"For binary models (MIRT, TIRT):
an matrix of endorsement probabilities. For
polytomous models (MGPCM, MGGUM): an
matrix of stacked category probabilities. For forced-choice
models (FCMIRT, FCGGUM): an matrix of
block-pattern probabilities. For FCDCM: an
matrix of marginal block-choice probabilities.
type = "response"For binary models: an
matrix of simulated 0/1 responses. For
polytomous models: an matrix of category
indices. For forced-choice models: an matrix
of chosen pattern indices.
predict(MIRT): Predict response probabilities or simulated
responses from MIRT objects.
predict(MGPCM): Predict response probabilities from MGPCM objects.
predict(MGGUM): Predict response probabilities from MGGUM objects.
predict(FCMIRT): Predict response probabilities from FCMIRT objects.
predict(FCDCM): Predict response probabilities from FCDCM objects.
predict(FCGDINA): Predict response probabilities from FCGDINA objects.
For newdata, provide either binary alpha profiles or class
probability rows.
predict(FCGGUM): Predict response probabilities from FCGGUM objects.
predict(TIRT): Predict response probabilities from TIRT objects.
Provides user-friendly, formatted console output for objects generated by the ForceChoice package. This generic function dispatches to class-specific methods that display concise summaries of fitted models, simulation datasets, goodness-of-fit indices, and rotated solutions. Designed for interactive use and quick diagnostic inspection.
## S3 method for class 'good.of.fit' print(x, digits = 4, ...) ## S3 method for class 'summary.good.of.fit' print(x, ...) ## S3 method for class 'MIRT' print(x, ...) ## S3 method for class 'summary.MIRT' print(x, ...) ## S3 method for class 'MGPCM' print(x, ...) ## S3 method for class 'summary.MGPCM' print(x, ...) ## S3 method for class 'MGGUM' print(x, ...) ## S3 method for class 'summary.MGGUM' print(x, ...) ## S3 method for class 'FCMIRT' print(x, ...) ## S3 method for class 'summary.FCMIRT' print(x, ...) ## S3 method for class 'FCDCM' print(x, ...) ## S3 method for class 'summary.FCDCM' print(x, ...) ## S3 method for class 'FCGDINA' print(x, ...) ## S3 method for class 'summary.FCGDINA' print(x, ...) ## S3 method for class 'FCGGUM' print(x, ...) ## S3 method for class 'summary.FCGGUM' print(x, ...) ## S3 method for class 'TIRT' print(x, ...) ## S3 method for class 'summary.TIRT' print(x, ...) ## S3 method for class 'data.MIRT' print(x, ...) ## S3 method for class 'data.MGPCM' print(x, ...) ## S3 method for class 'data.MGGUM' print(x, ...) ## S3 method for class 'data.FCMIRT' print(x, ...) ## S3 method for class 'data.FCDCM' print(x, ...) ## S3 method for class 'data.FCGDINA' print(x, ...) ## S3 method for class 'data.FCGGUM' print(x, ...) ## S3 method for class 'data.TIRT' print(x, ...)## S3 method for class 'good.of.fit' print(x, digits = 4, ...) ## S3 method for class 'summary.good.of.fit' print(x, ...) ## S3 method for class 'MIRT' print(x, ...) ## S3 method for class 'summary.MIRT' print(x, ...) ## S3 method for class 'MGPCM' print(x, ...) ## S3 method for class 'summary.MGPCM' print(x, ...) ## S3 method for class 'MGGUM' print(x, ...) ## S3 method for class 'summary.MGGUM' print(x, ...) ## S3 method for class 'FCMIRT' print(x, ...) ## S3 method for class 'summary.FCMIRT' print(x, ...) ## S3 method for class 'FCDCM' print(x, ...) ## S3 method for class 'summary.FCDCM' print(x, ...) ## S3 method for class 'FCGDINA' print(x, ...) ## S3 method for class 'summary.FCGDINA' print(x, ...) ## S3 method for class 'FCGGUM' print(x, ...) ## S3 method for class 'summary.FCGGUM' print(x, ...) ## S3 method for class 'TIRT' print(x, ...) ## S3 method for class 'summary.TIRT' print(x, ...) ## S3 method for class 'data.MIRT' print(x, ...) ## S3 method for class 'data.MGPCM' print(x, ...) ## S3 method for class 'data.MGGUM' print(x, ...) ## S3 method for class 'data.FCMIRT' print(x, ...) ## S3 method for class 'data.FCDCM' print(x, ...) ## S3 method for class 'data.FCGDINA' print(x, ...) ## S3 method for class 'data.FCGGUM' print(x, ...) ## S3 method for class 'data.TIRT' print(x, ...)
x |
An object of one of the following classes:
|
digits |
Number of decimal places for numeric output (default: 4).
Used by |
... |
Additional arguments passed to methods (currently ignored in most cases). |
Each method produces a structured, human-readable summary optimized for its object type:
Invokes summary() internally and prints comprehensive output
including:
Model call and configuration (family, method, dimensions)
Data characteristics (N, I or B, response type)
Fit statistics (LogLik, npar, AIC, BIC)
Factor correlation matrix
Person parameter summary (N x D)
Item / statement / block parameter summary
For FCDCM: higher-order delta parameters and classification diagnostics
For TIRT: loading (lambda) parameter summary
Convergence diagnostics (algorithm, batches, latent grid length L)
good.of.fit)Delegates to summary.good.of.fit and prints:
Overview table (sample size, items, parameters, moments)
Limited-information absolute fit (M2, RMSEA, SRMSR)
Incremental / comparative fit (CFI, TLI, IFI)
Likelihood and information criteria (AIC, BIC, SABIC, CAIC)
Pseudo- measures
Invisibly returns the input object x. No data is modified.
print(good.of.fit): Print method for good.of.fit objects.
Delegates to summary.good.of.fit and prints formatted tables.
print(summary.good.of.fit): Print method for summary.good.of.fit objects.
Displays overview, absolute-fit, comparative-fit, likelihood/IC,
and pseudo- tables.
print(MIRT): Print method for MIRT objects.
Multidimensional IRT (1PL–4PL) model summary.
print(summary.MIRT): Print method for summary.MIRT objects.
Shows model config, data info, fit stats, factor correlations,
person/item parameter summaries, and convergence.
print(MGPCM): Print method for MGPCM objects.
Multidimensional Generalized Partial Credit Model summary.
print(summary.MGPCM): Print method for summary.MGPCM objects.
Shows polytomous model config, fit stats, factor correlations,
person/item parameter summaries, and convergence.
print(MGGUM): Print method for MGGUM objects.
Multidimensional Generalized Graded Unfolding Model summary.
print(summary.MGGUM): Print method for summary.MGGUM objects.
Shows unfolding model config, fit stats, factor correlations,
person/item parameter summaries, and convergence.
print(FCMIRT): Print method for FCMIRT objects.
Forced-Choice Multidimensional IRT model summary.
print(summary.FCMIRT): Print method for summary.FCMIRT objects.
Shows forced-choice model config with block info, fit stats,
factor correlations, person/statement parameter summaries.
print(FCDCM): Print method for FCDCM objects.
Forced-Choice Diagnostic Classification Model summary with
higher-order trait, attribute profiles, and classification diagnostics.
print(summary.FCDCM): Print method for summary.FCDCM objects.
Shows higher-order delta parameters, block eta parameters,
attribute classification summary, and convergence.
print(FCGDINA): Print method for FCGDINA objects.
Forced-Choice GDINA model summary.
print(summary.FCGDINA): Print method for summary.FCGDINA objects.
Shows CDM type, forced-choice block info, fit stats, delta summaries,
posterior attribute probabilities, and convergence.
print(FCGGUM): Print method for FCGGUM objects.
Forced-Choice Generalized Graded Unfolding Model summary.
print(summary.FCGGUM): Print method for summary.FCGGUM objects.
Shows forced-choice unfolding model config, fit stats,
factor correlations, person/statement parameter summaries.
print(TIRT): Print method for TIRT objects.
Thurstonian IRT for Forced-Choice model summary.
print(summary.TIRT): Print method for summary.TIRT objects.
Shows pairwise-comparison model config, fit stats,
factor correlations, loading/person parameter summaries.
print(data.MIRT): Print method for data.MIRT objects.
print(data.MGPCM): Print method for data.MGPCM objects.
print(data.MGGUM): Print method for data.MGGUM objects.
print(data.FCMIRT): Print method for data.FCMIRT objects.
print(data.FCDCM): Print method for data.FCDCM objects.
print(data.FCGDINA): Print method for data.FCGDINA objects.
print(data.FCGGUM): Print method for data.FCGGUM objects.
print(data.TIRT): Print method for data.TIRT objects.
Numeric values are rounded to the precision specified by
digits (default 4).
Parameter summary tables show Min, Q1, Median, Mean, Q3, Max across items/statements for each parameter type.
Convergence diagnostics adapt to the estimation backend (iStEM batch diagnostics vs. Stan HMC notes).
Compute residuals from fitted ForceChoice model objects. Supported types are raw (response), Pearson, and deviance residuals.
## S3 method for class 'MIRT' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'MGPCM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'MGGUM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCMIRT' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCDCM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCGDINA' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCGGUM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'TIRT' residuals(object, type = c("raw", "pearson", "deviance"), ...)## S3 method for class 'MIRT' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'MGPCM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'MGGUM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCMIRT' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCDCM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCGDINA' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'FCGGUM' residuals(object, type = c("raw", "pearson", "deviance"), ...) ## S3 method for class 'TIRT' residuals(object, type = c("raw", "pearson", "deviance"), ...)
object |
A fitted model object. |
type |
Character; |
... |
Additional arguments (currently ignored). |
Residual types follow standard GLM conventions for binary responses:
raw:
Pearson:
deviance:
For polytomous and forced-choice models, residuals are computed on a category-indicator matrix. This treats ordered categories and nominal forced-choice response patterns as multinomial outcomes rather than as numeric scores.
A numeric matrix with the same dimensions as the corresponding
fitted output.
residuals(MIRT): Residuals for MIRT objects.
residuals(MGPCM): Residuals for MGPCM objects.
residuals(MGGUM): Residuals for MGGUM objects.
residuals(FCMIRT): Residuals for FCMIRT objects.
residuals(FCDCM): Residuals for FCDCM objects.
residuals(FCGDINA): Residuals for FCGDINA objects.
residuals(FCGGUM): Residuals for FCGGUM objects.
residuals(TIRT): Residuals for TIRT objects.
Applies factor rotation to the posterior mean parameter estimates of fitted exploratory multidimensional models from the ForceChoice package. Rotation reparameterises the latent space to improve interpretability of factor loadings while preserving the model-implied covariance structure. Standard errors and other posterior uncertainty summaries are carried over from the original fit object without recomputation. No per-iteration rotation or cross-iteration alignment is performed.
For GPArotation methods, theta is re-standardized to a standard normal scale after rotation. For Promax rotation, no post-rotation standardization is applied. Loadings and the factor correlation matrix are updated accordingly to preserve model-implied covariances.
Rotation is not permitted when the fitted Q.matrix contains zeros
because that confirmatory structure would not generally be preserved
under rotation.
## S3 method for class 'MGPCM' rotate( object, method, vis = TRUE, target.a = NULL, target.theta = NULL, pst.W = NULL, lp.p = 1, lp.gpaiter = 5, promax_m = 4, ... ) ## S3 method for class 'MIRT' rotate( object, method, vis = TRUE, target.a = NULL, target.theta = NULL, pst.W = NULL, lp.p = 1, lp.gpaiter = 5, promax_m = 4, ... )## S3 method for class 'MGPCM' rotate( object, method, vis = TRUE, target.a = NULL, target.theta = NULL, pst.W = NULL, lp.p = 1, lp.gpaiter = 5, promax_m = 4, ... ) ## S3 method for class 'MIRT' rotate( object, method, vis = TRUE, target.a = NULL, target.theta = NULL, pst.W = NULL, lp.p = 1, lp.gpaiter = 5, promax_m = 4, ... )
object |
A fitted model object of class |
method |
Character string specifying the rotation method. Supported
methods include |
vis |
Logical; if |
target.a |
Numeric matrix of target loadings for target rotations
( |
target.theta |
Numeric matrix of target latent traits for target
rotations ( |
pst.W |
Numeric weight matrix for PST rotations
( |
lp.p |
Numeric; p parameter for Lp rotation (default = 1). |
lp.gpaiter |
Integer; max GPA iterations for Lp rotation (default = 5). |
promax_m |
Numeric; power parameter for Promax rotation (default = 4). |
... |
Additional arguments passed to the GPArotation rotation function. |
Only posterior means are rotated. For MGPCM objects, the first
columns of object$par$est are treated as discrimination
parameters; all category intercepts are unchanged.
rotate.MIRTAn object of class "RotateMIRT"
containing the rotated "MIRT" fit object (object),
the matched call (call), and the rotation arguments
(arguments). Standard errors in the fitted object are
preserved without recomputation.
rotate.MGPCMAn object of class "RotateMGPCM"
containing the rotated "MGPCM" fit object (object),
the matched call (call), and the rotation arguments
(arguments). Category intercepts are retained from the
original fit.
rotate(MGPCM): Applies a factor rotation to the posterior mean
discrimination parameters of MGPCM objects. The latent trait
estimates and factor correlation matrix are transformed consistently.
Category intercepts and posterior uncertainty summaries are retained
from the original fit without recomputation.
rotate(MIRT): Applies rotation to the posterior mean of loadings
only from MIRT objects. Loadings (a) and factor correlation
matrix (Corr) are updated to preserve model-implied covariances.
For GPArotation methods, theta is re-standardized to a standard
normal scale after rotation; for Promax, no post-rotation
standardization is applied.
Generates forced-choice paired-comparison data from a higher-order
cognitive diagnostic model (DINA/DINO). The continuous higher-order
trait governs attribute mastery probabilities via a logistic link;
two-statement blocks produce binary choices based on attribute
mastery patterns. In each block, selecting the first statement has
probability when its condensed mastery is lower than the
second statement's, when they are equal, and
when it is higher.
sim.data.FCDCM( N.person = 1000, N.block = 10, D = 3, dcm.type = "DINA", control = NULL )sim.data.FCDCM( N.person = 1000, N.block = 10, D = 3, dcm.type = "DINA", control = NULL )
N.person |
Integer; number of persons (default: 1000). |
N.block |
Integer; number of forced-choice block pairs (default: 10). |
D |
Integer; number of attributes (default: 3, must be >= 2). |
dcm.type |
Character; |
control |
Optional list with entries |
An object of class "data.FCDCM" containing data,
response, theta, alpha, zeta, par,
Q.matrix, block.items,
prob, and data-generating arguments.
set.seed(123) sim <- sim.data.FCDCM(N.person = 20, N.block = 3, D = 2, dcm.type = "DINA") str(sim$data) head(sim$response) head(sim$alpha)set.seed(123) sim <- sim.data.FCDCM(N.person = 20, N.block = 3, D = 2, dcm.type = "DINA") str(sim$data) head(sim$response) head(sim$alpha)
Generates forced-choice response data from a cognitive diagnostic item
model. The item-level model may be DINA, DINO, ACDM, or GDINA. The resulting
statement endorsement probabilities are transformed into forced-choice
response probabilities for "RANK", "MOLE", or "PICK"
blocks using the same sequential Luce–Plackett mechanism used by
sim.data.FCMIRT and sim.data.FCGGUM.
sim.data.FCGDINA( N.person = 1000, N.block = 10, I.block = 2, D = 3, model = "GDINA", fc.type = "RANK", control = NULL )sim.data.FCGDINA( N.person = 1000, N.block = 10, I.block = 2, D = 3, model = "GDINA", fc.type = "RANK", control = NULL )
N.person |
Number of persons. |
N.block |
Number of forced-choice blocks. |
I.block |
Number of items per block when |
D |
Number of latent attributes. If |
model |
CDM item model: |
fc.type |
Forced-choice response type: |
control |
Optional named list controlling the data-generating process. Supported entries are described below. |
An object of class "data.FCGDINA", a list containing:
data character matrix of forced-choice
responses, such as "1>3>2" for ranking blocks.
response integer matrix of 1-based pattern
indices matching patterns.
alpha binary matrix of true latent
attribute profiles.
gs matrix of item probability bounds
P0 and P1.
delta.listList of true CDM delta vectors, one per statement.
design.matrix.listList of CDM design matrices used to map delta parameters to item endorsement probabilities.
Q.matrix Q-matrix.
block.itemsList of statement indices per forced-choice block.
modelCDM item model used for simulation.
patternsList of observed response-pattern matrices per block.
patterns.totalList of full-ranking pattern matrices per block.
prob.item matrix of item-level endorsement
probabilities for sampled persons.
prob.states matrix of item endorsement
probabilities for every attribute pattern.
prob matrix of forced-choice
response-pattern probabilities.
N.person, N.block, I.block, D,
I.states, fc.type
Final data-generating dimensions and response type.
call, arguments
Matched call and effective simulation arguments.
The simulation proceeds in four steps:
Generate or validate the Q-matrix and forced-choice block structure.
Generate latent attribute profiles .
Generate item-level CDM endorsement probabilities using guessing
and slipping-style bounds P0 and P1; then recover the
corresponding CDM delta parameters from the design matrix.
Convert item endorsement probabilities into block-level forced-choice pattern probabilities and sample observed responses.
Attribute profiles can be generated from a higher-order latent trait model,
a thresholded multivariate normal model, a uniform distribution over all
attribute patterns, or supplied directly through control$alpha.
Q.matrixOptional binary Q-matrix. If
omitted, a Q-matrix is generated by sim.data.Q.CDM().
block.itemsOptional list of item indices per block. If
omitted, blocks are formed sequentially using N.block and
I.block.
singleLogical passed to sim.data.Q.CDM() when
Q.matrix is generated internally. Default TRUE.
alphaOptional binary matrix of true
attribute profiles. If supplied, latent attributes are not
generated.
distributionLatent attribute distribution when
alpha is not supplied. Options are "horder"
(default; alias "higher.order"), "mvnorm", and
"uniform".
delta1, delta0, theta
Higher-order
discrimination, threshold, and person trait values used when
distribution = "horder". Defaults are generated from
log-normal, normal, and standard normal distributions.
Corr, threshold
Correlation matrix and thresholds
used when distribution = "mvnorm".
gsOptional matrix with columns
P0 and P1; P0 is the lower endorsement
probability and P1 is the upper endorsement probability for
each statement. Defaults are sampled from U(0, .2) and
U(.8, 1).
mono.constraintLogical; whether to enforce monotonic item
probabilities for GDINA item generation. Default TRUE.
de la Torre, J. (2011). The generalized DINA model framework. Psychometrika, 76(2), 179–199. doi:10.1007/s11336-011-9207-7
fit.FCGDINA, model.FCGDINA,
sim.data.FCMIRT, sim.data.FCGGUM,
sim.data.FCDCM
set.seed(123) sim <- sim.data.FCGDINA(N.person = 20, N.block = 3, I.block = 2, D = 2, model = "DINA", fc.type = "RANK") str(sim$data) head(sim$response) head(sim$alpha) sim$Q.matrix # Mixed response formats across blocks. sim.mix <- sim.data.FCGDINA( N.person = 12, N.block = 3, I.block = 3, D = 2, model = "GDINA", fc.type = c("RANK", "MOLE", "PICK") ) vapply(sim.mix$patterns, nrow, integer(1))set.seed(123) sim <- sim.data.FCGDINA(N.person = 20, N.block = 3, I.block = 2, D = 2, model = "DINA", fc.type = "RANK") str(sim$data) head(sim$response) head(sim$alpha) sim$Q.matrix # Mixed response formats across blocks. sim.mix <- sim.data.FCGDINA( N.person = 12, N.block = 3, I.block = 3, D = 2, model = "GDINA", fc.type = c("RANK", "MOLE", "PICK") ) vapply(sim.mix$patterns, nrow, integer(1))
Generates forced-choice ranking data using the GGUM ideal-point model as the
item-level endorsement process. Within-block rankings follow the same
sequential Luce/Plackett mechanism as model.FCGGUM: the
utility for each statement is the logit of its binary GGUM endorsement
probability.
sim.data.FCGGUM( N.person = 1000, N.block = 10, I.block = 2, D = 3, fc.type = "RANK", control = NULL )sim.data.FCGGUM( N.person = 1000, N.block = 10, I.block = 2, D = 3, fc.type = "RANK", control = NULL )
N.person |
Integer; number of persons (default: 1000). |
N.block |
Integer; number of forced-choice blocks (default: 10). |
I.block |
Integer; items per block (default: 2). |
D |
Integer; number of latent dimensions (default: 3, must be >= 2). |
fc.type |
Character; |
control |
Optional list with entries |
An object of class "data.FCGGUM" containing data,
response, theta, par, Q.matrix,
block.items, Corr, patterns, patterns.total,
prob, mask, and data-generating arguments.
set.seed(123) sim <- sim.data.FCGGUM(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") str(sim$data) head(sim$response) dim(sim$prob)set.seed(123) sim <- sim.data.FCGGUM(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") str(sim$data) head(sim$response) dim(sim$prob)
Simulates forced-choice ranking data using a MIRT item response model
("m1pl" through "m4pl") as the item-level endorsement model.
Forced-choice responses are generated by applying the sequential
Luce/Plackett choice rule to the logits of the item-level endorsement
probabilities, with RANK, MOLE, and PICK patterns handled by
model.FCMIRT.
For identification, item difficulty/intercept parameters b are
centered within each forced-choice block so that their block sum is zero.
sim.data.FCMIRT( N.person = 1000, N.block = 10, I.block = 2, D = 3, model = "m2pl", fc.type = "RANK", control = NULL )sim.data.FCMIRT( N.person = 1000, N.block = 10, I.block = 2, D = 3, model = "m2pl", fc.type = "RANK", control = NULL )
N.person |
Number of persons. |
N.block |
Number of forced-choice blocks. |
I.block |
Number of items per block when |
D |
Number of latent dimensions. If |
model |
MIRT model type: |
fc.type |
Forced-choice response type: |
control |
Optional list. Supported entries are |
An object of class "data.FCMIRT", a list containing
data, response, theta, par, Q.matrix,
block.items, Corr, model, patterns,
patterns.total, probability, prob, and
data-generating arguments.
set.seed(123) sim <- sim.data.FCMIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, model = "m2pl", fc.type = "RANK") str(sim$data) head(sim$response) dim(sim$prob)set.seed(123) sim <- sim.data.FCMIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, model = "m2pl", fc.type = "RANK") str(sim$data) head(sim$response) dim(sim$prob)
Generates polytomous responses from the same distance-based MGGUM
probability function used by model.MGGUM and
fit.MGGUM. For each item, active discriminations are drawn
from , active locations follow the sign of the Q-matrix,
, and the remaining values are ordered
negative thresholds.
sim.data.MGGUM( N = 500, I = 20, D = 2, length.poly = 5, Q.matrix = NULL, Corr = NULL )sim.data.MGGUM( N = 500, I = 20, D = 2, length.poly = 5, Q.matrix = NULL, Corr = NULL )
N |
Integer; number of examinees (default: 500). |
I |
Integer; number of items (default: 20). |
D |
Integer; number of latent dimensions (default: 2). |
length.poly |
Integer vector or scalar indicating the number of
categories for each item. A scalar is recycled to length |
Q.matrix |
Optional
The sign controls the item-location side, not the sign of discrimination.
If |
Corr |
Optional |
An object of class "data.MGGUM", a list containing:
data, response
integer response
matrices with categories coded from 0 to .
theta matrix of true latent traits.
par matrix of GGUM item
parameters: discrimination columns, location columns, and stacked
threshold columns.
probability matrix of stacked
category probabilities.
Q.matrix, length.poly, Corr
Design matrix, category counts, and latent correlation matrix used to generate the data.
N, I, D, call
Data-generating metadata.
Draw latent traits from
.
Generate discrimination, location, and threshold parameters under
the sign constraints encoded by Q.matrix.
Compute stacked category probabilities with
model.MGGUM.
Sample one ordinal response per person and item. A category can be
absent in a finite sample; length.poly retains the intended
support.
set.seed(123) sim <- sim.data.MGGUM(N = 20, I = 5, D = 2, length.poly = 4) str(sim$response) dim(sim$par) table(sim$response[, 1])set.seed(123) sim <- sim.data.MGGUM(N = 20, I = 5, D = 2, length.poly = 4) str(sim$response) dim(sim$par) table(sim$response[, 1])
Generates polytomous (multi-category) response data from the MGPCM.
Category probabilities use the same softmax formulation as
model.MGPCM: is proportional to
.
The requested category counts are retained even when a finite sample does
not contain every possible category.
sim.data.MGPCM( N = 500, I = 20, D = 2, length.poly = 5, Q.matrix = NULL, Corr = NULL, rotate = NULL, promax_m = 4 )sim.data.MGPCM( N = 500, I = 20, D = 2, length.poly = 5, Q.matrix = NULL, Corr = NULL, rotate = NULL, promax_m = 4 )
N |
Integer; number of examinees (default: 500). |
I |
Integer; number of items (default: 20). |
D |
Integer; number of latent dimensions (default: 2). |
length.poly |
Integer vector or scalar; number of categories per
item. Recycled to length |
Q.matrix |
Optional |
Corr |
Optional |
rotate |
Optional rotation method (GPArotation or
|
promax_m |
Power parameter for Promax (default: 4). |
An object of class "data.MGPCM", a list containing:
data, response
integer response
matrices with categories coded from 0 to .
theta matrix of true latent traits.
par matrix of item
parameters; discrimination columns are followed by category
intercept columns.
probability matrix of stacked
category probabilities.
Q.matrix, length.poly, Corr
Design matrix, category counts, and latent correlation matrix used to generate the data.
model, N, I, D, call
Data-generating metadata.
Latent traits:
.
Item parameters:
(active dimensions),
, and
are sorted draws from
used as category intercepts.
Responses:
for .
set.seed(123) sim <- sim.data.MGPCM(N = 20, I = 5, D = 2, length.poly = 4) str(sim$response) dim(sim$probability) sim$length.polyset.seed(123) sim <- sim.data.MGPCM(N = 20, I = 5, D = 2, length.poly = 4) str(sim$response) dim(sim$probability) sim$length.poly
Generates binary response data, latent trait vectors, and item parameters from the multidimensional extension of the 1PL–4PL item response models. The latent traits are drawn from a multivariate normal distribution with a user-specified correlation matrix. Discrimination parameters respect a Q-matrix structure and may be optionally rotated.
sim.data.MIRT( N = 500, I = 20, D = 2, model = "m2pl", Q.matrix = NULL, Corr = NULL, rotate = NULL, promax_m = 4 )sim.data.MIRT( N = 500, I = 20, D = 2, model = "m2pl", Q.matrix = NULL, Corr = NULL, rotate = NULL, promax_m = 4 )
N |
Integer; number of examinees (default: 500). |
I |
Integer; number of items (default: 20). |
D |
Integer; number of latent dimensions (default: 2). |
model |
Character; one of |
Q.matrix |
An optional |
Corr |
An optional |
rotate |
Optional rotation method name (passed to
GPArotation or |
promax_m |
Integer; power parameter for |
An object of class "data.MIRT", a list containing:
data, response
binary response
matrix (identical).
theta matrix of true latent trait
values.
par matrix of true item parameters
(columns a1..aD, b, c, d).
probability matrix of response
probabilities.
Q.matrix Q-matrix used.
Corr correlation matrix.
model, N, I, D
Data-generating parameters.
Latent traits:
,
where is the correlation
matrix Corr.
Item parameters:
for
(M2PL/M3PL/M4PL);
for all items and dimensions in M1PL.
(difficulty).
(lower asymptote; M3PL/M4PL only).
(upper asymptote; M4PL only).
Response probabilities:
per the
specified MIRT model (see fit.MIRT for the IRF
equations).
Binary responses:
.
Optional rotation of the loading matrix a and corresponding
transformation of theta and Corr is applied before
response generation.
fit.MIRT for fitting the MIRT model,
model.MIRT for computing response probabilities.
# Basic 2D 2PL simulation sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") # With correlated factors and rotation Corr <- matrix(c(1, 0.5, 0.5, 1), 2, 2) sim_rot <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl", Q.matrix = matrix(1, 6, 2), Corr = Corr, rotate = "oblimin") # Fit the simulated data fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) cor(fit$theta$est, sim$theta) # trait recovery# Basic 2D 2PL simulation sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") # With correlated factors and rotation Corr <- matrix(c(1, 0.5, 0.5, 1), 2, 2) sim_rot <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl", Q.matrix = matrix(1, 6, 2), Corr = Corr, rotate = "oblimin") # Fit the simulated data fit <- fit.MIRT( sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE) ) cor(fit$theta$est, sim$theta) # trait recovery
Generates forced-choice pairwise comparison data under the Thurstonian
IRT framework. Each statement loads on exactly one latent dimension;
pairwise latent differences with probit link determine binary outcomes.
Supports RANK, MOLE, and PICK response types. For each pair ,
the simulated comparison uses
, with
.
sim.data.TIRT( N.person = 1000, N.block = 10, I.block = 2, D = 3, fc.type = "RANK", control = NULL )sim.data.TIRT( N.person = 1000, N.block = 10, I.block = 2, D = 3, fc.type = "RANK", control = NULL )
N.person |
Integer; number of persons (default: 1000). |
N.block |
Integer; number of blocks (default: 10). |
I.block |
Integer; items per block (default: 2). |
D |
Integer; number of latent dimensions (default: 3, >= 2). |
fc.type |
Character; |
control |
Optional list with entries |
An object of class "data.TIRT" containing data,
response, theta, par, Q.matrix,
block.items, Corr, gamma.matrix, lambda,
psi2, pairs.value, and data-generating arguments.
set.seed(123) sim <- sim.data.TIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") str(sim$data) head(sim$response) dim(sim$Q.matrix)set.seed(123) sim <- sim.data.TIRT(N.person = 20, N.block = 3, I.block = 2, D = 2, fc.type = "RANK") str(sim$data) head(sim$response) dim(sim$Q.matrix)
Generates structured, comprehensive summaries of objects produced by the ForceChoice package. This generic function dispatches to class-specific methods that extract and organize key information including model configurations, fit statistics, parameter estimates, and convergence diagnostics. Designed for programmatic access and downstream reporting.
## S3 method for class 'good.of.fit' summary(object, digits = 4, ...) ## S3 method for class 'MIRT' summary(object, digits = 4, ...) ## S3 method for class 'MGPCM' summary(object, digits = 4, ...) ## S3 method for class 'MGGUM' summary(object, digits = 4, ...) ## S3 method for class 'FCMIRT' summary(object, digits = 4, ...) ## S3 method for class 'FCDCM' summary(object, digits = 4, ...) ## S3 method for class 'FCGDINA' summary(object, digits = 4, ...) ## S3 method for class 'FCGGUM' summary(object, digits = 4, ...) ## S3 method for class 'TIRT' summary(object, digits = 4, ...)## S3 method for class 'good.of.fit' summary(object, digits = 4, ...) ## S3 method for class 'MIRT' summary(object, digits = 4, ...) ## S3 method for class 'MGPCM' summary(object, digits = 4, ...) ## S3 method for class 'MGGUM' summary(object, digits = 4, ...) ## S3 method for class 'FCMIRT' summary(object, digits = 4, ...) ## S3 method for class 'FCDCM' summary(object, digits = 4, ...) ## S3 method for class 'FCGDINA' summary(object, digits = 4, ...) ## S3 method for class 'FCGGUM' summary(object, digits = 4, ...) ## S3 method for class 'TIRT' summary(object, digits = 4, ...)
object |
An object of one of the following classes:
|
digits |
Number of decimal places for numeric output (default: 4). Applied uniformly across all methods. |
... |
Additional arguments passed to or from other methods (currently ignored). |
Each method returns a named list with class-specific components optimized for structured access and formatted printing:
Returns a summary.<Class> object with components:
callOriginal function call.
model.infoList: family, description,
D, method, and model-specific fields (model,
fc.type, dcm.type, I.states, N.block).
data.infoList: N, I or B,
response.type.
fit.statsList: LogLik, npar,
AIC, BIC.
par.summaryMatrix: parameter summary (Min, Q1, Median, Mean, Q3, Max) across items/statements/blocks for each parameter type.
theta.summaryMatrix: person parameter summary per dimension.
CorrMatrix: factor inter-trait correlation matrix (where applicable).
convergenceList: algorithm, batch counts, convergence
flags, latent grid length L (iStEM) or diagnostic note (Stan).
digitsNumeric: precision used for formatting.
Additional model-specific components:
delta.summaryFCDCM only: higher-order delta parameters.
classificationFCDCM only: observed attribute patterns, mean maximum posterior.
lambda.summaryTIRT only: factor loading summary.
good.of.fit)Returns a summary.good.of.fit object with components:
Sample_Size, Items, Response_Type,
Parameters, Moments, LogLik,
Deviance
Overview statistics.
ICNamed vector: AIC, AICc, BIC, CAIC, SABIC, HQIC.
M2List: M2 statistic, df, p-value, RMSEA with CI.
Residual_FitNamed vector: SRMSR, RMSR, max standardized residual.
Comparative_FitNamed vector: CFI, TLI, IFI.
Pseudo_R2Named vector: McFadden, Cox–Snell, Nagelkerke, Aldrich–Nelson, Veall–Zimmermann.
Local_DependenceNamed vector: Q3 mean, max, adjusted max, P95.
ClassificationNamed vector: posterior entropy, max posterior.
Null_ModelNamed vector: null model LogLik, deviance, M2, df.
tablesList of data frames for formatted printing.
Invisibly returns a structured list containing summary components.
The exact structure depends on the class of object. All returned
objects carry an appropriate S3 class (e.g., "summary.MIRT",
"summary.good.of.fit") for use with corresponding print
methods.
summary(good.of.fit): Summary method for good.of.fit objects.
Extracts and structures all fit indices: information criteria,
limited-information M2, RMSEA, SRMSR, CFI/TLI/IFI, pseudo-,
local dependence (Yen's Q3), posterior classification, and null-model
diagnostics.
summary(MIRT): Summary method for MIRT objects.
Multidimensional IRT (1PL–4PL): extracts binary-response model
configuration, fit statistics (LogLik, AIC, BIC), factor correlation
matrix, person and item parameter summaries, and convergence
diagnostics.
summary(MGPCM): Summary method for MGPCM objects.
Multidimensional Generalized Partial Credit Model: polytomous
responses with category-specific step parameters.
summary(MGGUM): Summary method for MGGUM objects.
Multidimensional Generalized Graded Unfolding Model: ideal-point
polytomous responses with discrimination (a), location (delta), and
threshold (tau) parameters.
summary(FCMIRT): Summary method for FCMIRT objects.
Forced-Choice Multidimensional IRT: dominance model with sequential
ranking over item endorsement logits at the block level. Extracts
block configuration, FC type
(RANK/MOLE/PICK), and statement-level parameter summaries.
summary(FCDCM): Summary method for FCDCM objects.
Forced-Choice Diagnostic Classification Model: higher-order trait with
exact marginalization over attribute profiles. Extracts
DCM type (DINA/DINO), higher-order delta parameters, block eta
parameters, and posterior classification diagnostics.
summary(FCGDINA): Summary method for FCGDINA objects.
Forced-Choice GDINA model: CDM item model (DINA/DINO/ACDM/GDINA) with
sequential forced-choice ranking over item endorsement logits.
summary(FCGGUM): Summary method for FCGGUM objects.
Forced-Choice Generalized Graded Unfolding Model: ideal-point model
with sequential ranking over binary GGUM endorsement logits. Extracts
forced-choice block structure, unfolding parameters (a, delta, tau),
and convergence info.
summary(TIRT): Summary method for TIRT objects.
Thurstonian IRT for Forced-Choice: pairwise probit comparison of latent
utility differences. Extracts statement loadings (lambda), uniquenesses
(psi2), pairwise gamma matrix, and factor correlations.
A synthetic forced-choice data set containing pairwise comparison responses for the first 200 of 2000 participants on four triplets. The data were originally generated as part of Brown and Maydeu-Olivares (2012) and are distributed in the published R package thurstonianIRT.
In each triplet, participants ranked three alternative statements according to their preference. The rankings were then converted into dichotomous pairwise responses for all three within-triplet comparisons.
A data frame with 200 rows and 12 integer columns. Values are 0/1 pairwise preference indicators. Overall, the 12 statements measure three traits. Items 1, 4, 7, and 10 load on trait 1; items 2, 5, 8, and 11 load on trait 2; and items 3, 6, 9, and 12 load on trait 3. Items 4, 9, and 11 are reverse-keyed.
Response preference between item 1 and item 2.
Response preference between item 1 and item 3.
Response preference between item 2 and item 3.
Response preference between item 4 and item 5.
Response preference between item 4 and item 6.
Response preference between item 5 and item 6.
Response preference between item 7 and item 8.
Response preference between item 7 and item 9.
Response preference between item 8 and item 9.
Response preference between item 10 and item 11.
Response preference between item 10 and item 12.
Response preference between item 11 and item 12.
Brown, A. & Maydeu-Olivares, A. (2012). Fitting a Thurstonian IRT model to forced-choice data using Mplus. Behavior Research Methods, 44, 1135-1147. doi:10.3758/s13428-012-0217-x
The data file was taken from the published R package thurstonianIRT.
data("triplets") dim(triplets) head(triplets)data("triplets") dim(triplets) head(triplets)
The update function provides a unified and convenient interface to
re-fit ForceChoice models with modified parameter settings while
preserving all other original configurations. It allows users to change
the estimation method, adjust control parameters, increase dimensionality,
or switch model specifications without re-specifying the entire call.
## S3 method for class 'MIRT' update(object, ...) ## S3 method for class 'MGPCM' update(object, ...) ## S3 method for class 'MGGUM' update(object, ...) ## S3 method for class 'FCMIRT' update(object, ...) ## S3 method for class 'FCDCM' update(object, ...) ## S3 method for class 'FCGDINA' update(object, ...) ## S3 method for class 'FCGGUM' update(object, ...) ## S3 method for class 'TIRT' update(object, ...)## S3 method for class 'MIRT' update(object, ...) ## S3 method for class 'MGPCM' update(object, ...) ## S3 method for class 'MGGUM' update(object, ...) ## S3 method for class 'FCMIRT' update(object, ...) ## S3 method for class 'FCDCM' update(object, ...) ## S3 method for class 'FCGDINA' update(object, ...) ## S3 method for class 'FCGGUM' update(object, ...) ## S3 method for class 'TIRT' update(object, ...)
object |
An object of one of the following classes:
|
... |
Additional named arguments passed to override or extend the
original call. Valid arguments depend on the class of |
Internally, each method extracts the stored arguments list from
the input object, merges it with user-provided ... using
modifyList, explicitly merges control lists from the
previous fit and the update call, filters to only the formal parameters of
the target fit.*() function, then re-invokes the fitting function
via do.call.
This ensures that:
Only explicitly overridden parameters are changed.
Default values from the original call remain intact.
Complex nested structures (e.g., control.model,
control.method, and control lists) can be partially
updated.
Internal arguments (e.g., cores, vis, seed)
are passed through to the method controls.
An object of the same class as object, re-fitted using the
original arguments updated with any provided in .... All
unchanged parameters are preserved from the original call.
update(MIRT): Update method for MIRT objects.
Re-fits the MIRT model with modified arguments. Supports changing
model (e.g., m2pl -> m3pl), method (iStEM -> Stan),
D, Q.matrix, control.model, and
control.method.
update(MGPCM): Update method for MGPCM objects.
Re-fits the MGPCM model with modified arguments.
update(MGGUM): Update method for MGGUM objects.
Re-fits the MGGUM model with modified arguments.
update(FCMIRT): Update method for FCMIRT objects.
Re-fits the FCMIRT model with modified arguments. Supports changing
model, method, fc.type, block.items,
and control settings.
update(FCDCM): Update method for FCDCM objects.
Re-fits the FCDCM model with modified arguments. Supports changing
dcm.type, method, block.items, and control
settings.
update(FCGDINA): Update method for FCGDINA objects.
Re-fits the FCGDINA model with modified arguments.
update(FCGGUM): Update method for FCGGUM objects.
Re-fits the FCGGUM model with modified arguments.
update(TIRT): Update method for TIRT objects.
Re-fits the TIRT model with modified arguments. Supports changing
fc.type, method, pairs.value, and control
settings.
sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT(sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) # stan code, long time # Switch to Stan estimation with more chains fit_stan <- update(fit, method = "stan", control.method = list(chains = 1, iter = 200)) # Change model to 3PL fit_3pl <- update(fit, model = "m3pl") # Adjust prior hyperparameters fit_prior <- update(fit, control.model = list(a.mu = 0.5, a.sigma = 0.5))sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "m2pl") fit <- fit.MIRT(sim$response, model = "m2pl", D = 2, method = "iStEM", control.method = list( vis = FALSE, seed = 123, M = 2, B = 2, burnin.maxitr = 2, maxitr = 3, eps1 = 10, eps2 = 10, estimate.se = FALSE)) # stan code, long time # Switch to Stan estimation with more chains fit_stan <- update(fit, method = "stan", control.method = list(chains = 1, iter = 200)) # Change model to 3PL fit_3pl <- update(fit, model = "m3pl") # Adjust prior hyperparameters fit_prior <- update(fit, control.model = list(a.mu = 0.5, a.sigma = 0.5))
Returns the variance–covariance matrix of the estimated model
parameters from a fitted ForceChoice model object. The package stores
marginal standard errors rather than a joint covariance estimate, so the
returned matrix is for every backend.
## S3 method for class 'MIRT' vcov(object, ...) ## S3 method for class 'MGPCM' vcov(object, ...) ## S3 method for class 'MGGUM' vcov(object, ...) ## S3 method for class 'FCMIRT' vcov(object, ...) ## S3 method for class 'FCDCM' vcov(object, ...) ## S3 method for class 'FCGDINA' vcov(object, ...) ## S3 method for class 'FCGGUM' vcov(object, ...) ## S3 method for class 'TIRT' vcov(object, ...)## S3 method for class 'MIRT' vcov(object, ...) ## S3 method for class 'MGPCM' vcov(object, ...) ## S3 method for class 'MGGUM' vcov(object, ...) ## S3 method for class 'FCMIRT' vcov(object, ...) ## S3 method for class 'FCDCM' vcov(object, ...) ## S3 method for class 'FCGDINA' vcov(object, ...) ## S3 method for class 'FCGGUM' vcov(object, ...) ## S3 method for class 'TIRT' vcov(object, ...)
object |
A fitted model object of class |
... |
Additional arguments (currently ignored). |
Standard errors reflect the active estimation backend. Off-diagonal
covariances are not retained in fitted objects and are therefore reported
as zero. Parameters whose standard errors were not estimated have
NA diagonal entries.
A square numeric matrix. Rows and columns correspond to the free model parameters in the package's canonical parameter map.
vcov(MIRT): Variance–covariance matrix of parameter estimates
for MIRT objects.
vcov(MGPCM): Variance–covariance matrix for MGPCM objects.
vcov(MGGUM): Variance–covariance matrix for MGGUM objects.
vcov(FCMIRT): Variance–covariance matrix for FCMIRT objects.
vcov(FCDCM): Variance–covariance matrix for FCDCM objects.
vcov(FCGDINA): Variance–covariance matrix for FCGDINA objects.
vcov(FCGGUM): Variance–covariance matrix for FCGGUM objects.
vcov(TIRT): Variance–covariance matrix for TIRT objects.