Statistics recap
A working set of notes for applied statistics — descriptive stats, distributions and the everyday tables. Numbers in formulas use μ, σ for a whole population and x̄, s for a sample.
Sampling
Before any statistic means anything, the sample has to represent the population. A good sample is spread across the whole population; a bad sample clusters in one place and misses the rest.
Good sample
even coverage
Bad sample
clustered, with a couple of strays
Centre & spread
Two questions about any dataset: where is the middle (central tendency), and how far do values wander from it (spread)?
Central tendency
- Mean — the average. Uses every value, so it gets dragged toward extreme values.
- Median — the middle value when sorted. More resistant to outliers than the mean.
- Mode — the most frequent value. Comes in three flavours:
1, 2, 3, 3, 3, 4, 51, 1, 1, 2, 3, 3, 3, 4, 51, 1, 2, 3, 3, 4, 5, 5Spread — variance & standard deviation
Variance is the average squared distance from the mean. Standard deviation is its square root, putting spread back into the original units — roughly “how far is a typical value from the mean?”
| Population | Sample | |
|---|---|---|
| Mean | μ = Σx / N | x̄ = Σx / n |
| Variance | σ² = Σ(x − μ)² / N | s² = Σ(x − x̄)² / (n − 1) |
| Std deviation | σ = √σ² | s = √s² |
A sample divides by n − 1 (Bessel’s correction): a sample tends to underestimate the true spread, so we shrink the denominator to compensate.
Spread — the interquartile range (IQR)
The quartiles cut the sorted data into four. IQR = Q3 − Q1 — the range of the middle 50%.
- Small IQR → values clustered near the centre.
- Large IQR → values spread out.
The distribution curve
One graph for most of it. Move the mean to slide the curve, change the spread to make it taller/narrower or shorter/wider, and add skew to pull a tail. Toggle the layers to see the empirical rule, Chebyshev’s bounds, the mean/median/mode split, and a z-score.
Normal distribution & the empirical rule
A normal distribution is the symmetric bell. Because its shape is fixed and predictable, set proportions fall within each band of the mean:
The smooth bell is a density curve: the y-axis is probability density, not count, and the total area under it is 1. Probability = area under a stretch of the curve.
z-scores
A z-score restates a value as “how many standard deviations from the mean”, so values from different distributions become comparable.
Look up the area (probability) for a z-score at ztable.io.
Chebyshev’s theorem — any shape
The empirical rule needs a normal shape. When the distribution is skewed or unknown, Chebyshev still gives a guaranteed minimum proportion within k standard deviations — it works for any shape, so it’s more conservative.
| k (std devs) | 2 | 3 | 4 |
|---|---|---|---|
| Normal (empirical) | 95% | 99.7% | — |
| Any shape (Chebyshev, at least) | 75% | 89% | 94% |
k must be > 1 (at k = 1 the formula gives 0, so no useful bound). k is just a z-score: k = (x − μ) / σ.
Shape: symmetry, skew & outliers
Where the mean, median and mode sit relative to each other tells you the shape. The mean chases the tail.
Left (negative) skew
tail on the left
mean < median < mode
Symmetric
no tail
mean = median = mode
Right (positive) skew
tail on the right
mode < median < mean
▮ mean ┄ median ··· mode
Which measures to use
| Shape | Best centre | Best spread |
|---|---|---|
| Symmetric / normal | Mean | Standard deviation |
| Skewed / has outliers | Median | IQR |
When a tail or outlier would drag the mean and standard deviation around, switch to the median and IQR — both ignore the extremes.
Spotting outliers — the 1.5×IQR rule
A value is an outlier if it falls outside the fences:
Plots
Box & whiskers
Draws the five-number summary (min, Q1, median, Q3, max). The box is the IQR; whiskers reach the last value inside the fences; dots beyond them are outliers. Great for comparing spread and skew, and for seeing outliers at a glance.
Stem & leaf
Keeps the raw values while showing the shape (like a histogram on its side). The stem is the leading digit(s), each leaf the last digit. Best for small datasets. Below: 23, 25, 31, 34, 34, 42, 47, 48, 51.
stem | leaf 2 | 3 5 3 | 1 4 4 4 | 2 7 8 5 | 1
Histogram, frequency polygon & density curve
A histogram bins continuous data and draws a bar per bin (bars touch). A frequency polygon joins the bar midpoints with a line. A density curve is the smooth, idealised version — the population shape the data is hinting at. All three show centre, spread, skew and modality.
Tables & distributions
A one-way table counts one variable. A two-way (contingency) table cross-tabulates two. From one two-way table you can read every distribution below. Example: 100 students, by year and whether they drink coffee.
| Coffee: yes | Coffee: no | Total | |
|---|---|---|---|
| Junior | 30 | 20 | 50 |
| Senior | 45 | 5 | 50 |
| Total | 75 | 25 | 100 |
- Relative frequency — counts ÷ total, i.e. proportions instead of raw counts.
- Joint distribution — each inner cell ÷ grand total. P(Junior and Yes) = 30/100 = 0.30.
- Marginal distribution — a total (margin) ÷ grand total. P(Junior) = 50/100 = 0.50; P(Yes) = 75/100 = 0.75.
- Conditional distribution — a cell ÷ its row/column total (you’re given one variable). P(Yes given Senior) = 45/50 = 0.90.
The joint distribution as area — each of the 100 squares is one student, grouped by the four cells. The block sizes are the joint proportions:
Junior·Yes (30) Junior·No (20) Senior·Yes (45) Senior·No (5)