Statistical & Mathematical Methods for Data Science · Chapter 4

Introduction to Data Analysis — levels of measurement & descriptive statistics

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.

Definitions — each with an example Case scenarios — descriptive, multi-part Calculations — mean · median · variance · s
01

What is statistics? Three jobs, one purpose

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.

The definition — learn it verbatim

“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.

Example: A university wants to know if students sleep enough. Design: decide to survey 300 students across all faculties. Describe: the mean sleep is 6.4 hours, median 6.5, s = 1.3. Decide: the data suggest most students are below the recommended 8 hours — so the university infers a campus-wide problem and acts. Three jobs, one study.

🗂️ Design studies

Plan how data will be collected before collecting it — who is in the population, who gets sampled, what gets measured.

Example: Deciding that “all Ryan's friends” (25 people) is the population for a study of marital status.

📊 Describe data

Descriptive statistics: graphical and numerical techniques that summarise a collection of data — tables, percentages, averages, spread. This chapter.

Example: “72% of the 25 friends are single, 24% married, 4% divorced” — the whole dataset in one line.

🔮 Make inferences

Inferential statistics: procedures for generalising from a sample to the population it came from — the leap beyond the data you actually hold.

Example: Surveying 1,000 voters and estimating the whole country's voting intention.
Exam trap — why summarise at all? The chapter's own answer: because we are usually interested in what a typical person (or country, school, parliament…) looks like. A descriptive statistic is a deliberate trade — we throw away detail to gain a picture of the typical case. Every scenario in this chapter is really asking: was the right detail thrown away?
02

Definition flip-cards — each with an example

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.

03

Levels of measurement — not all numbers are numbers

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.

Which average is legal at which level?

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.

LevelModeMedianMeanHow the data are summarised
Nominal✓ Yes✗ No✗ No *Counts and percentages in a table
Ordinal✓ Yes✓ Yes✗ NoMedian + percentages per category
Interval✓ Yes✓ Yes✓ YesFull 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.

🎮 Which average? — the legal-statistic game

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.

Loading…

Score: 0 / 0 answered · Item 1 of 8

04

The three averages — mean, median, mode

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.

FriendEllenJennyJustinAndrewMungo
Salary£75,000£13,000£31,000£26,000£15,000
The mean — x̄

The most usual measure of central tendency: the sum of the measurements divided by the number of observations.

x̄ = Σx ÷ n = 160,000 ÷ 5 = £32,000
Reading it: if the five friends pooled their salaries and shared them equally, each would get £32,000. The mean is the equal-share value — which is why every observation, including Ellen's £75,000, pulls on it.
The median

Rank all observations; the median is the observation in the middle — half the observations above it, half below.

13, 15, 26, 31, 75 → median = £26,000
Even-count rule: with an even number of observations there are two middle values — average them. The slide's worked line: ½ × (26,000 + 31,000) = £28,500. The median only cares about position, never about how extreme the extremes are.
The mode

The most commonly occurring value. The only average that works for nominal data — and the only one that can fail to exist.

53 politics · 40 sociology · 46 other → mode = politics
Check the salaries: all five salaries are different, so this dataset has no mode. A mode must actually repeat. Two values tied at the top = bimodal.

Properties: what you may do to each average

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.

OperationMeanMedianWorked on the salaries
Shift of origin — everyone gains £2,000✓ Just add it✓ Just add itMean 32,000 → 34,000 · Median 26,000 → 28,000
Change of scale — convert £ to $ at £1 = $2✓ Just rescale✓ Just rescaleMean £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 holdThe person with the median salary is not necessarily the person with the median income — so medians can't be added.
Why we still default to the mean: the “sum of two variables” property is exactly why the mean dominates statistical analysis in the following weeks — means combine, medians don't. The median's revenge: it is robust to outliers, which is Section 06.
Special case — binary nominal data

The one time the mean is legal for nominal data

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.

(1 + 1 + 1 + 0 + 0) ÷ 5 = 0.6 → 60% are men

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 ✗.

Exam phrasing: “The mean of a 0/1 variable is interpreted as a proportion, not as an average category.” If a scenario codes pass = 1, fail = 0 and reports a mean of 0.83, the correct reading is “83% passed.”
05

Calculation lab — every statistic, step by step

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).

