Skip to content

Repository for example Hierarchical Drift Diffusion Model (HDDM) code using JAGS in R. These scripts provide useful examples for using JAGS with R2jags, the JAGS Wiener module, mixture modeling in JAGS, and Bayesian diagnostics in R.

License

kiante-fernandez/Rhddmjags

Repository files navigation

Rhddmjags - Repository for example Hierarchical Drift Diffusion Model (HDDM) code using JAGS in R

(Repository version 0.0.0.9002)

Prerequisites

  • install R and RStudio on a laptop
  • install the packages {R2jags}, {coda} from CRAN
  • install JAGS
  • install JAGS Wiener module

Installation

You can install the packages used in these tutorials and get functions that makes it easy to access the templates .Rmd files by running the following code:

devtools::install_github('kiante-fernandez/Rhddmjags')

Getting started

At the moment each script can be run individually to simulate from hierarchical drift-diffusion models (HDDMs) and then find and recover parameter estimates from those models. The most simple HDDM lives in nolapse_test.R. See other scripts: recovery_test.R, blocked_exp_conds.R, and regression_test.R. These scripts provide useful examples for using JAGS with Rjags, the JAGS Wiener module, mixture modeling in JAGS, and Bayesian diagnostics in R.

The script nolapse_test_Rstan.R contains Rstan and Stan code to find and recover parameters from the exact same HDDM written in JAGS within nolapse_test.R.

Then you can load examples with the following code:

Rhddmjags::example("simple", "jags")
Rhddmjags::example("nolapse","stan")

Resources

Past Workshops

citation

Nunez, M.D., Fernandez, K., Srinivasan, R. et al. A tutorial on fitting joint models of M/EEG and behavior to understand cognition. Behav Res (2024). https://doi.org/10.3758/s13428-023-02331-x

License

Rhddmjags is licensed under the GNU General Public License v3.0 and written by Kianté Fernandez from the Neruoeconomics group at University of California, Los Angeles.

About

Repository for example Hierarchical Drift Diffusion Model (HDDM) code using JAGS in R. These scripts provide useful examples for using JAGS with R2jags, the JAGS Wiener module, mixture modeling in JAGS, and Bayesian diagnostics in R.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published