This is the repository for *Bayesian Statistics Using Stan", which serves as both the Stan users' guide and an introduction to Bayesian statistics.
*.Rmd
files: basic text_bookdown.yml
: book includes_output.yml
: output configbib/all.bib
: BibTeX file for referencesstan/*.Stan
: directory of Stan programsdata/{*.R, *.rds}
: directory for data used by programsprograms/{*.R, *.stan}
: legacy programs from old manual (deprecated until they're moved into new style with R inline in .Rmd)
You will need to have RStan installed in the R environment from which you build.
In RStudio: to build the project, open index.Rmd
in RStudio and click knit
- change output on first line of index.Rmd
for gitbook
and pdf_book
(not differeing _
)
First, you will need to install pandoc
and pandoc-citeproc
in
addition to the bookdown
package in R. After that, it can be built
from within R in this directory using bookdown::render('index.Rmd')
or from the shell using ./build.sh
to build both PDF and HTML
versions.
-
All lines should be 80 or fewer characters unless absolutely mandated by content
-
y ~ normal(mu, sigma) # Not: N(), not sigma^2, regular font for "normal", Latex math for
$y$ ,$\mu$ ,$\sigma$ -
norma(y | mu, sigma) # Vertical bar, not semicolon
-
Poisson, Weibull, LKJ # Use capital letters for distributions that are named after people
-
E(y) # Regular font, parentheses not brackets
-
() # Always parentheses, never brackets
-
No special fonts for distributions, just latex roman and math fonts
-
p(y) # Probability density and probability mass function
-
Pr(A) # probability of an event
-
Follow the Stan style guide for code
- int<lower = 0> N; # Put in the lower bound
- for (n in 1:N); # Not: for (i in 1:n);
- foo_bar # Underscores rather than dots or CamelCase
-
No R/Python code in the finished book except in appendix
-
All Stan code should be best practice except when explaining something, in which case we should explicitly show the best-practice alternative
The code is licensed under BSD-3 and the text under CC-BY ND 4.0.