Stan: A Probabilistic Programming Language
- PMID: 36568334
- PMCID: PMC9788645
- DOI: 10.18637/jss.v076.i01
Stan: A Probabilistic Programming Language
Abstract
Stan is a probabilistic programming language for specifying statistical models. A Stan program imperatively defines a log probability function over parameters conditioned on specified data and constants. As of version 2.14.0, Stan provides full Bayesian inference for continuous-variable models through Markov chain Monte Carlo methods such as the No-U-Turn sampler, an adaptive form of Hamiltonian Monte Carlo sampling. Penalized maximum likelihood estimates are calculated using optimization methods such as the limited memory Broyden-Fletcher-Goldfarb-Shanno algorithm. Stan is also a platform for computing log densities and their gradients and Hessians, which can be used in alternative algorithms such as variational Bayes, expectation propagation, and marginal inference using approximate integration. To this end, Stan is set up so that the densities, gradients, and Hessians, along with intermediate quantities of the algorithm such as acceptance probabilities, are easily accessible. Stan can be called from the command line using the cmdstan package, through R using the rstan package, and through Python using the pystan package. All three interfaces support sampling and optimization-based inference with diagnostics and posterior analysis. rstan and pystan also provide access to log probabilities, gradients, Hessians, parameter transforms, and specialized plotting.
Keywords: Bayesian inference; Stan; algorithmic differentiation; probabilistic program.
Figures
Similar articles
-
A comparison of computational algorithms for the Bayesian analysis of clinical trials.Clin Trials. 2024 May 16:17407745241247334. doi: 10.1177/17407745241247334. Online ahead of print. Clin Trials. 2024. PMID: 38752434
-
Flexible and efficient Bayesian pharmacometrics modeling using Stan and Torsten, Part I.CPT Pharmacometrics Syst Pharmacol. 2022 Sep;11(9):1151-1169. doi: 10.1002/psp4.12812. Epub 2022 Jun 23. CPT Pharmacometrics Syst Pharmacol. 2022. PMID: 35570331 Free PMC article.
-
Bayesian Inference of Gene Expression.In: Helder I. N, editor. Bioinformatics [Internet]. Brisbane (AU): Exon Publications; 2021 Mar 20. Chapter 5. In: Helder I. N, editor. Bioinformatics [Internet]. Brisbane (AU): Exon Publications; 2021 Mar 20. Chapter 5. PMID: 33877766 Free Books & Documents. Review.
-
A practical guide to pseudo-marginal methods for computational inference in systems biology.J Theor Biol. 2020 Jul 7;496:110255. doi: 10.1016/j.jtbi.2020.110255. Epub 2020 Mar 26. J Theor Biol. 2020. PMID: 32223995 Review.
-
Evaluating probabilistic programming and fast variational Bayesian inference in phylogenetics.PeerJ. 2019 Dec 18;7:e8272. doi: 10.7717/peerj.8272. eCollection 2019. PeerJ. 2019. PMID: 31976168 Free PMC article.
Cited by
-
A decade-long study demonstrates that a population of invasive sea lamprey (Petromyzon marinus) can be controlled by introducing sterilized males.Sci Rep. 2024 Jun 3;14(1):12689. doi: 10.1038/s41598-024-61460-1. Sci Rep. 2024. PMID: 38830863 Free PMC article.
-
Factors influencing canine rabies vaccination among dog-owning households in Nigeria.One Health. 2024 May 10;18:100751. doi: 10.1016/j.onehlt.2024.100751. eCollection 2024 Jun. One Health. 2024. PMID: 38827784 Free PMC article.
-
Effects of frequent assessments on the severity of suicidal thoughts: an ecological momentary assessment study.Front Public Health. 2024 May 17;12:1358604. doi: 10.3389/fpubh.2024.1358604. eCollection 2024. Front Public Health. 2024. PMID: 38827619 Free PMC article.
-
Comparison for the diagnostic performance of early diagnostic methods for biliary atresia: a systematic review and network meta-analysis.Pediatr Surg Int. 2024 Jun 1;40(1):146. doi: 10.1007/s00383-024-05730-z. Pediatr Surg Int. 2024. PMID: 38822892
-
Mapping the distribution of Lyme disease at a mid-Atlantic site in the United States using electronic health data.PLoS One. 2024 May 31;19(5):e0301530. doi: 10.1371/journal.pone.0301530. eCollection 2024. PLoS One. 2024. PMID: 38820472 Free PMC article.
References
-
- Betancourt M (2016). “Identifying the Optimal Integration Time in Hamiltonian Monte Carlo.” arXiv:1601.00225 [stat.ME]. URL https://arxiv.org/abs/1601.00225.
-
- Carpenter B, Hoffman MD, Brubaker M, Lee D, Li P, Betancourt M (2015). “The Stan Math Library: Reverse-Mode Automatic Differentiation in C++.” arXiv:1509.07164 [cs.MS]. URL https://arxiv.org/abs/1509.07164.
-
- Chacon S (2009). Pro Git. Apress. doi:10.1007/978-1-4302-1834-0. - DOI
-
- Cohen SD, Hindmarsh AC (1996). “CVODE, A Stiff/Nonstiff ODE Solver in C.” Computers in Physics, 10(2), 138–143.
-
- Driessen V (2010). “A Successful Git Branching Model.” URL http://nvie.com/posts/a-successful-git-branching-model/.
Grants and funding
LinkOut - more resources
Full Text Sources
Other Literature Sources
Research Materials