- install R and RStudio on a laptop
- install the packages {
R2jags
}, {coda
} from CRAN - install JAGS
- install JAGS Wiener module
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')
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")
- This code is based on Michael D. Nunez's Repo
pyhddmjags
- MCMC Sampling Program: JAGS
- MCMC Sampling Program: Stan
- Program: JAGS Wiener module
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
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.