Title: | 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>. |
Authors: | James Joseph Balamuta [aut, cre, cph] , Steven Andrew Culpepper [aut, cph] , Jeffrey A. Douglas [aut] |
Maintainer: | James Joseph Balamuta <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2024-11-13 06:35:43 UTC |
Source: | CRAN |
data.frame
and matrix
classes to Q Matrix.as.q_matrix
acts as an aliases.
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, ...)
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, ...)
x |
Either a |
... |
Not used |
A q_matrix
object.'
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Construct class q_mat = as_q_matrix(x)
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Construct class q_mat = as_q_matrix(x)
Automatically select an appropriate dimension for a
matrix
under the Exploratory Deterministic Input, Noise And gate (EDINA) Model.
auto_edina(data, k = 2:4, burnin = 10000, chain_length = 20000)
auto_edina(data, k = 2:4, burnin = 10000, chain_length = 20000)
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 |
An auto_edina
object that contains:
edina_models
: A list containing all estimated edina
model objects.
criterions
: Information criterions calculated for each model
k_checked
: Varying k
dimensions checked.
j
: Number of Items
autoplot.auto_edina()
,
best_model()
,
model_selection_graph()
,
parameter_evolution_graph()
if(requireNamespace("simcdm", quietly = TRUE)) { # Set a seed for reproducibility set.seed(1512) # Setup data simulation parameters N = 15 # Number of Examinees / Subjects J = 10 # Number of Items K = 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 item ss = gs = rep(.2, J) # Simulate an identifiable Q matrix Q = simcdm::sim_q_matrix(J, K) # Simulate subject attributes subject_alphas = simcdm::sim_subject_attributes(N, K) # Simulate items under the DINA model items_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 results model_set_edina # Retrieve criterion table table = summary(model_set_edina) # Extract "best model" best_model(model_set_edina) }
if(requireNamespace("simcdm", quietly = TRUE)) { # Set a seed for reproducibility set.seed(1512) # Setup data simulation parameters N = 15 # Number of Examinees / Subjects J = 10 # Number of Items K = 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 item ss = gs = rep(.2, J) # Simulate an identifiable Q matrix Q = simcdm::sim_q_matrix(J, K) # Simulate subject attributes subject_alphas = simcdm::sim_subject_attributes(N, K) # Simulate items under the DINA model items_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 results model_set_edina # Retrieve criterion table table = summary(model_set_edina) # Extract "best model" best_model(model_set_edina) }
Presents either the fitting of model heuristics or the evolution of parameters on a graph
## S3 method for class 'auto_edina' autoplot( object, type = c("selection", "guessing", "slipping", "evolution"), ... )
## S3 method for class 'auto_edina' autoplot( object, type = c("selection", "guessing", "slipping", "evolution"), ... )
object |
An |
type |
Kind of graph to display. Valid types: |
... |
Not used. |
A ggplot2
object.
auto_edina()
,
best_model()
,
model_selection_graph()
,
parameter_evolution_graph()
if(requireNamespace("simcdm", quietly = TRUE)) { # Set a seed for reproducibility set.seed(1512) # Setup data simulation parameters N = 2 # Number of Examinees / Subjects J = 10 # Number of Items K = 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 item ss = gs = rep(.2, J) # Simulate an identifiable Q matrix Q = simcdm::sim_q_matrix(J, K) # Simulate subject attributes subject_alphas = simcdm::sim_subject_attributes(N, K) # Simulate items under the DINA model items_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 results autoplot(model_set_edina, type = "selection") # Equivalent to: model_selection_graph(model_set_edina) # View model parameters autoplot(model_set_edina, type = "guessing") # Or directly call with: parameter_evolution_graph(model_set_edina, type = "guessing") }
if(requireNamespace("simcdm", quietly = TRUE)) { # Set a seed for reproducibility set.seed(1512) # Setup data simulation parameters N = 2 # Number of Examinees / Subjects J = 10 # Number of Items K = 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 item ss = gs = rep(.2, J) # Simulate an identifiable Q matrix Q = simcdm::sim_q_matrix(J, K) # Simulate subject attributes subject_alphas = simcdm::sim_subject_attributes(N, K) # Simulate items under the DINA model items_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 results autoplot(model_set_edina, type = "selection") # Equivalent to: model_selection_graph(model_set_edina) # View model parameters autoplot(model_set_edina, type = "guessing") # Or directly call with: parameter_evolution_graph(model_set_edina, type = "guessing") }
Extracts the best model from the auto_*()
search procedure.
best_model(x, ...) ## S3 method for class 'auto_edina' best_model(x, ic = c("ppp", "bic", "dic"), ...)
best_model(x, ...) ## S3 method for class 'auto_edina' best_model(x, ic = c("ppp", "bic", "dic"), ...)
x |
An |
... |
Not used. |
ic |
Information criterion name. Default |
An edina
model object corresponding to the smallest value of requested
information criterion.
DIC.edina()
,
BIC.edina()
,
PPP.edina()
Calculate BIC for EDINA models.
## S3 method for class 'edina' BIC(object, ...)
## S3 method for class 'edina' BIC(object, ...)
object |
An |
... |
Not used. |
The BIC value of the given model.
Calculate DIC for EDINA models.
DIC(object, ...) ## S3 method for class 'edina' DIC(object, ...)
DIC(object, ...) ## S3 method for class 'edina' DIC(object, ...)
object |
An |
... |
Not used. |
The DIC value of the given model.
Performs the Exploratory Deterministic Input, Noise and Gate Model (EDINA)
estimation on a given data set with a prespecified k
value.
edina(data, k = 3, burnin = 10000, chain_length = 20000)
edina(data, k = 3, burnin = 10000, chain_length = 20000)
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 |
An edina
object that contains:
coefficients
: Estimated coefficients of the model fit
loglike_summed
: Summed log-likelihood
loglike_pmean
: Mean of log-likelihood
pi_classes
: Latent classes
avg_q
: Estimated Averaged Q Matrix
est_q
: Estimated Dichotomous Q Matrix
or_tested
: Odds Ratio used in the model selection.
sample_or
: Odds Ratio for the sample.
n
: Number of Observations
j
: Number of Items
k
: Number of Traits
burnin
: Amount of iterations to discard
chain_length
: Amount of iterations to retain.
timing
: Duration of the run
dataset_name
: Name of the data set used in estimation.
auto_edina()
,
summary.edina()
,
print.edina()
if(requireNamespace("simcdm", quietly = TRUE)) { # Set a seed for reproducibility set.seed(1512) # Setup data simulation parameters N = 1 # Number of Examinees / Subjects J = 10 # Number of Items K = 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 item ss = gs = rep(.2, J) # Simulate an identifiable Q matrix Q = simcdm::sim_q_matrix(J, K) # Simulate subject attributes subject_alphas = simcdm::sim_subject_attributes(N, K) # Simulate items under the DINA model items_dina = simcdm::sim_dina_items(subject_alphas, Q, ss, gs) # Compute the edina model edina_model = edina(items_dina, k = K) # Display results edina_model # Provide a summary overview summary(edina_model) }
if(requireNamespace("simcdm", quietly = TRUE)) { # Set a seed for reproducibility set.seed(1512) # Setup data simulation parameters N = 1 # Number of Examinees / Subjects J = 10 # Number of Items K = 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 item ss = gs = rep(.2, J) # Simulate an identifiable Q matrix Q = simcdm::sim_q_matrix(J, K) # Simulate subject attributes subject_alphas = simcdm::sim_subject_attributes(N, K) # Simulate items under the DINA model items_dina = simcdm::sim_dina_items(subject_alphas, Q, ss, gs) # Compute the edina model edina_model = edina(items_dina, k = K) # Display results edina_model # Provide a summary overview summary(edina_model) }
Given a modeling object, extract the Q Matrix
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, ...)
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, ...)
x |
An |
... |
Additional parameters |
binary |
Boolean to indicate whether the Q matrix is shown in dichotomous form or in an estimated form. |
A matrix
that is either dichotomous or estimated depending on the value
of the binary
parameter.
q_matrix()
,
as_q_matrix()
,
edina()
,
auto_edina()
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Show Q matrix structure Q = q_matrix(x) # Retrieve Q matrix extract_q_matrix(Q)
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Show Q matrix structure Q = q_matrix(x) # Retrieve Q matrix extract_q_matrix(Q)
Displays information about the value of each model information criterion for a given model across the dimensions the Q matrix is estimated.
model_selection_graph(x, ...)
model_selection_graph(x, ...)
x |
An |
... |
Not used |
A ggplot2
object
Displays the slipping and guessing parameter changes for each model across the dimensions the Q matrix is estimated.
parameter_evolution_graph(x, ...)
parameter_evolution_graph(x, ...)
x |
An |
... |
Not used |
A ggplot2
object
Computes posterior predictive probabilities (PPPs) based on the odds ratios for each pair of items.
PPP(object, ...) ## S3 method for class 'edina' PPP(object, alpha = 0.05, ...)
PPP(object, ...) ## S3 method for class 'edina' PPP(object, alpha = 0.05, ...)
object |
An |
... |
Not used. |
alpha |
Defining region to indicate the level of extremeness the data must before the model is problematic. |
PPPs that smaller than 0.05 or greater than 0.95 tend to be extreme and evidence of misfit. As a result, this is more of a heuristic metric.
The PPP value given the specified alpha
value.
simulate observed responses using model parameters
from iteration
of the MCMC sampler
computing the odds ratio for each pair of items at iteration as
,
where is the frequency of ones on both variables at
iteration
,
is the frequency of ones on the
first item and zeros on the second at iteration
, etc.; and
computing PPPs for each item pair as the proportion of generated
's that exceeded elements of the observed odds ratios.
auto_edina
Custom print method for displaying the results of the Auto EDINA method.
## S3 method for class 'auto_edina' print(x, ...)
## S3 method for class 'auto_edina' print(x, ...)
x |
An |
... |
Additional values passed onto the |
None.
The function provides a side-effect of displaying the overview of computed results across all models estimated.
Custom print method for computing the EDINA.
## S3 method for class 'edina' print(x, binary = FALSE, ...)
## S3 method for class 'edina' print(x, binary = FALSE, ...)
x |
An |
binary |
Boolean to indicate whether the Q matrix is shown in dichotomous form or in an estimated form. |
... |
Additional methods passed onto the |
None.
The function provides a side-effect of displaying the overview of the model estimated.
Custom print method for the Q Matrix Object.
## S3 method for class 'q_matrix' print(x, ...)
## S3 method for class 'q_matrix' print(x, ...)
x |
An |
... |
Additional methods passed onto the |
An invisible matrix
without the q_matrix
class displayed as a part
of the output displayed.
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Show Q matrix structure q_matrix(x)
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Show Q matrix structure q_matrix(x)
auto_edina
model summaryCustom method for displaying the results of the summary(auto_edina)
.
## S3 method for class 'summary_auto_edina' print(x, ...)
## S3 method for class 'summary_auto_edina' print(x, ...)
x |
A |
... |
Additional values passed onto the |
None.
The function provides a side-effect of displaying the overview of computed results across all models estimated.
Custom print method for displaying the EDINA model summary information.
## S3 method for class 'summary_edina' print(x, binary = FALSE, ...)
## S3 method for class 'summary_edina' print(x, binary = FALSE, ...)
x |
A |
binary |
Boolean to indicate whether the Q matrix is shown in dichotomous form or in an estimated form. |
... |
Past onto the |
None.
The function provides a side-effect of displaying the overview of the model estimated.
Provides a heatmap approach to showing the estimated binary or averaged values of the Q Matrix.
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, ...)
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, ...)
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 |
A ggplot2
object with a heatmap overview of the estimated Q matrix.
q = q_matrix(matrix(c(1, 0, 1, 1, 0, 1), ncol = 3)) q_graph(q)
q = q_matrix(matrix(c(1, 0, 1, 1, 0, 1), ncol = 3)) q_graph(q)
Provides a way to create an object as a "q_matrix"
.
q_matrix(x)
q_matrix(x)
x |
Either a |
A q_matrix
object.
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Q matrix wrapper q_mat = q_matrix(x) # Data Frame encoding of Q q_df = data.frame( k1 = c(1, 0), k2 = c(0, 1) ) # Create a Q matrix q_mat = q_matrix(q_df)
# Q matrix values x = matrix(c(1, 0, 0, 1), nrow = 2) # Q matrix wrapper q_mat = q_matrix(x) # Data Frame encoding of Q q_df = data.frame( k1 = c(1, 0), k2 = c(0, 1) ) # Create a Q matrix q_mat = q_matrix(q_df)
auto_edina
model dataCustom method for displaying the results of the auto_edina
.
## S3 method for class 'auto_edina' summary(object, ...)
## S3 method for class 'auto_edina' summary(object, ...)
object |
An |
... |
Not used. |
The original auto_edina
object with an added class of summary.auto_edina
.
Provide a more detailed view inside of edina
model object.
## S3 method for class 'edina' summary(object, alpha = 0.05, ...)
## S3 method for class 'edina' summary(object, alpha = 0.05, ...)
object |
An |
alpha |
Defining region to indicate the level of extremeness the data must before the model is problematic. |
... |
Not used. |
A summary object that includes everything in the original edina()
object
and:
model_fit
: Matrix of model fit summary statistics.
alpha
: Alpha-value used to compute PPP()
s.