Bayesian Statistics Cheat Sheet

Bayes theorem, prior and posterior distributions, MCMC sampling, credible intervals, and how Bayesian inference differs from frequentist approaches.

Last Updated: May 1, 2025

Bayes Theorem

ItemDescription
P(A|B) = P(B|A) * P(A) / P(B)The fundamental formula — update belief A given evidence B
Posterior = (Likelihood * Prior) / EvidenceInterpret: What you believe after data = what data says * what you believed before
Prior P(H)Your belief about hypothesis H before seeing data
Likelihood P(D|H)Probability of observing data D if hypothesis H is true
Posterior P(H|D)Updated belief about H after observing data D
Marginal P(D) = Integral P(D|H)*P(H) dHNormalizing constant — often intractable, hence MCMC

Priors & Posteriors

ItemDescription
Conjugate PriorsPrior and posterior are same distribution family — closed-form updates
Beta-Binomial: Beta(a,b) priorConjugate for binomial likelihood; posterior = Beta(a+successes, b+failures)
Normal-Normal: N(mu0, tau0^2) priorConjugate for normal with known variance; convenient updating
Uninformative/Flat PriorNo strong prior belief — let data dominate: P(H) ~ constant
Informative PriorEncodes expert knowledge or previous studies — controversial in some fields
Jeffreys PriorObjective prior that is invariant under reparameterization

MCMC Sampling

ItemDescription
Why MCMC?Posterior rarely has closed form — MCMC draws samples to approximate it
Metropolis-HastingsPropose new parameter value, accept/reject based on posterior ratio
Gibbs SamplingSample each parameter conditional on others — efficient for conjugates
Hamiltonian Monte Carlo (HMC)Uses gradient info — Stan/PyMC default, much faster for high dimensions
NUTS (No U-Turn Sampler)Auto-tunes HMC step size — the standard in modern Bayesian software
Convergence DiagnosticsR-hat close to 1, trace plots stationary, effective sample size sufficient

Credible Intervals vs Confidence Intervals

ItemDescription
95% Credible Interval95% probability the parameter is in this interval (given data + prior)
95% Confidence IntervalIf we repeated the study 100 times, 95 intervals would contain true value
HDI (Highest Density Interval)Narrowest interval containing 95% of posterior mass
Bayesian Hypothesis TestingCompare posterior probabilities of competing models directly
Pro Tip: The biggest Bayesian insight: parameters are random variables, not fixed constants. You express uncertainty about them with probability distributions — not just point estimates.