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.
hBayesDM 2.0 requires R ≥ 4.4 and uses CmdStan (via the cmdstanr R package) as its Stan backend, replacing rstan in 1.x. CmdStan ships as a system dependency, so models compile on first use rather than at package install time.
# 1. Install cmdstanr (not on CRAN — use the Stan r-universe)
install.packages(
"cmdstanr",
repos = c("https://stan-dev.r-universe.dev", getOption("repos"))
)
# 2. Install CmdStan itself (one-time, ~5 min)
cmdstanr::install_cmdstan()The latest stable version of hBayesDM can be installed from CRAN:
install.packages("hBayesDM")or from GitHub:
if (!require(remotes)) install.packages("remotes")
remotes::install_github("CCS-Lab/hBayesDM", subdir = "R")For the latest development version:
remotes::install_github("CCS-Lab/hBayesDM", ref = "develop", subdir = "R")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},
}