Statistical & Mathematical Methods for Data Science · Chapter 4
Everything in PPT 4, rebuilt so you can see it: the key terms (population, sample, parameter, statistic), the levels of measurement, and the full descriptive-statistics toolkit — mean, median, mode, range, variance and standard deviation — worked through the chapter's own datasets: Ryan's five best friends' salaries, the 25 friends' marital status, and the nuclear-weapons exercise. Every definition is paired with a worked example, and the case scenarios are long and multi-part, the way a real exam case is.
This chapter opens the whole data-analysis course: using quantitative data — anything we can count — to better understand the world. The slide definition gives statistics three jobs; examiners ask for all three.
“Statistics is the set of methods for designing and carrying out research studies, describing collected data, and making decisions / inferences about phenomena represented by data.”
Notice the order: design → describe → decide. This chapter is mostly about job 2 — describing data — but every description exists so that job 3, a decision, can be made from it.
Plan how data will be collected before collecting it — who is in the population, who gets sampled, what gets measured.
Descriptive statistics: graphical and numerical techniques that summarise a collection of data — tables, percentages, averages, spread. This chapter.
Inferential statistics: procedures for generalising from a sample to the population it came from — the leap beyond the data you actually hold.
Front: the chapter's own wording — try to say the example out loud before you flip. Back: a worked example plus the trap that costs marks. Tap a card to flip it.
A variable is a measurement of a characteristic that varies across subjects — but variables come at different levels of measurement, and the level decides which statistics are even legal. This chapter works through the first three levels in detail; the fourth (ratio, from Chapter 3) completes the ladder. Tap each step.
This table is the chapter compressed into one screen. The rule underneath it: each statistic needs the information its level provides — the mode needs only categories, the median needs order, the mean needs real distances.
| Level | Mode | Median | Mean | How the data are summarised |
|---|---|---|---|---|
| Nominal | ✓ Yes | ✗ No | ✗ No * | Counts and percentages in a table |
| Ordinal | ✓ Yes | ✓ Yes | ✗ No | Median + percentages per category |
| Interval | ✓ Yes | ✓ Yes | ✓ Yes | Full descriptive statistics: mean, median, s… |
* The one exception is binary nominal data coded 0/1 — its mean is the proportion of 1s. See the special case in Section 04.
Eight situations. For each one, pick the average that is legal and sensible for that variable. The explanation gives the rule — that reasoning is what the exam marks.
Score: 0 / 0 answered · Item 1 of 8
Central tendency means reducing a lot of interval-level measurements to a few numbers that describe the centre. The chapter's running dataset: the salaries of Ryan's five best friends. Every average below is computed on these same five numbers, so you can watch them disagree.
| Friend | Ellen | Jenny | Justin | Andrew | Mungo |
|---|---|---|---|---|---|
| Salary | £75,000 | £13,000 | £31,000 | £26,000 | £15,000 |
The most usual measure of central tendency: the sum of the measurements divided by the number of observations.
Rank all observations; the median is the observation in the middle — half the observations above it, half below.
The most commonly occurring value. The only average that works for nominal data — and the only one that can fail to exist.
The slides test the mean and median against three operations. The median fails exactly one — and the chapter warns this failure matters in later weeks.
| Operation | Mean | Median | Worked on the salaries |
|---|---|---|---|
| Shift of origin — everyone gains £2,000 | ✓ Just add it | ✓ Just add it | Mean 32,000 → 34,000 · Median 26,000 → 28,000 |
| Change of scale — convert £ to $ at £1 = $2 | ✓ Just rescale | ✓ Just rescale | Mean £32,000 → $64,000 · Median £26,000 → $52,000 |
| Sum of two variables — income = salary + savings interest | ✓ Mean income = mean salary + mean interest | ✗ Does NOT hold | The person with the median salary is not necessarily the person with the median income — so medians can't be added. |
Binary data (Yes/No, Male/Female) can be coded as 0 or 1 — and then the mean of those 0s and 1s is simply the proportion of 1s. Among the five best friends, code men = 1 and women = 0: there are 3 men and 2 women.
The median does NOT make sense for binary data — it merely tells you what the majority is (here it would say “1 = man,” adding nothing). So the exception runs one way only: binary → mean ✓ (as a proportion), median ✗.
Type any dataset and watch all of this chapter's statistics build themselves with their workings shown: n, Σx, mean, median, mode, range, Σ(x − x̄)², variance and standard deviation. It starts with the chapter's own salaries (in £000s, exactly as the slides tabulate them).
Mean salary = 32 (£000s). Each deviation (x − x̄) is squared, because the raw deviations always sum to zero:
| Salary | Deviation | Squared |
|---|---|---|
| 75 | 75 − 32 = 43 | 43 × 43 = 1,849 |
| 13 | 13 − 32 = −19 | −19 × −19 = 361 |
| 31 | 31 − 32 = −1 | −1 × −1 = 1 |
| 26 | 26 − 32 = −6 | −6 × −6 = 36 |
| 15 | 15 − 32 = −17 | −17 × −17 = 289 |
| Σ(x − x̄)² | 2,536 | |
The slides note we usually divide by n − 1 for a sample: 2,536 ÷ 4 = 634, s ≈ 25.2. The headline numbers above divide by n. Know both — and say which denominator you used.
Eight short computations in the chapter's own style. Do them in your head or on paper first — the exam gives no calculator mercy for slow arithmetic.
Score: 0 / 0 answered
For the mean and median to be equal, the distribution must be symmetrical. Give it a long tail to the right — a few very large values — and the mean gets dragged toward the tail while the median stays with the typical case. Switch the two datasets and watch the two markers separate.
Line everyone in a country up by income, shortest (poorest) first, and let them march past in an hour. Most of the parade is dwarfs; a few giants tower near the end. Schematic, after the chapter:
The person of mean income would be richer than 65% of the whole parade — they wouldn't pass until 40 minutes of the hour had gone. That is what a right tail does to the mean, in one picture.
When all 25 friends and acquaintances are plotted (not just the best five), the mean rises to £34,000 while the median stays at £26,000 — a £8,000 gap created purely by the shape of the distribution.
Three classes take the same maths test: 48 observations, mean 7, median 7 — in all three. Yet the classes are nothing alike. Measures of dispersion exist because a centre with no spread is a summary that can lie by omission.
test scores → bunched around the mean of 7
The mean describes almost everybody. A “typical distance from the mean” of about 1 mark.
test scores → a hump, but a wider one
Most children are near 7, but the tails reach noticeably further. Same centre, looser fit.
test scores → two humps, almost nobody at 7
Mean 7 describes almost no actual child — the class is two groups, not one. The large s is the warning light.
Simple, and fragile: it uses only two observations — the two most extreme ones. The chapter's demolition example: 1,000 poker players, 999 win nothing and one wins £1 million. The range screams “huge variation” while 99.9% of the players are identical.
The idea: measure how far each value sits from the mean. The deviations sum to zero (positives cancel negatives), so we square each deviation, average the squares → variance (s²) — then take the square root to return to the original units → standard deviation (s).
Even honest descriptive statistics can be arranged to mislead — most of the chapter's examples come from Tufte's The Visual Display of Quantitative Information (1983). Six tricks to recognise on sight:
Washoe County, Nevada (Tukey, 1979): mean population density is 13½ people per square mile — a true mean that describes almost nowhere. In fact 80% of inhabitants live in two cities at ~5,000 per square mile; the rest of the county sits at 2½ per square mile.
Start a graph in an unusually bad (or good) year and every later value looks like dramatic growth (or decline). The data don't change — the starting point does the persuading.
Change the definition, the boundary or the counting method halfway through a series, and the “trend” is partly just the change of ruler. Series that jump at exactly the year the method changed are confessing.
Tufte's ratio: size of the effect shown in the graphic ÷ size of the effect in the data. Classic case: a picture of a doctor scaled up in both height and width — double the height and the area (what your eye reads) quadruples, so “doctors are getting smaller/bigger” shouts far louder than the numbers say. A truthful graphic has lie factor ≈ 1.
Something is always top of a list — even when the gap is meaningless. Oxford's Norrington table: the middle ten colleges are essentially tied, yet the ranking is what everyone cares about. Literacy league tables are the same: first place 99.9%, everyone else 99%+.
“9 out of 10 cats prefer Whiskers.” Persuasive if thousands of cats were consulted; feeble if literally 10 cats were questioned out of a population of millions. The proportion sounds identical either way — only the hidden n changes.
We all want to prove our own theories correct. Who produced this number, and what result were they hoping for?
Is the data reputable? Was it collected properly — a real sample, honestly measured — or assembled to fit the claim?
The chapter's example: means are no use without standard deviations. Also hunt for the missing n, the missing base year, the missing comparison group.
Social science is mostly the science of the obvious. Don't let numbers fool you — if it sounds wrong, it probably is.
Eight full cases in the exam's own style: a situation, linked sub-questions, and a trap buried somewhere inside. Work each one properly before revealing the answer — the worked answers show the reasoning chain, not just the result.
Short questions, short answers — the definitions and one-line calculations most likely to appear verbatim. Cover the answer, say yours out loud, then reveal.