Quick recap
The key takeaways of every lesson on one page. Read it in ten minutes to refresh the whole track; open a lesson when a point feels unclear.
01 Probability and Bayes' rule
- With equally likely outcomes, ; count with the multiplication rule, ordered lists and subsets. Often it is easier to compute the complement.
- The axioms (, , countable additivity) imply the complement rule, inclusion–exclusion and the union bound .
- Conditioning on keeps only the outcomes in and rescales: . Law of total probability: for a partition .
- Bayes' rule: posterior = likelihood × prior / evidence, . With a small prior, a good test can still give mostly false positives (base-rate effect).
- Odds form: posterior odds = prior odds × likelihood ratio . Conditionally independent pieces of evidence multiply their likelihood ratios; dependent ones do not.
- Independence: . Disjoint events with positive probabilities are dependent. Pairwise independence does not imply mutual independence (XOR).
- Conditional independence and independence do not imply each other: a common cause makes conditionally independent events dependent, and a common effect (collider) makes independent events dependent (explaining away, selection bias).
- Monty Hall: switching wins with probability 2/3 because the host's choice depends on the car. Simpson's paradox: pooled rates are weighted averages, and different weights can reverse a comparison.
02 Random variables and expectation
- A random variable is a function . Its CDF describes its distribution, and .
- A PMF gives probabilities of single values (bars); a PDF gives probability per unit length (areas are probabilities, heights can exceed 1, and ).
- The expectation is the balance point: or . LOTUS: , without the distribution of .
- Linearity needs no independence; with indicators () it gives the mean of any count.
- and ; in general .
- For a strictly monotone , has density (probability is conserved); for a non-monotone , use the CDF method.
- Inverse-CDF sampling: with has CDF (with the generalised inverse also for discrete ). PIT: for a continuous , so PIT histograms check calibration (U-shape = too narrow).
03 Common distributions
- Bernoulli → binomial (successes in trials), geometric (trials to the first success) and categorical ( classes); binomial with large , small and → Poisson, with mean = variance = .
- Le Cam: a sum of independent is within total variation distance of ; for the bound is .
- (rate , mean ) is memoryless: . It and the geometric are the only memoryless distributions. The minimum of independent exponentials is exponential with the sum of the rates.
- The MGF gives moments (), multiplies for independent sums, and determines the distribution when it is finite near 0.
- A sum of i.i.d. is ; gammas with the same rate add their shapes.
- with independent and is ; normalised independent gammas give a Dirichlet, whose marginals are .
- Poisson process with rate : i.i.d. gaps, or independent counts in disjoint windows. Thinning with probability gives rate ; superposition adds rates.
04 Joint distributions and covariance
- From a joint PMF or PDF: the marginal is a sum (or integral) over the other variable; the conditional is ; and .
- and are independent when everywhere, including where it is 0; a joint table is independent exactly when it has rank 1.
- is a random variable (a function of ); the tower rule says .
- Law of total variance: , within plus between.
- and ; independent implies uncorrelated, but not the reverse ( and ).
- , and .
- Every covariance matrix is symmetric PSD, because ; its eigenvectors are the PCA directions and its eigenvalues the variances along them.
- The sample variance with is unbiased, because .
05 The multivariate Gaussian
- Change of variables: ; mass is kept, so where the map stretches area the density drops.
- Box–Muller: in polar coordinates two i.i.d. give an independent uniform angle and ; run backwards, gives two normals.
- with and has the density ; its contours are ellipses of constant Mahalanobis distance.
- Affine maps of a Gaussian are Gaussian: ; a marginal keeps the matching blocks of and .
- Uncorrelated jointly Gaussian variables are independent; Gaussian marginals alone are not enough ( with a random sign ).
- With Cholesky : sample , , and the quadratic form is ; add jitter if the factorisation fails.
- Gaussian conditioning: , or in precision form covariance ; the conditional covariance does not depend on the observed .
06 LLN, CLT and confidence intervals
- The sample mean is a random variable with and standard error (for uncorrelated data).
- Markov: for . Chebyshev: .
- Weak law of large numbers: in probability, proved by Chebyshev with ; without a mean (Cauchy) there is no LLN.
- Central limit theorem: for i.i.d. data with finite variance, in distribution; the error of this approximation is (Berry–Esseen).
- A 95% confidence interval for a mean is (known ) or (unknown ); "95%" is the coverage of the procedure over repeated experiments.
- The Wald interval for a proportion fails for small or rare events (, : coverage 0.635); the Wilson interval fixes this.
- A Monte Carlo estimate has the error bar in any dimension; the delta method gives .
07 Concentration inequalities
- Chernoff bound: , from Markov applied to ; for i.i.d. sums it decays exponentially in .
- For Gaussian data the Chernoff bound is ; for Bernoulli() it is .
- Hoeffding's inequality: for independent , the mean satisfies .
- A variable is sub-Gaussian with proxy if for all ; bounded and Gaussian variables are, exponential variables are not.
- For values in , Hoeffding guarantees error with probability once ; grows like , Chebyshev's like .
- Union bound: ; for models at once Hoeffding needs only instead of .
- Finite-class generalisation bound: with probability , for all models; choosing the best of on one test set inflates its score by up to this amount.
08 Maximum likelihood
- The likelihood is the probability of the observed data as a function of ; it is not a density over . Work with the log-likelihood .
- MLEs: Bernoulli ; Poisson ; exponential ; Gaussian , .
- Invariance: the MLE of is for any one-to-one .
- An estimator is a random variable: . Unbiased is not the same as best; and beat in MSE for Gaussian data.
- The variance estimate has mean ; for an exponential rate has mean .
- Consistency: in probability; is enough. The MLE is consistent under regularity conditions.
- Maximum likelihood minimises , the cross-entropy; mean squared error and cross-entropy losses are Gaussian and Bernoulli/categorical NLLs.
- Exponential family : , , the log-likelihood is concave in , and the MLE matches to the sample average of .
09 Fisher information
- The score has mean 0 at the true (under regularity conditions).
- Fisher information: , the expected curvature of the log-likelihood; i.i.d. observations carry .
- Examples: Bernoulli , Poisson , exponential rate , Gaussian mean .
- Cramér–Rao: an unbiased has ; proof by and Cauchy–Schwarz. Biased estimators can go below it.
- The MLE is asymptotically normal and efficient: .
- Wald interval: , or with the observed information ; for several parameters use .
- The theory needs a support that does not depend on , an interior and a large enough ; Uniform() has error of order , and Wald intervals fail near .
10 Bayesian inference
- Bayes' rule for a parameter: posterior likelihood prior, ; the evidence only normalises.
- Beta–Bernoulli: prior Beta() and successes in trials give Beta(); the prior acts as pseudo-observations, and sequential updates equal one batch update.
- Gaussian–Gaussian (known ): precisions add, , and the posterior mean is the precision-weighted average of and .
- MAP = regularised MLE: ; an L2 penalty is a Gaussian prior (), an L1 penalty a Laplace prior. The MAP is not invariant under reparametrisation.
- Shrinkage trades bias for variance: the Gaussian posterior mean beats in MSE exactly when .
- Every exponential family has a conjugate prior; Gamma() with Poisson counts gives Gamma().
- The posterior predictive adds parameter uncertainty to the noise, so it is wider than a plug-in; Gaussian: .
- A credible interval is a probability statement about given the data and the prior; a confidence interval is a statement about the procedure. For large in regular models they agree (Bernstein–von Mises).
11 Hypothesis testing
- A test fixes a null hypothesis , a statistic and a level ; it rejects when the p-value is at most .
- Type I error = rejecting a true (probability at most ); type II error = missing a real effect (probability ); power .
- For a z-test, power (one-sided): it depends only on , so twice the effect needs a quarter of the data.
- Under a continuous the p-value is Uniform(0, 1); it is not and not an effect size.
- The t statistic has the distribution for Gaussian data; use a paired test for paired data and Welch's test for two independent groups.
- For a table, Pearson's equals the square of the pooled two-proportion .
- Duality: a confidence interval is the set of null values that the level- test does not reject.
- For tests, Bonferroni () controls the FWER under any dependence; Benjamini–Hochberg (largest with ) controls the FDR at for independent tests.
12 Bootstrap and A/B tests
- A permutation test shuffles the group labels; under exchangeability it is exact, and the Monte Carlo p-value satisfies for every .
- The bootstrap resamples the data with replacement to approximate the sampling distribution of a statistic; a resample contains about of the distinct points.
- The bootstrap standard error is the SD of the replicates, and the percentile interval uses their and quantiles; check coverage by simulation.
- The bootstrap fails for extremes (the maximum: coverage 0), heavy tails, dependent data (use a block or cluster bootstrap) and very small .
- Users per arm of an A/B test: for and power 0.8.
- Peeking at the p-value and stopping at the first inflates the type I error (about 0.25 with 20 looks); fix in advance or use a sequential design.
- A sample-ratio mismatch (a χ² test of the assignment counts) signals a bug; do not trust the result until it is explained.
- CUPED, with a pre-experiment covariate , reduces the variance by the factor and stays unbiased; a covariate that the treatment can change biases it.
13 Regression: the statistics view
- The linear model is ; OLS gives (compute it with QR), and it is the Gaussian MLE.
- is random: and ; in simple regression , so spread-out values give precise slopes.
- is unbiased for , because ; with Gaussian errors .
- The confidence interval for the mean response at uses and shrinks to 0 with more data; the prediction interval for a new uses and tends to .
- never decreases when features are added; nested models are compared with the -test, and for one coefficient.
- Gauss–Markov: under uncorrelated, equal-variance errors, OLS has the smallest covariance among linear unbiased estimators (BLUE).
- Residual plots check the assumptions: curvature biases , heteroscedastic or correlated errors make the classical standard errors wrong, and high-leverage points can hide in the residuals.
- Bayesian linear regression with prior has posterior with ; is ridge with , and the predictive variance is .
14 Monte Carlo and importance sampling
- Monte Carlo estimates by , with standard error in any dimension; report .
- For a rare event of probability , the relative error is about : you need about draws for 10% accuracy.
- Rejection sampling with an envelope gives exact draws from with acceptance rate ; it needs a proposal with tails at least as heavy as the target, and fails in high dimension.
- Importance sampling: ; the estimator is unbiased, its variance is , and the best proposal is .
- A proposal lighter-tailed than the target gives infinite-variance weights: unbiased, but with no valid error bar, and the failure is silent.
- Self-normalised IS divides by , needs only up to a constant, is biased by but consistent; is an unbiased estimate of . Compute it with log-weights.
- The effective sample size diagnoses weight collapse; a small value proves trouble, a large value does not prove success.
- A control variate with known mean reduces the variance by the factor at ; antithetic pairs give the factor and help for monotone .
15 Markov chains and MCMC
- A finite Markov chain evolves as ; a stationary distribution solves , (a left eigenvector of for eigenvalue 1).
- If the chain is irreducible and aperiodic, from any start, with error roughly ; irreducibility alone gives the ergodic theorem, .
- Detailed balance implies ; it is sufficient, not necessary.
- Metropolis–Hastings accepts with probability and records again on a rejection; it satisfies detailed balance and needs only ratios of , so the normalising constant is never needed.
- Gibbs sampling draws each coordinate from its full conditional; it is Metropolis–Hastings with acceptance 1, and for a bivariate Gaussian with correlation each coordinate is AR(1) with coefficient .
- HMC adds a momentum , follows with leapfrog steps (volume preserving, reversible, energy error ), and accepts with probability .
- ESS with ; for AR(1) with coefficient , .
- Split- compares between-half-chain and within-half-chain variance over at least 4 chains; trust results only with , total ESS above 400 and no divergences, and remember that chains stuck in the same mode still agree.