Learn R Programming

Qval (version 1.2.4)

extract: Extract Components from Qval Package Objects

Description

A unified extractor function for retrieving internal components from objects produced by the Qval package. This method allows users to access key elements such as model results, validation logs, and simulation settings in a structured and object-oriented manner.

Usage

extract(object, what, ...)

# S3 method for CDM extract(object, what, ...)

# S3 method for validation extract(object, what, ...)

# S3 method for sim.data extract(object, what, ...)

# S3 method for fit extract(object, what, ...)

# S3 method for is.Qident extract(object, what, ...)

# S3 method for att.hierarchy extract(object, what, ...)

Value

The requested component. The return type depends on the specified what and the class of the object.

Arguments

object

An object of class CDM, validation, sim.data, fit, is.Qident, att.hierarchy.

what

A character string specifying the name of the component to extract.

...

Additional arguments (currently ignored).

Methods (by class)

  • extract(CDM): Extract fields from a CDM object

  • extract(validation): Extract fields from a validation object

  • extract(sim.data): Extract fields from a sim.data object

  • extract(fit): Extract fields from a fit object

  • extract(is.Qident): Extract fields from a is.Qident object

  • extract(att.hierarchy): Extract fields from a att.hierarchy object

Details

This generic extractor supports three core object classes: CDM, validation, sim.data, fit, is.Qident, att.hierarchy. It is intended to streamline access to commonly used internal components without manually referencing object slots. The available components for each class are listed below:

CDM

Cognitive Diagnosis Model fitting results. Available components:

analysis.obj

The internal model fitting object (e.g., GDINA or Baseline Model).

alpha

Estimated attribute profiles (EAP estimates) for each respondent.

P.alpha.Xi

Posterior distribution of latent attribute patterns.

alpha.P

Marginal attribute mastery probabilities (estimated).

P.alpha

Prior attribute probabilities at convergence.

pattern

The attribute mastery pattern matrix containing all possible attribute mastery pattern.

Deviance

Negative twice the marginal log-likelihood (model deviance).

npar

Number of free parameters estimated in the model.

AIC

Akaike Information Criterion.

BIC

Bayesian Information Criterion.

call

The original model-fitting function call.

...

Can extract corresponding value from the GDINA object.

validation

Q-matrix validation results. Available components:

Q.orig

The original Q-matrix submitted for validation.

Q.sug

The suggested (revised) Q-matrix after validation.

time.cost

Total computation time for the validation procedure.

process

Log of Q-matrix modifications across iterations.

iter

Number of iterations performed during validation.

priority

Attribute priority matrix (available for PAA-based methods only).

Hull.fit

Data required to plot the Hull method results (for Hull-based validation only).

call

The original function call used for validation.

sim.data

Simulated data and parameters used in cognitive diagnosis simulation studies:

dat

Simulated dichotomous response matrix (\(N \times I\)).

Q

Q-matrix used to generate the data.

attribute

True latent attribute profiles (\(N \times K\)).

catprob.parm

Item-category conditional success probabilities (list format).

delta.parm

Item-level delta parameters (list format).

higher.order.parm

Higher-order model parameters (if used).

mvnorm.parm

Parameters for the multivariate normal attribute distribution (if used).

LCprob.parm

Latent class-based success probability matrix.

call

The original function call that generated the simulated data.

fit

Relative fit indices (-2LL, AIC, BIC, CAIC, SABIC) and absolute fit indices (\(M_2\) test, \(RMSEA_2\), SRMSR):

npar

The number of parameters.

-2LL

The Deviance.

AIC

The Akaike information criterion.

BIC

The Bayesian information criterion.

CAIC

The consistent Akaike information criterion.

SABIC

The Sample-size Adjusted BIC.

M2

A vector consisting of \(M_2\) statistic, degrees of freedom, significance level, and \(RMSEA_2\) (Liu, Tian, & Xin, 2016).

SRMSR

The standardized root mean squared residual (SRMSR; Ravand & Robitzsch, 2018).

is.Qident

Results of whether the Q-matrix is identifiable:

completeness

TRUE if \(K \times K\) identity submatrix exists.

distinctness

TRUE if remaining columns are distinct.

repetition

TRUE if every attribute appears more than 3 items.

genericCompleteness

TRUE if two different generic complete \(K \times K\) submatrices exist.

genericRepetition

TRUE if at least one '1' exists outside those submatrices.

Q1, Q2

Identified generic complete submatrices (if found).

Q.star

Remaining part after removing rows in Q1 and Q2.

locallyGenericIdentifiability

TRUE if local generic identifiability holds.

globallyGenericIdentifiability

TRUE if global generic identifiability holds.

Q.reconstructed.DINA

Reconstructed Q-matrix with low-frequency attribute moved to first column.

att.hierarchy

Results of iterative attribute hierarchy exploration:

noSig

TRUE all structural parameters are not greater than 0.

isNonverge

TRUE if convergence was achieved.

statistic

A 4-column data.frame results for each structural parameter that is significantly larger than 0.

pattern

The attribute pattern matrix under iterative attribute hierarchy.

References

Khaldi, R., Chiheb, R., & Afa, A.E. (2018). Feed-forward and Recurrent Neural Networks for Time Series Forecasting: Comparative Study. In: Proceedings of the International Conference on Learning and Optimization Algorithms: Theory and Applications (LOPAL 18). Association for Computing Machinery, New York, NY, USA, Article 18, 1–6. DOI: 10.1145/3230905.3230946.

Liu, Y., Tian, W., & Xin, T. (2016). An application of M2 statistic to evaluate the fit of cognitive diagnostic models. Journal of Educational and Behavioral Statistics, 41, 3–26. DOI: 10.3102/1076998615621293.

Ravand, H., & Robitzsch, A. (2018). Cognitive diagnostic model of best choice: a study of reading comprehension. Educational Psychology, 38, 1255–1277. DOI: 10.1080/01443410.2018.1489524.

Examples

Run this code
library(Qval)
set.seed(123)

# \donttest{
################################################################
# Example 1: sim.data extraction                               #
################################################################
Q <- sim.Q(3, 10)
data.obj <- sim.data(Q, N = 200)
extract(data.obj, "dat")


################################################################
# Example 2: CDM extraction                                    #
################################################################
CDM.obj <- CDM(data.obj$dat, Q)
extract(CDM.obj, "alpha")
extract(CDM.obj, "AIC")


################################################################
# Example 3: validation extraction                             #
################################################################
validation.obj <- validation(data.obj$dat, Q, CDM.obj)
Q.sug <- extract(validation.obj, "Q.sug")
print(Q.sug)


################################################################
# Example 4: fit extraction                                    #
################################################################
fit.obj <- fit(data.obj$dat, Q.sug, model="GDINA")
extract(fit.obj, "M2")
# }

Run the code above in your browser using DataLab