Stan User’s Guide
Version 2.31
Overview
About this user’s guide
This is the official user’s guide for Stan. It provides example models and programming techniques for coding statistical models in Stan.
Part 1 gives Stan code and discussions for several important classes of models.
Part 2 discusses various general Stan programming techniques that are not tied to any particular model.
Part 3 introduces algorithms for calibration and model checking that requie multiple runs of Stan.
The appendices provide an introduction to the stanc3 compiler used in the various interfaces to Stan, a style guide, and advice for users of BUGS and JAGS.
In addition to this user’s guide, there are two reference manuals for the Stan language and algorithms. The Stan Reference Manual specifies the Stan programming language and inference algorithms. The Stan Functions Reference specifies the functions built into the Stan programming language.
There is also a separate installation and getting started guide for each of the Stan interfaces (R, Python, Julia, Stata, MATLAB, Mathematica, and command line).
We recommend working through this guide using the textbooks Bayesian Data Analysis and Statistical Rethinking: A Bayesian Course with Examples in R and Stan as references on the concepts, and using the Stan Reference Manual when necessary to clarify programming issues.
Web resources
Stan is an open-source software project, resources for which are hosted on various web sites:
The Stan Web Site organizes all of the resources for the Stan project for users and developers. It contains links to the official Stan releases, source code, installation instructions, and full documentation, including the latest version of this manual, the user’s guide and the getting started guide for each interface, tutorials, case studies, and reference materials for developers.
The Stan Forums provide structured message boards for questions, discussion, and announcements related to Stan for both users and developers.
The Stan GitHub Organization hosts all of Stan’s code, documentation, wikis, and web site, as well as the issue trackers for bug reports and feature requests and interactive code review for pull requests.
Acknowledgements
The Stan project could not exist without developers, users, and funding. Stan is a highly collaborative project. The individual contributions of the Stan developers to code is tracked through GitHub and to the design conversation in the Wikis and forums.
Users have made extensive contributions to documentation in the way of case studies, tutorials and even books. They have also reported numerous bugs in both the code and documentation.
Stan has been funded through grants for Stan and its developers, through in-kind donations in the form of companies contributing developer time to Stan and individuals contributing their own time to Stan, and through donations to the open-source scientific software non-profit NumFOCUS. For details of direct funding for the project, see the web site and project pages of the Stan developers.
Copyright, trademark, and licensing
This book is copyright 2011–2022, Stan Development Team and their assignees. The text content is distributed under the CC BY-ND 4.0 license. The user’s guide R and Stan programs are distributed under the BSD 3-clause license.
The Stan name and logo are registered trademarks of NumFOCUS. Use of the Stan name and logo are governed by the Stan logo usage guidelines.