Probability and Statistics
Chance and data, computed in Python: counting, conditional probability, Bayes, expected value, the binomial and normal distributions, sampling, confidence intervals, hypothesis tests and regression.
- 1
Outcomes and probability
Sample spaces, events and the classic formula: favourable outcomes over all outcomes, by counting dice.
- 2
Rules: not, or, and
The complement rule, the addition rule for 'or' with its overlap, and multiplying probabilities of independent events.
- 3
Conditional probability
P(A given B): probability inside a smaller world, from a table of counts and from drawing cards without replacement.
- 4
Bayes' theorem
Turning P(positive | sick) into P(sick | positive), and why a 99%-accurate test can still be wrong most of the time.
- 5
Random variables and expected value
A random variable gives each outcome a number; its expected value is the long-run average, and variance measures the spread.
- 6
The binomial distribution
Counting successes in n independent yes/no trials: the formula C(n, k) pᵏ(1 − p)ⁿ⁻ᵏ, its mean np, and a full table for 10 coin flips.
- 7
The normal distribution
The bell curve, the 68-95-99.7 rule, z-scores, and computing probabilities with the error function.
- 8
Describing data
Mean, median and mode, range, variance and standard deviation, and how one outlier moves the mean but not the median.
- 9
Sampling and the central limit theorem
Why averages of samples are close to normal, even when the data are not, and why their spread shrinks with √n.
- 10
Confidence intervals
An estimate with an honest margin: mean ± 1.96 standard errors, what 95% confidence does and does not mean.
- 11
Hypothesis testing and p-values
Is a coin fair? Null and alternative hypotheses, the p-value computed exactly from the binomial, and what 'significant' means.
- 12
Correlation and regression
Measuring how two variables move together with Pearson's r, fitting the least-squares line, and why correlation is not causation.