hBayesDM (hierarchical Bayesian modeling of Decision-Making tasks) is a user-friendly package that offers hierarchical Bayesian analysis of various computational models on an array of decision-making tasks. hBayesDM uses Stan for Bayesian inference.

Getting Started

Prerequisite

To install hBayesDM for R, RStan needs to be properly installed before you proceed. For detailed instructions on having RStan ready prior to installing hBayesDM, please go to this link: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started

Installation

The lastest stable version of hBayesDM can be installed from CRAN by running the following command in R:

install.packages("hBayesDM")  # Install hBayesDM from CRAN

or you can also install from GitHub with:

# `devtools` is required to install hBayesDM from GitHub
if (!require(devtools)) install.packages("devtools")

devtools::install_github("CCS-Lab/hBayesDM", subdir="R")

If you want to use the latest development version of hBayesDM, run the following in R:

# `devtools` is required to install hBayesDM from GitHub
if (!require(devtools)) install.packages("devtools")

devtools::install_github("CCS-Lab/hBayesDM", ref="develop", subdir="R")

Building at once

By default, you will have to wait for compilation when you run each model for the first time. If you plan on runnning several different models and want to pre-build all models during installation time, set an environment variable BUILD_ALL to true, like the following. We highly recommend you only do so when you have multiple cores available, since building all models at once takes quite a long time to complete.

Sys.setenv(BUILD_ALL = "true")  # Build *all* models at installation time
Sys.setenv(MAKEFLAGS = "-j 4")  # Use 4 cores for build (or any other number you want)

install.packages("hBayesDM")                    # Install from CRAN
# or
devtools::install_github("CCS-Lab/hBayesDM/R")  # Install from GitHub

Citation

If you used hBayesDM or some of its codes for your research, please cite this paper:

@article{hBayesDM,
  title = {Revealing Neurocomputational Mechanisms of Reinforcement Learning and Decision-Making With the {hBayesDM} Package},
  author = {Ahn, Woo-Young and Haines, Nathaniel and Zhang, Lei},
  journal = {Computational Psychiatry},
  year = {2017},
  volume = {1},
  pages = {24--57},
  publisher = {MIT Press},
  url = {doi:10.1162/CPSY_a_00002},
}