HDDM is a python module that implements Hierarchical Bayesian estimation of Drift Diffusion Models.
Project description
- Date:
- August 15, 2012
- Contact:
- thomas_wiecki@brown.edu, imri_sofer@brown.edu, michael_frank@brown.edu
- Web site:
- Github:
- Mailing list:
- Copyright:
- This document has been placed in the public domain.
- License:
HDDM is released under the GPLv3.
- Version:
- 0.3
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).
Easy specification of models via configuration file fosters exchange of models and research results.
Built-in Bayesian hypothesis testing and several convergence and goodness-of-fit diagnostics.
Usage
Command line
The easiest way to use HDDM is by creating a configuration file for your model:
example.conf
[depends] v = difficulty
Then call hddm_fit.py:
hddm_fit.py --samples 10000 --burn 5000 example.conf mydata.csv
Python
Of course, you can also use HDDM directly from within Python:
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(10000, burn=5000) # Print fitted parameters and other model statistics model.print_stats() # Plot posterior distributions and theoretical RT distributions model.plot_posteriors() model.plot_posterior_predictive(savefig=True)
Installing
See further below on how to install most of the necessary dependencies for the most common platforms.
Assuming you have the dependencies, the easiest way to install HDDM is via pip
pip install kabuki pip install hddm
If you already installed a previous version of HDDM, you should upgrade instead
pip install --upgrade --no-deps kabuki pip install --upgrade --no-deps hddm
Dependencies
HDDM relies on the following packages:
Python
NumPy
PyMC (installation instructions: http://pymc.googlecode.com/svn/doc/installation.html)
SciPy (optional)
Matplotlib (optional)
Cython (optional)
Windows
The easiest way is to download and install the Enthought Python Distribution (EPD) which is free for academic use. An untested alternative is the Python(x,y) distribution. Please let us know your experiences if you test this option.
We recommend using pip to download and install HDDM. The easiest way to install pip is via easy_install. Start the windows command shell (cmd.exe) and type
easy_install pip
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 hddm_demo.py can be installed via
apt-get install python-wxgtk2.8 python-traitsui
OSX
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:
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file HDDM-0.3.1.tar.gz
.
File metadata
- Download URL: HDDM-0.3.1.tar.gz
- Upload date:
- Size: 521.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 473ae23dc7899c37ca0b9cdb3a5814163d8379004a8219c7d6bd7c6de8c16b94 |
|
MD5 | 85bf89ded02fe59b8615f0acc1920a7e |
|
BLAKE2b-256 | 59adeff98c48a5b27cfc67b1e71bee8e2ba955489d9b81c70aacf8e47d31181f |