Psychonomic Bulletin & Review

, Volume 25, Issue 1, pp 77–101 | Cite as

Bayesian inference for psychology, part III: Parameter estimation in nonstandard models



We demonstrate the use of three popular Bayesian software packages that enable researchers to estimate parameters in a broad class of models that are commonly used in psychological research. We focus on WinBUGS, JAGS, and Stan, and show how they can be interfaced from R and MATLAB. We illustrate the use of the packages through two fully worked examples; the examples involve a simple univariate linear regression and fitting a multinomial processing tree model to data from a classic false-memory experiment. We conclude with a comparison of the strengths and weaknesses of the packages. Our example code, data, and this text are available via


WinBUGS JAGS Stan Bayesian estimation Bayesian inference 



The authors thank Eric-Jan Wagenmakers for helpful comments during the writing of this article. DM was supported by a Veni grant #451-15-010 from the Netherlands Organization of Scientific Research (NWO). UB was supported by an NWO Research Talent grant #406-12-125. JV was supported by NSF grants #1230118 and #1534472 from the Methods, Measurements, and Statistics panel and John Templeton Foundation grant #48192.


  1. Batchelder, W. H., & Riefer, D. M. (1980). Separation of storage and retrieval factors in free recall of clusterable pairs. Psychological Review, 87, 375–397.Google Scholar
  2. Brown, S. D., & Heathcote, A. J. (2008). The simplest complete model of choice reaction time: Linear ballistic accumulation. Cognitive Psychology, 57, 153–178.Google Scholar
  3. Chechile, R. A. (1973). The relative storage and retrieval losses in short-term memory as a function of the similarity and amount of information processing in the interpolated task (Unpublished doctoral dissertation). Pittsburgh: University of Pittsburgh.Google Scholar
  4. Farrell, S., & Ludwig, C. J. H. (2008). Bayesian and maximum likelihood estimation of hierarchical response time models. Psychonomic Bulletin & Review, 15, 1209–1217.Google Scholar
  5. Gelman, A., & Hill, J. (2007). Data analysis using regression and multilevel/hierarchical models. Cambridge: Cambridge University Press.Google Scholar
  6. Gelman, A., & Rubin, D. B. (1999). Evaluating and using statistical methods in the social sciences. Sociological Methods & Research, 27, 403–410.Google Scholar
  7. Gronau, Q. F., Sarafoglou, A., Matzke, D., Ly, A., Boehm, U., Marsman, M., & Steingroever, H. (2017). A tutorial on bridge sampling. arXiv:1703.05984
  8. Guo, J., Lee, D., Goodrich, B., de Guzman, J., Niebler, E., Heller, T., & Goodrich, B. (2015). rstan: R interface to stan [Computer software manual]. Retrieved from
  9. Jeffreys, H. (1961). Theory of probability, 3rd edn. Oxford: Oxford University Press.Google Scholar
  10. Kass, R. E., & Raftery, A. E. (1995). Bayes factors. Journal of the American Statistical Association, 90, 773–795.Google Scholar
  11. Kruschke, J. K. (2010). Doing Bayesian data analysis: A tutorial introduction with R and BUGS. Burlington: Academic Press.Google Scholar
  12. Lee, M. D. (2011). How cognitive modeling can benefit from hierarchical Bayesian models. Journal of Mathematical Psychology, 55, 1–7.Google Scholar
  13. Lee, M. D., & Wagenmakers, E.-J. (2013). Bayesian modeling for cognitive science: A practical course. Cambridge: Cambridge University Press.Google Scholar
  14. Lodewyckx, T., Kim, W., Tuerlinckx, F., Kuppens, P., Lee, M. D., & Wagenmakers, E.-J. (2011). A tutorial on Bayes factor estimation with the product space method. Journal of Mathematical Psychology, 55, 331–347.Google Scholar
  15. Love, J., Selker, R., Marsman, M., Jamil, T., Dropmann, D., Verhagen, A. J., & Wagenmakers, E. -J (2015). JASP [computer software].
  16. Lunn, D. J. (2003). WinBUGS development interface (WBDev). ISBA Bulletin, 10, 10–11.Google Scholar
  17. Lunn, D. J., Jackson, C., Best, N., Thomas, A., & Spiegelhalter, D. (2012). The BUGS book: A practical introduction to Bayesian analysis. Boca Raton: Chapman & Hall/CRC.Google Scholar
  18. Lunn, D. J., Spiegelhalter, D., Thomas, A., & Best, N. (2009). The BUGS project: Evolution, critique and future directions. Statistics in Medicine, 28, 3049–3067.Google Scholar
  19. Lunn, D. J., Thomas, A., & Best, N. (2000). WinBUGS—a Bayesian modelling framework: Concepts, structure, and extensibility. Statistics and Computing, 10, 325–337.Google Scholar
  20. Matzke, D., Dolan, C. V., Batchelder, W. H., & Wagenmakers, E.-J. (2015). Bayesian estimation of multinomial processing tree models with heterogeneity in participants and items. Psychometrika, 80, 205–235.Google Scholar
  21. Matzke, D., Dolan, C. V., Logan, G. D., Brown, S. D., & Wagenmakers, E.-J. (2013). Bayesian parametric estimation of stop-signal reaction time distributions. Journal of Experimental Psychology: General, 142, 1047–1073.Google Scholar
  22. Matzke, D., & Wagenmakers, E.-J. (2009). Psychological interpretation of the ex-Gaussian and shifted Wald parameters: A diffusion model analysis. Psychonomic Bulletin & Review, 16, 798–817.Google Scholar
  23. Morey, R. D., Rouder, J. N., & Jamil, T. (2015). Package Bayes factorâǍŹ.
  24. Nilsson, H., Rieskamp, J., & Wagenmakers, E.-J. (2011). Hierarchical Bayesian parameter estimation for cumulative prospect theory. Journal of Mathematical Psychology, 55, 84–93.Google Scholar
  25. R Development Core Team (2004). R: A language and environment for statistical computing [Computer software manual]. Vienna, Austria. Retrieved from (ISBN 3-900051-00-3).
  26. Riefer, D. M., & Batchelder, W. H. (1988). Multinomial modeling and the measurement of cognitive processes. Psychological Review, 95, 318–399.Google Scholar
  27. Rouder, J. N., & Lu, J. (2005). An introduction to Bayesian hierarchical models with an application in the theory of signal detection. Psychonomic Bulletin & Review, 12, 573–604.Google Scholar
  28. Rouder, J. N., Lu, J., Morey, R. D., Sun, D., & Speckman, P. L. (2008). A hierarchical process dissociation model. Journal of Experimental Psychology: General, 137, 370–389.Google Scholar
  29. Rouder, J. N., Lu, J., Speckman, P. L., Sun, D., & Jiang, Y. (2005). A hierarchical model for estimating response time distributions. Psychonomic Bulletin & Review, 12, 195–223.Google Scholar
  30. Rouder, J. N., Province, J. M., Morey, R. D., Gomez, P., & Heathcote, A. (2015). The lognormal race: A cognitive-process model of choice and latency with desirable psychometric properties. Psychometrika, 80, 491–513.Google Scholar
  31. Spiegelhalter, D. J., Best, N. G., Carlin, B. P., & van der Linde, A. (2002). Bayesian measures of model complexity and fit. Journal of the Royal Statistical Society B, 64, 583–639.Google Scholar
  32. Spiegelhalter, D. J., Thomas, A., Best, N., & Lunn, D. (2003). WinBUGS version 1.4 user manual. Cambridge: Medical Research Council Biostatistics Unit.Google Scholar
  33. Stan Development Team (2015). Stan modeling language: User’s guide and reference manual. version 2.7.0 [Computer software manual]. Retrieved from
  34. Sturtz, S., Ligges, U., & Gelman, A. (2005). R2WinBUGS: A package for running Win-BUGS from R. Journal of Statistical Software, 12, 1–16.Google Scholar
  35. Su, Y. -S., & Yajima, M. (2012). R2jags: A package for running JAGS from R [Computer software manual]. Retrieved from
  36. Tange, O. (2011). Gnu parallel - the command–line power tool. ;login: The USENIX Magazine, 36(1), 42–47. Retrieved from
  37. Turner, B. M., Sederberg, P. B., Brown, S. D., & Steyvers, M. (2013). A method for efficiently sampling from distributions with correlated dimensions. Psychological Methods, 18, 368–384.Google Scholar
  38. Vandekerckhove, J. (2014). Trinity: A MATLAB interface for Bayesian analysis.
  39. Vandekerckhove, J., Matzke, D., & Wagenmakers, E.-J. (2015). Model comparison and the principle of parsimony. In Busemeyer, J. R., Townsend, J. T., Wang, Z. J., & Eidels, A. (Eds.) Oxford handbook of computational and mathematical psychology. Retrieved from (pp. 300–317). Oxford: Oxford University Press.
  40. Vandekerckhove, J., Tuerlinckx, F., & Lee, M. D. (2011). Hierarchical diffusion models for two-choice response times. Psychological Methods, 16, 44–62. Retrieved from
  41. Wabersich, D., & Vandekerckhove, J. (2014). Extending JAGS: A tutorial on adding custom distributions to JAGS (with a diffusion model example), (Vol. 46. Retrieved from
  42. Wagenaar, W. A., & Boer, J. P. (1987). A Misleading postevent information: Testing parameterized models of integration in memory. Acta Psychologica, 66, 291–306.Google Scholar
  43. Wagenmakers, E. -J., Lodewyckx, T., Kuriyal, H., & Grasman, R. (2010). Bayesian hypothesis testing for psychologists: A tutorial on the Savage–Dickey method. Cognitive Psychology, 60, 158–189.Google Scholar
  44. Wetzels, R., Lee, M. D., & Wagenmakers, E.-J. (2010). Bayesian inference using WBDev: A tutorial for social scientists. Behavior Research Methods, 42, 884–897.Google Scholar
  45. Wetzels, R., Raaijmakers, J. G. W., Jakab, E., & Wagenmakers, E. -J (2009). How to quantify support for and against the null hypothesis: A flexible WinBUGS implementation of a default Bayesian t test. Psychonomic Bulletin & Review, 16, 752–760.Google Scholar

Copyright information

© Psychonomic Society, Inc. 2017

Authors and Affiliations

  • Dora Matzke
    • 1
  • Udo Boehm
    • 2
  • Joachim Vandekerckhove
    • 3
  1. 1.University of AmsterdamAmsterdamNetherlands
  2. 2.University of GroningenGroningenNetherlands
  3. 3.University of CaliforniaIrvineUSA

Personalised recommendations