STATS 101 · Module 1
Data, samples and describing data
By the end of today you can say where data come from, what kind they are, and what they say.
Why statistics?
Statistics draws conclusions from data that vary
- Descriptive statistics summarise the data we have: tables, graphs, averages. Most of today.
- Inferential statistics use a sample to draw conclusions about a larger population, with a measure of uncertainty. Later modules.
Image: everyday statistics: an opinion poll, a weather forecast, a clinical trial
Today
Three questions run through today's lecture
Where do the data come from?
Populations, samples and study design
What kind of data are they?
Types of variables
What do the data say?
Graphs, centre, spread and shape
London, 1854
A map of deaths pointed to one water pump
During a cholera outbreak in Soho, John Snow marked each death on a street map.
The deaths clustered around one pump on Broad Street. The pump's handle was removed.
Image: John Snow's 1854 map of cholera deaths around the Broad Street pump
United States, 1936
2.4 million replies lost to 50,000 well-chosen people
Bars to scale. Roosevelt won about 61% of the popular vote and 46 of the 48 states.
The lesson of 1936
A huge biased sample is worse than a small, well-chosen one.
Where do the data come from?
We measure a sample to learn about a population
Memory aid: Population goes with Parameter; Sample goes with Statistic.
What kind of data are they?
Every variable is categorical or numerical
Watch out: a postcode or a student ID is categorical; averaging them means nothing.
What kind of data are they?
20 kg is twice 10 kg, but 20 °C is not twice as hot as 10 °C
| Nominal | Ordinal | Interval | Ratio |
| Order? | no | yes | yes | yes |
| Equal intervals? | no | no | yes | yes |
| True zero? | no | no | no | yes |
| Example | eye colour | race finishing position | temperature in °C | weight, income, time |
Only a randomised experiment can show cause and effect
Observational study
Observe without assigning treatments. Association, not causation.
Experiment
- Assign treatments; compare outcomes
- Control group + random assignment
Where do the data come from?
Random methods give everyone a fair chance; convenience does not
Each panel: the same 20 people in 4 groups. Filled dots are the sample.
A bigger sample does not fix bias
- Selection bias. The way the sample is chosen leaves out part of the population.
- Non-response bias. The people who don't respond differ from those who do.
- Response bias. Wording or setting pushes an answer: "Don't you agree that…?"
- Voluntary response bias. Only people with strong opinions take part.
- Size is no cure. A bigger biased sample only looks more precise.
The type of data picks the graph
| Data | Graph | What it shows |
| One categorical variable | Bar chart (or pie chart) | Counts or percentages per category |
| One numerical variable | Histogram | Shape of the distribution |
| One numerical variable | Box plot | Five-number summary and outliers |
| Two numerical variables | Scatter plot | Relationship: direction, form, strength |
| A variable over time | Line graph | Trends |
What do the data say?
Always plot the data before computing anything
Anscombe's quartet, 1973: 11 points each, mean of x 9, mean of y about 7.50, correlation about 0.816, line y = 3 + 0.5x.
What do the data say?
Describe a distribution by its shape, centre and spread
Then add unusual features: outliers and gaps.
What do the data say?
The mean shares out the total; the median is the middle
x̄ = Σx / n
- x̄
- the mean of the sample
- Σx
- the sum of all the values
- n
- how many values there are
- Median
- the middle of the ordered values
- Mode
- the most frequent value
Commutes (min): 12, 15, 15, 18, 20, 22, 25, 27, 30, 76. Sum 260, n = 10: mean 26, median 21, mode 15.
What do the data say?
One long commute pulls the mean, but barely moves the median
Use the median for skewed data such as house prices and incomes; the mean for roughly symmetric data.
What do the data say?
The range is 64 minutes, but the middle half spans only 12
64 minRange: 76 − 12
12 minIQR: 27 − 15, the middle 50%
18.5 minStandard deviation
What do the data say?
One outlier triples the standard deviation
s = √( Σ(x − x̄)² / (n − 1) )
- s
- the sample standard deviation
- x − x̄
- a value's distance from the mean
- s²
- the variance (before the root)
- n − 1
- divide by n − 1 for a sample
Commutes: variance ≈ 341.3, s ≈ 18.5 min. Without the 76: s ≈ 6.1 min.
What do the data say?
The 76-minute commute lies beyond the cut-off: it is an outlier
Five-number summary 12, 15, 21, 27, 76. 1.5 × IQR = 18, so the cut-offs are −3 and 45.
What do the data say?
A z-score counts standard deviations from the mean
z = (x − mean) / SD
- z
- SDs above (+) or below (−) the mean
- x
- the value
- mean
- the mean of the data
- SD
- the standard deviation
Exam with mean 70, SD 8. A score of 86: z = (86 − 70) / 8 = 2, two SDs above the mean.
What do the data say?
In a bell curve, 68% lie within 1 SD, 95% within 2, 99.7% within 3
Exam scores, mean 70, SD 8. The rule needs roughly bell-shaped data; it does not fit skewed data like the commutes.
Correlation is not causation
Ice-cream sales and drownings rise together, but hot weather drives both
Other reasons for a correlation without causation: reverse causation, and coincidence when many variables are searched.
Check your understanding · 1 of 6
Is "favourite colour" categorical or numerical, and at what level?
- Categorical, nominal
- Categorical, ordinal
- Numerical, discrete
- Numerical, continuous
Check your understanding · 2 of 6
A survey on exercise only asks people leaving a gym. What is the problem?
- Response bias from the wording
- Selection bias from a convenience sample
- Non-response bias
- The sample is too small
Check your understanding · 3 of 6
Find the mean and median of 2, 4, 4, 5, 10.
- Mean 4, median 5
- Mean 5, median 5
- Mean 5, median 4
- Mean 4, median 4
Check your understanding · 4 of 6
Which is resistant to outliers: the mean or the median?
- The mean
- The median
- Both
- Neither
Check your understanding · 5 of 6
An exam has mean 70 and SD 8. What is the z-score of 82?
- 1
- 1.5
- 2
- 12
Check your understanding · 6 of 6
Ice-cream sales and drownings are correlated. Does ice cream cause drowning?
- Yes: the correlation is strong
- No: hot weather drives both
- Yes: sales come first
- No: drowning causes sales
You can now turn data into conclusions, despite variation
Collecting data
- Population → parameter (μ, σ); sample → statistic (x̄, s)
- Categorical or numerical; variable types and levels
- Random samples + randomised experiments; bias matters
Describing data
- Always plot first (Anscombe)
- Centre: mean, median, mode. Spread: range, IQR, SD
- Outliers: below Q1−1.5×IQR or above Q3+1.5×IQR
- z = (x − mean) / SD; bell-shaped: 68–95–99.7
- Correlation ≠ causation