Stan (software)
Stan is a probabilistic programming language for statistical inference written in C++.[1] The Stan language is used to specify a (Bayesian) statistical model with an imperative program calculating the log probability density function.[1]
Original author(s) | Stan Development Team |
---|---|
Initial release | August 30, 2012 |
Stable release | 2.24
/ August 2020 |
Repository | |
Written in | C++ |
Operating system | Unix-like, Microsoft Windows, Mac OS X |
Platform | Intel x86 - 32-bit, x64 |
Type | Statistical package |
License | New BSD License |
Website | mc-stan |
Stan is licensed under the New BSD License. Stan is named in honour of Stanislaw Ulam, pioneer of the Monte Carlo method.[1]
Stan was created by a development team consisting of 34 members[2] that includes Andrew Gelman, Bob Carpenter, Matt Hoffman, and Daniel Lee.
Interfaces
The Stan language itself can be accessed through several interfaces:
- CmdStan - command-line executable for the shell
- RStan - integration with the R software environment, maintained by Andrew Gelman and colleagues
- PyStan - integration with the Python programming language
- MatlabStan - integration with the MATLAB numerical computing environment
- Stan.jl - integration with the Julia programming language
- StataStan - integration with Stata
In addition, higher-level interfaces are provided with packages using Stan as backend, primarily in the R language:[3]
- rstanarm - provides a drop-in replacement for frequentist models provided by base R and lme4 using the R formula syntax
- brms - provides a wide array of linear and nonlinear models using the R formula syntax [4]
- blavaan - provides latent variable models, including confirmatory factor analysis, structural equation models, and latent growth curve models
- prophet - provides time series forecasting
Algorithms
Stan implements gradient-based Markov chain Monte Carlo (MCMC) algorithms for Bayesian inference, stochastic, gradient-based variational Bayesian methods for approximate Bayesian inference, and gradient-based optimization for penalized maximum likelihood estimation.
- MCMC algorithms:
- No-U-Turn sampler[1][5] (NUTS), a variant of HMC and Stan's default MCMC engine
- Hamiltonian Monte Carlo
- Variational inference algorithms:
- Black-box Variational Inference[6]
- Optimization algorithms:
- Limited-memory BFGS (Stan's default optimization algorithm)
- Broyden–Fletcher–Goldfarb–Shanno algorithm
- Laplace's method for classical standard error estimates and approximate Bayesian posteriors
Automatic differentiation
Stan implements reverse-mode automatic differentiation to calculate gradients of the model, which is required by HMC, NUTS, L-BFGS, BFGS, and variational inference.[1] The automatic differentiation within Stan can be used outside of the probabilistic programming language.
Usage
Stan is used in fields including social science,[7] pharmaceutical statistics,[8] market research,[9] and medical imaging.[10]
References
- Stan Development Team. 2015. Stan Modeling Language User's Guide and Reference Manual, Version 2.9.0
- "Development Team". stan-dev.github.io. Retrieved 2018-07-25.
- Gabry, Jonah. "The current state of the Stan ecosystem in R". Statistical Modeling, Causal Inference, and Social Science. Retrieved 25 August 2020.
- https://cran.r-project.org/web/packages/brms/index.html
- Hoffman, Matthew D.; Gelman, Andrew (April 2014). "The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo". Journal of Machine Learning Research. 15: pp. 1593–1623.
- Kucukelbir, Alp; Ranganath, Rajesh; Blei, David M. (June 2015). "Automatic Variational Inference in Stan". 1506 (3431). arXiv:1506.03431. Bibcode:2015arXiv150603431K. Cite journal requires
|journal=
(help) - Goodrich, Benjamin King, Wawro, Gregory and Katznelson, Ira, Designing Quantitative Historical Social Inquiry: An Introduction to Stan (2012). APSA 2012 Annual Meeting Paper. Available at SSRN 2105531
- Natanegara, Fanni; Neuenschwander, Beat; Seaman, John W.; Kinnersley, Nelson; Heilmann, Cory R.; Ohlssen, David; Rochester, George (2013). "The current state of Bayesian methods in medical product development: survey results and recommendations from the DIA Bayesian Scientific Working Group". Pharmaceutical Statistics. 13 (1): 3–12. doi:10.1002/pst.1595. ISSN 1539-1612. PMID 24027093.
- Feit, Elea. "Using Stan to Estimate Hierarchical Bayes Models". Retrieved 19 March 2019.
- Gordon, GSD; Joseph, J; Alcolea, MP; Sawyer, T; Macfaden, AJ; Williams, C; Fitzpatrick, CRM; Jones, PH; di Pietro, M; Fitzgerald, RC; Wilkinson, TD; Bohndiek, SE (2018). "Quantitative phase and polarisation endoscopy applied to detection of early oesophageal tumourigenesis". arXiv:1811.03977 [physics.med-ph].
Further reading
- Bob, Carpenter; Andrew, Gelman; Matthew, Hoffman; Daniel, Lee; Ben, Goodrich; Michael, Betancourt; Marcus, Brubaker; Jiqiang, Guo; Peter, Li; Allen, Riddell (2017). "Stan: A Probabilistic Programming Language". Journal of Statistical Software. 76 (1): 1–32. doi:10.18637/jss.v076.i01. ISSN 1548-7660.
- Gelman, Andrew, Daniel Lee, and Jiqiang Guo (2015). Stan: A probabilistic programming language for Bayesian inference and optimization, Journal of Educational and Behavioral Statistics.
- Hoffman, Matthew D., Bob Carpenter, and Andrew Gelman (2012). Stan, scalable software for Bayesian modeling, Proceedings of the NIPS Workshop on Probabilistic Programming.
External links
- Stan web site
- Stan source, a Git repository hosted on GitHub