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


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


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:

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