extract | R Documentation |
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.
extract(object, what, ...)
## S3 method for class 'CDM'
extract(object, what, ...)
## S3 method for class 'validation'
extract(object, what, ...)
## S3 method for class 'sim.data'
extract(object, what, ...)
## S3 method for class 'fit'
extract(object, what, ...)
object |
An object of class |
what |
A character string specifying the name of the component to extract. |
... |
Additional arguments (currently ignored). |
This generic extractor supports three core object classes: CDM
, validation
,
sim.data
and fit
.
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:
The internal model fitting object (e.g., GDINA or Baseline Model).
Estimated attribute profiles (EAP estimates) for each respondent.
Posterior distribution of latent attribute patterns.
Marginal attribute mastery probabilities (estimated).
Prior attribute probabilities at convergence.
Negative twice the marginal log-likelihood (model deviance).
Number of free parameters estimated in the model.
Akaike Information Criterion.
Bayesian Information Criterion.
The original model-fitting function call.
Can extract
corresponding value from the GDINA
object.
validation
Q-matrix validation results. Available components:
The original Q-matrix submitted for validation.
The suggested (revised) Q-matrix after validation.
Total computation time for the validation procedure.
Log of Q-matrix modifications across iterations.
Number of iterations performed during validation.
Attribute priority matrix (available for PAA-based methods only).
Data required to plot the Hull method results (for Hull-based validation only).
The original function call used for validation.
sim.data
Simulated data and parameters used in cognitive diagnosis simulation studies:
Simulated dichotomous response matrix (N \times I
).
Q-matrix used to generate the data.
True latent attribute profiles (N \times K
).
Item-category conditional success probabilities (list format).
Item-level delta parameters (list format).
Higher-order model parameters (if used).
Parameters for the multivariate normal attribute distribution (if used).
Latent class-based success probability matrix.
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):
The number of parameters.
The Deviance.
The Akaike information criterion.
The Bayesian information criterion.
The consistent Akaike information criterion.
The Sample-size Adjusted BIC.
A vector consisting of M_2
statistic, degrees of freedom, significance level, and RMSEA_2
(Liu, Tian, & Xin, 2016).
The standardized root mean squared residual (SRMSR; Ravand & Robitzsch, 2018).
The requested component. The return type depends on the specified what
and the class of the object
.
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
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.
library(Qval)
set.seed(123)
################################################################
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.