n — count
–
Σx — the sum
–
Mean — x̄ = Σx ÷ n
–
Median — middle ranked value
–
Mode — most frequent
–
Range — max − min
–
Σ(x − x̄)² — squared deviations
–
Variance — s² = Σ(x − x̄)² ÷ n
–
Standard deviation — s = √s²
–
Sample versions — ÷ (n − 1)
–

Worked by hand — the variance table from the slides

Mean salary = 32 (£000s). Each deviation (x − x̄) is squared, because the raw deviations always sum to zero:

SalaryDeviationSquared
7575 − 32 = 4343 × 43 = 1,849
1313 − 32 = −19−19 × −19 = 361
3131 − 32 = −1−1 × −1 = 1
2626 − 32 = −6−6 × −6 = 36
1515 − 32 = −17−17 × −17 = 289
Σ(x − x̄)²2,536
s² = 2,536 ÷ 5 = 507.2  ·  s = √507.2 ≈ 22.5 (£000s)

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.

🎯 Quick-fire calculation drill

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.

Loading…

Score: 0 / 0 answered

06

Mean vs median — when the centre isn't in the middle

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.

Median markerMean marker

Pen's parade of dwarfs and a few giants

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:

median person · ≈ £16,000 mean person · ≈ £24,000

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.

The chapter's two head-to-heads

25 friends — median
£26k
25 friends — mean
£34k
UK income — median
£16k
UK income — mean
£24k

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.

The rule to write in the exam: for data with outliers (a long tail), the median gives the better idea of the typical observation; the mean is the better tool when the distribution is roughly symmetric — and the only one with the algebraic properties analysis needs.
Reading skew from two numbers: mean > median → long tail to the right (a few very large values). Mean < median → tail to the left. Mean ≈ median → roughly symmetric. Examiners give you the two numbers and ask for the shape — this is the whole trick.
07

Spread — the centre is only half the story

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.

s = 1.02 · Tight

Everyone performs similarly

test scores → bunched around the mean of 7

The mean describes almost everybody. A “typical distance from the mean” of about 1 mark.

s = 1.67 · Clustered

Similar level, some variation

test scores → a hump, but a wider one

Most children are near 7, but the tails reach noticeably further. Same centre, looser fit.

s = 4.01 · Dispersed

Geniuses and strugglers

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.

The range

Max minus min — and nothing else

Range = 75,000 − 13,000 = £62,000

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.

Use it for: a quick first glance, and spotting data-entry errors. Never alone: always pair it with a measure that uses every observation — the standard deviation.
Variance & standard deviation

Average distance from the mean — done honestly

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).

s² = Σ(x − x̄)² ÷ n  ·  s = √s²
How to say it in words: s is a rough average distance of an observation from the mean. Salaries: s ≈ £22,500 means a typical friend's salary sits about £22,500 away from the £32,000 mean — and because s carries the units (£, marks, minutes), it can only be compared within the same measure.
The two denominator question: divide Σ(x − x̄)² by n when your data are the whole population (the slides' headline salary answer: 507.2, s = 22.5); divide by n − 1 when they are a sample used to estimate the population's spread (634, s ≈ 25.2). If an exam question says “sample,” reach for n − 1 — and write the denominator you used.
08

How (not) to lie with statistics

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:

🗺️ Too little information

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.

The lesson: a mean with no information about the distribution can be accurate and useless at the same time.

📅 Picking your base year

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.

The defence: always ask “why does this series start there? What happened just before the first point?”

🔀 Measures over time

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.

The defence: check whether the thing being measured stayed the same thing across the whole graph.

🩺 The lie factor

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.

The defence: compare the numbers, not the picture's area.

🏆 Small differences, big rankings

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%+.

The defence: ask for the actual gap between ranks, not just the order.

🐱 (Very) small samples

“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.

The defence: no n, no belief. A percentage without a sample size is an advertisement, not a statistic.

How to talk back to a statistic — the chapter's four questions

1 · Who says so?

We all want to prove our own theories correct. Who produced this number, and what result were they hoping for?

2 · How does he know?

Is the data reputable? Was it collected properly — a real sample, honestly measured — or assembled to fit the claim?

3 · What's missing?

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.

4 · Does it make sense?

Social science is mostly the science of the obvious. Don't let numbers fool you — if it sounds wrong, it probably is.

09

Case scenarios — descriptive and complex

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.

10

Rapid fire — last-ten-minutes revision

Short questions, short answers — the definitions and one-line calculations most likely to appear verbatim. Cover the answer, say yours out loud, then reveal.