skip to navigation
skip to content

HDDM 0.5.2.beta

HDDM is a python module that implements Hierarchical Bayesian estimation of Drift Diffusion Models.

Package Documentation

Latest Version: 0.6.1


HDDM is a python toolbox for hierarchical Bayesian parameter estimation of the Drift Diffusion Model (via PyMC). Drift Diffusion Models are used widely in psychology and cognitive neuroscience to study decision making.


  • Uses hierarchical Bayesian estimation (via PyMC) of DDM parameters to allow simultaneous estimation of subject and group parameters, where individual subjects are assumed to be drawn from a group distribution. HDDM should thus produce better estimates when less RT values are measured compared to other methods using maximum likelihood for individual subjects (i.e. DMAT or fast-dm).
  • Heavily optimized likelihood functions for speed (Navarro & Fuss, 2009).
  • Flexible creation of complex models tailored to specific hypotheses (e.g. estimation of separate drift-rates for different task conditions; or predicted changes in model parameters as a function of other indicators like brain activity).
  • Estimate trial-by-trial correlations between a brain measure (e.g. fMRI BOLD) and a diffusion model parameter using the HDDMRegression model.
  • Built-in Bayesian hypothesis testing and several convergence and goodness-of-fit diagnostics.


The following is a minimal python script to load data, run a model and examine its parameters and fit.

import hddm

# Load data from csv file into a NumPy structured array
data = hddm.load_csv('simple_difficulty.csv')

# Create a HDDM model multi object
model = hddm.HDDM(data, depends_on={'v':'difficulty'})

# Create model and start MCMC sampling
model.sample(2000, burn=20)

# Print fitted parameters and other model statistics

# Plot posterior distributions and theoretical RT distributions

For more information about the software and theories behind it, please see the main publication.



The easiest way is to download and install Anaconda.

Then install pymc, kabuki and HDDM:

pip install pymc pip install kabuki pip install hddm

Linux (Debian based, such as Ubuntu)

Most of HDDM’s dependencies are available from your repository, you can install them by typing

apt-get install python python-dev python-numpy python-scipy python-matplotlib cython python-pip gfortran liblapack-dev

which requires sudo rights.

Optional dependencies for can be installed via

apt-get install python-wxgtk2.8 python-traitsui

Then install kabuki and HDDM:

sudo pip install pandas
sudo pip install pymc
sudo pip install kabuki
sudo pip install hddm


We recommend installing the SciPy Superpack maintained by Chris Fonnesbeck.

The Superpack requires you to install XCode which apparently does not bundle with gcc anymore (which is required by HDDM). This repository provides some appropriate installers:

Then install kabuki and HDDM:

sudo pip install kabuki
sudo pip install hddm

How to cite

If HDDM was used in your research, please cite the publication (link to pdf):

Wiecki TV, Sofer I and Frank MJ (2013). HDDM: Hierarchical Bayesian estimation of the Drift-Diffusion Model in Python. Front. Neuroinform. 7:14. doi: 10.3389/fninf.2013.00014

Getting started

Check out the tutorial on how to get started. Further information can be found in howto and the documentation.

Join our low-traffic mailing list.

File Type Py Version Uploaded on Size
HDDM-0.5.2.beta.tar.gz (md5) Source 2013-09-17 551KB