# Introduction¶

Author: Thomas V. Wiecki, Imri Sofer, Michael J. Frank thomas_wiecki@brown.edu, imri_sofer@brown.edu, michael_frank@brown.edu http://ski.clps.brown.edu/hddm_docs http://github.com/hddm-devs/hddm https://groups.google.com/group/hddm-users/ This document has been placed in the public domain. HDDM is released under the BSD 2 license. 0.5.4.dev

## Purpose¶

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.

## Features¶

• 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.

## Quick-start¶

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

# 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
model.print_stats()

# Plot posterior distributions and theoretical RT distributions
model.plot_posteriors()
model.plot_posterior_predictive()


## Installation¶

The easiest way to install HDDM is through Anaconda (available for Windows, Linux and OSX):

2. In a shell (Windows: Go to Start->Programs->Anaconda->Anaconda command prompt) type:
conda install -c pymc pymc
conda install -c twiecki hddm

If you want to use pip instead of conda, type:

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

This might require super-user rights via sudo. Note that this installation method is discouraged as it leads to all kinds of problems on various platforms.