Bayesian Estimation of DINA Model

Estimate the Deterministic Input, Noisy "And" Gate (DINA) cognitive diagnostic model parameters using the Gibbs sampler described by Culpepper (2015) .

BuildStatus Package-License CRAN VersionBadge CRANStatus RStudio CRAN Mirror’s MonthlyDownloads RStudio CRAN Mirror’s TotalDownloads Coveragestatus

Estimate the Deterministic Input, Noisy And Gate (DINA) cognitive diagnostic model parameters using the Gibbs sampler described by Culpepper (2015) <doi: 10.3102/1076998615595403>.


You can install dina from CRAN using:


Or, you can be on the cutting-edge development version on GitHub using:

if(!requireNamespace("devtools")) install.packages("devtools")


To use the dina package, load it into R using:


From there, the DINA CDM can be estimated using:

dina_model = dina(<data>, <q>, chain_length = 10000)

To simulate item data under DINA, use:

# Set a seed for reproducibility
# Setup Parameters
N = 15   # Number of Examinees / Subjects
J = 10   # Number of Items
K = 2    # Number of Skills / Attributes
# Assign slipping and guessing values for each item
ss = gs = rep(.2, J)
# Simulate identifiable Q matrix
Q = sim_q_matrix(J, K)
# Simulate subject attributes
subject_alphas = sim_subject_attributes(N, K)
# Item data
items_dina = sim_dina_items(subject_alphas, Q, ss, gs)


Steven Andrew Culpepper and James Joseph Balamuta

Citing the dina package

To ensure future development of the package, please cite dina package if used during an analysis or simulations. Citation information for the package may be acquired by using in R:



GPL (>= 2)


dina 2.0.0

API Breakage

  • Deprecated DINA_Gibbs() in favor of dina(), which generates the correct alpha matrix (Amat) inside of the function instead of relying on the user to set it up.
  • The call to estimate with the gibbs sampling technique is now: dina(Y, Q, chain_length)


  • Switched internal portions of the package to use the simcdm C++ routines and imported R level-routines.
  • Switched from src/init.c to autogeneration via Rcpp 0.12.15
  • Removed miscellaneous RNG seed.


  • Enabled markdown for inline documentiona with roxygen2.
  • Improved documentation flow


  • Added TMSA Lab's Travis-CI configuration for testing across R versions.
  • Added Unit Tests for model reproducibility.
  • Added code coverage results.

dina 1.0.2

  • Addressed R 3.4 registration requirements.
  • Added URL to GitHub repository.

dina 1.0.1

  • Fixed notation in a few examples and computation code.

dina 1.0.0

  • Initial release of the dina package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.0.0 by James Joseph Balamuta, a year ago

Report a bug at

Browse source code at

Authors: Steven Andrew Culpepper [aut, cph] , James Joseph Balamuta [aut, cre]

Documentation:   PDF Manual  

Task views: Psychometric Models and Methods

GPL (>= 2) license

Imports Rcpp

Depends on simcdm

Suggests CDM, covr, testthat

Linking to Rcpp, RcppArmadillo, simcdm, rgen

Enhanced by CDM.

See at CRAN