| Title: | Bayesian Estimation of an Exploratory Deterministic Input, Noisyand Gate Model |
| Version: | 0.1.2 |
| Description: | Perform a Bayesian estimation of the exploratory deterministic input, noisy and gate (EDINA) cognitive diagnostic model described by Chen et al. (2018) <doi:10.1007/s11336-017-9579-4>. |
| URL: | https://github.com/tmsalab/edina,https://tmsalab.github.io/edina/ |
| BugReports: | https://github.com/tmsalab/edina/issues |
| License: | GPL-2 |GPL-3 [expanded from: GPL (≥ 2)] |
| Depends: | R (≥ 4.3.0) |
| Imports: | Rcpp (≥ 1.1.0), ggplot2, jjb, reshape2 |
| LinkingTo: | Rcpp, RcppArmadillo (≥ 15.0.2-2), rgen |
| Suggests: | simcdm |
| RoxygenNote: | 7.3.3 |
| Encoding: | UTF-8 |
| Language: | en-US |
| NeedsCompilation: | yes |
| Packaged: | 2025-09-27 04:23:45 UTC; ronin |
| Author: | James Joseph Balamuta |
| Maintainer: | James Joseph Balamuta <balamut2@illinois.edu> |
| Repository: | CRAN |
| Date/Publication: | 2025-09-27 04:40:02 UTC |
edina: Bayesian Estimation of an Exploratory Deterministic Input, Noisy and Gate Model
Description
Perform a Bayesian estimation of the exploratory deterministic input, noisy and gate (EDINA) cognitive diagnostic model described by Chen et al. (2018)doi:10.1007/s11336-017-9579-4.
Author(s)
Maintainer: James Joseph Balamutabalamut2@illinois.edu (ORCID) [copyright holder]
Authors:
Steven Andrew Culpeppersculpepp@illinois.edu (ORCID) [copyright holder]
Jeffrey A. Douglasjeffdoug@illinois.edu
See Also
Useful links:
Report bugs athttps://github.com/tmsalab/edina/issues
Bayesian Information Criterion (BIC)
Description
Calculate BIC for EDINA models.
Usage
## S3 method for class 'edina'BIC(object, ...)Arguments
object | An |
... | Not used. |
Value
The BIC value of the given model.
BIC Computation Procedure
BIC = -2 \log p\left( {\mathbf{y}| \mathbf{\hat{\theta}} } \right) + ((k+2)*j + 2^k)\log(n)
See Also
Deviance Information Criterion (DIC)
Description
Calculate DIC for EDINA models.
Usage
DIC(object, ...)## S3 method for class 'edina'DIC(object, ...)Arguments
object | An |
... | Not used. |
Value
The DIC value of the given model.
DIC Computation Procedure
DIC = -2\left({\log p\left( {\mathbf{y}| \mathbf{\hat{\theta}} } \right) - 2\left( {\log p\left( {\mathbf{y}| \mathbf{\hat{\theta}} } \right) - \frac{1}{N}\sum\limits_{n = 1}^N {\log p\left( {\mathbf{y}|{\mathbf{\theta} _s}} \right)} } \right)} \right)
See Also
Posterior Predictive Probabilities (PPPs)
Description
Computes posterior predictive probabilities (PPPs) based on theodds ratios for each pair of items.
Usage
PPP(object, ...)## S3 method for class 'edina'PPP(object, alpha = 0.05, ...)Arguments
object | An |
... | Not used. |
alpha | Defining region to indicate the level of extremenessthe data must before the model is problematic. |
Details
PPPs that smaller than 0.05 or greater than 0.95 tend to be extreme andevidence of misfit. As a result, this is more of a heuristic metric.
Value
The PPP value given the specifiedalpha value.
PPP Computation Procedure
simulate observed responses
\mathbf Y^{(r)}using model parametersfrom iterationrof the MCMC samplercomputing the odds ratio for each pair of items at iteration
rasOR^{(r)} = n_{11}^{(r)}n_{00}^{(r)}/\left(n_{10}^{(r)}n_{01}^{(r)}\right),where
n_{11}^{(r)}is the frequency of ones on both variables atiterationr,n_{10}^{(r)}is the frequency of ones on thefirst item and zeros on the second at iterationr, etc.; andcomputing PPPs for each item pair as the proportion of generated
OR^{(r)}'s that exceeded elements of the observed odds ratios.
Coercedata.frame andmatrix classes to Q Matrix.
Description
as.q_matrix acts as an aliases.
Usage
as_q_matrix(x, ...)## S3 method for class 'data.frame'as_q_matrix(x, ...)## S3 method for class 'matrix'as_q_matrix(x, ...)## Default S3 method:as_q_matrix(x, ...)Arguments
x | Either a |
... | Not used |
Value
Aq_matrix object.'
See Also
Examples
# Q matrix valuesx = matrix(c(1, 0, 0, 1), nrow = 2)# Construct classq_mat = as_q_matrix(x)Auto EDINA model selection routine
Description
Automatically select an appropriateK dimension for aQ matrixunder the Exploratory Deterministic Input, Noise And gate (EDINA) Model.
Usage
auto_edina(data, k = 2:4, burnin = 10000, chain_length = 20000)Arguments
data | Binary responses to assessments in |
k | Number of Attribute Levels as a positive |
burnin | Number of Observations to discard on the chain. |
chain_length | Length of the MCMC chain |
Value
Anauto_edina object that contains:
edina_models: A list containing all estimatededinamodel objects.criterions: Information criterions calculated for each modelk_checked: Varyingkdimensions checked.j: Number of Items
See Also
autoplot.auto_edina(),best_model(),model_selection_graph(),parameter_evolution_graph()
Examples
if(requireNamespace("simcdm", quietly = TRUE)) {# Set a seed for reproducibilityset.seed(1512)# Setup data simulation parametersN = 15 # Number of Examinees / SubjectsJ = 10 # Number of ItemsK = 2 # Number of Skills / Attributes# Note:# Sample size and attributes have been reduced to create a minimally# viable example that can be run during CRAN's automatic check.# Please make sure to have a larger sample size...# Assign slipping and guessing values for each itemss = gs = rep(.2, J)# Simulate an identifiable Q matrixQ = simcdm::sim_q_matrix(J, K)# Simulate subject attributessubject_alphas = simcdm::sim_subject_attributes(N, K)# Simulate items under the DINA modelitems_dina = simcdm::sim_dina_items(subject_alphas, Q, ss, gs)# Requires at least 15 seconds of execution time.# Three EDINA models will be fit with increasing number of attributes.model_set_edina = auto_edina(items_dina, k = 2:4)# Display resultsmodel_set_edina# Retrieve criterion tabletable = summary(model_set_edina)# Extract "best model"best_model(model_set_edina)}Graph the Auto EDINA Object
Description
Presents either the fitting of model heuristics or the evolution of parameterson a graph
Usage
## S3 method for class 'auto_edina'autoplot( object, type = c("selection", "guessing", "slipping", "evolution"), ...)Arguments
object | An |
type | Kind of graph to display. Valid types: |
... | Not used. |
Value
Aggplot2 object.
See Also
auto_edina(),best_model(),model_selection_graph(),parameter_evolution_graph()
Examples
if(requireNamespace("simcdm", quietly = TRUE)) {# Set a seed for reproducibilityset.seed(1512)# Setup data simulation parametersN = 2 # Number of Examinees / SubjectsJ = 10 # Number of ItemsK = 2 # Number of Skills / Attributes# Note:# Sample size and attributes have been reduced to create a minimally# viable example that can be run during CRAN's automatic check.# Please make sure to have a larger sample size...# Assign slipping and guessing values for each itemss = gs = rep(.2, J)# Simulate an identifiable Q matrixQ = simcdm::sim_q_matrix(J, K)# Simulate subject attributessubject_alphas = simcdm::sim_subject_attributes(N, K)# Simulate items under the DINA modelitems_dina = simcdm::sim_dina_items(subject_alphas, Q, ss, gs)# Requires at least 15 seconds of execution time.# Three EDINA models will be fit with increasing number of attributes.model_set_edina = auto_edina(items_dina, k = 2:4)# Visualize results resultsautoplot(model_set_edina, type = "selection")# Equivalent to:model_selection_graph(model_set_edina)# View model parametersautoplot(model_set_edina, type = "guessing")# Or directly call with:parameter_evolution_graph(model_set_edina, type = "guessing")}Extract the Best Model
Description
Extracts the best model from theauto_*() search procedure.
Usage
best_model(x, ...)## S3 method for class 'auto_edina'best_model(x, ic = c("ppp", "bic", "dic"), ...)Arguments
x | An |
... | Not used. |
ic | Information criterion name. Default |
Value
Anedina model object corresponding to the smallest value of requestedinformation criterion.
See Also
DIC.edina(),BIC.edina(),PPP.edina()
EDINA Estimation Routine
Description
Performs the Exploratory Deterministic Input, Noise and Gate Model (EDINA)estimation on a given data set with a prespecifiedk value.
Usage
edina(data, k = 3, burnin = 10000, chain_length = 20000)Arguments
data | Binary responses to assessments in |
k | Number of Attribute Levels as a positive |
burnin | Number of Observations to discard on the chain. |
chain_length | Length of the MCMC chain |
Value
Anedina object that contains:
coefficients: Estimated coefficients of the model fitloglike_summed: Summed log-likelihoodloglike_pmean: Mean of log-likelihoodpi_classes: Latent classesavg_q: Estimated Averaged Q Matrixest_q: Estimated Dichotomous Q Matrixor_tested: Odds Ratio used in the model selection.sample_or: Odds Ratio for the sample.n: Number of Observationsj: Number of Itemsk: Number of Traitsburnin: Amount of iterations to discardchain_length: Amount of iterations to retain.timing: Duration of the rundataset_name: Name of the data set used in estimation.
See Also
auto_edina(),summary.edina(),print.edina()
Examples
if(requireNamespace("simcdm", quietly = TRUE)) {# Set a seed for reproducibilityset.seed(1512)# Setup data simulation parametersN = 1 # Number of Examinees / SubjectsJ = 10 # Number of ItemsK = 2 # Number of Skills / Attributes# Note:# Sample size and attributes have been reduced to create a minimally# viable example that can be run during CRAN's automatic check.# Please make sure to have a larger sample size...# Assign slipping and guessing values for each itemss = gs = rep(.2, J)# Simulate an identifiable Q matrixQ = simcdm::sim_q_matrix(J, K)# Simulate subject attributessubject_alphas = simcdm::sim_subject_attributes(N, K)# Simulate items under the DINA modelitems_dina = simcdm::sim_dina_items(subject_alphas, Q, ss, gs)# Compute the edina modeledina_model = edina(items_dina, k = K)# Display resultsedina_model# Provide a summary overviewsummary(edina_model)}Extract Q Matrix
Description
Given a modeling object, extract the Q Matrix
Usage
extract_q_matrix(x, ...)## S3 method for class 'q_matrix'extract_q_matrix(x, ...)## S3 method for class 'edina'extract_q_matrix(x, binary = TRUE, ...)## Default S3 method:extract_q_matrix(x, ...)Arguments
x | An |
... | Additional parameters |
binary | Boolean to indicate whether theQ matrix is shown indichotomous form or in an estimated form. |
Value
Amatrix that is either dichotomous or estimated depending on the valueof thebinary parameter.
See Also
q_matrix(),as_q_matrix(),edina(),auto_edina()
Examples
# Q matrix valuesx = matrix(c(1, 0, 0, 1), nrow = 2)# Show Q matrix structureQ = q_matrix(x)# Retrieve Q matrixextract_q_matrix(Q)View Model Selection Statistics Across Models
Description
Displays information about the value of each model information criterionfor a given model across the dimensions the Q matrix is estimated.
Usage
model_selection_graph(x, ...)Arguments
x | An |
... | Not used |
Value
Aggplot2 object
See Also
View Slipping and Guessing Parameter Changes Across Models
Description
Displays the slipping and guessing parameter changes for each model acrossthe dimensions the Q matrix is estimated.
Usage
parameter_evolution_graph(x, ...)Arguments
x | An |
... | Not used |
Value
Aggplot2 object
See Also
Print method forauto_edina
Description
Custom print method for displaying the results of the Auto EDINA method.
Usage
## S3 method for class 'auto_edina'print(x, ...)Arguments
x | An |
... | Additional values passed onto the |
Value
None.
The function provides a side-effect of displaying the overview ofcomputed results across all models estimated.
Printing out the EDINA Object
Description
Custom print method for computing the EDINA.
Usage
## S3 method for class 'edina'print(x, binary = FALSE, ...)Arguments
x | An |
binary | Boolean to indicate whether theQ matrix is shown indichotomous form or in an estimated form. |
... | Additional methods passed onto the |
Value
None.
The function provides a side-effect of displaying the overview ofthe model estimated.
Printing out a Q Matrix Object
Description
Custom print method for the Q Matrix Object.
Usage
## S3 method for class 'q_matrix'print(x, ...)Arguments
x | An |
... | Additional methods passed onto the |
Value
An invisiblematrix without theq_matrix class displayed as a partof the output displayed.
See Also
Examples
# Q matrix valuesx = matrix(c(1, 0, 0, 1), nrow = 2)# Show Q matrix structureq_matrix(x)Print theauto_edina model summary
Description
Custom method for displaying the results of thesummary(auto_edina).
Usage
## S3 method for class 'summary_auto_edina'print(x, ...)Arguments
x | A |
... | Additional values passed onto the |
Value
None.
The function provides a side-effect of displaying the overview ofcomputed results across all models estimated.
Printing out the Summary EDINA Object
Description
Custom print method for displaying the EDINA model summary information.
Usage
## S3 method for class 'summary_edina'print(x, binary = FALSE, ...)Arguments
x | A |
binary | Boolean to indicate whether theQ matrix is shown indichotomous form or in an estimated form. |
... | Past onto the |
Value
None.
The function provides a side-effect of displaying the overview ofthe model estimated.
Graph Q Matrix
Description
Provides a heatmap approach to showing the estimated binary or averagedvalues of the Q Matrix.
Usage
q_graph(x, ...)## S3 method for class 'auto_edina'q_graph(x, binary = TRUE, ic = c("ppp", "bic", "dic"), ...)## S3 method for class 'edina'q_graph(x, binary = TRUE, ...)## S3 method for class 'matrix'q_graph(x, ...)## S3 method for class 'q_matrix'q_graph(x, ...)Arguments
x | Either an |
... | Additional parameters not used |
binary | Boolean to indicate if a classified Q (dichotomous by decision rule)or an estimate Q (non-dichotomous) or should be shown.Default: |
ic | Information criterion name. Default |
Value
Aggplot2 object with a heatmap overview of the estimated Q matrix.
Examples
q = q_matrix(matrix(c(1, 0, 1, 1, 0, 1), ncol = 3))q_graph(q)Create a Q Matrix Object
Description
Provides a way to create an object as a"q_matrix".
Usage
q_matrix(x)Arguments
x | Either a |
Value
Aq_matrix object.
See Also
Examples
# Q matrix valuesx = matrix(c(1, 0, 0, 1), nrow = 2)# Q matrix wrapperq_mat = q_matrix(x)# Data Frame encoding of Qq_df = data.frame( k1 = c(1, 0), k2 = c(0, 1))# Create a Q matrixq_mat = q_matrix(q_df)Objects exported from other packages
Description
These objects are imported from other packages. Follow the linksbelow to see their documentation.
- ggplot2
Summarizeauto_edina model data
Description
Custom method for displaying the results of theauto_edina.
Usage
## S3 method for class 'auto_edina'summary(object, ...)Arguments
object | An |
... | Not used. |
Value
The originalauto_edina object with an added class ofsummary.auto_edina.
Summarize the EDINA Object
Description
Provide a more detailed view inside ofedina model object.
Usage
## S3 method for class 'edina'summary(object, alpha = 0.05, ...)Arguments
object | An |
alpha | Defining region to indicate the level of extremenessthe data must before the model is problematic. |
... | Not used. |
Value
A summary object that includes everything in the originaledina() objectand:
model_fit: Matrix of model fit summary statistics.alpha: Alpha-value used to computePPP()s.