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: with a graph and a few numbers.

STATS 101Module 1 of the course50-minute lecture

Today we ask three questions of any data set

  1. Where do the data come from? populations, samples, study design
  2. What kind of data are they? types of variables
  3. What do the data say? graphs, centre, spread, shape
  4. Check your understanding six-question quiz
Image: a collage of everyday statistics: an opinion poll, a clinical trial of a new medicine, sports analytics, a weather forecast, a website A/B test

1 · Why statistics?

Statistics draws conclusions from data despite variation

Image: John Snow’s 1854 street map of Soho, with each cholera death marked and the Broad Street pump at the centre of the cluster

2 · Two stories about data

A map of deaths found the source of cholera

London, 1854. John Snow marked each cholera death in Soho on a street map.

The deaths clustered around one water pump on Broad Street. Its handle was removed.

2 · Two stories about data · 1936

A huge biased sample lost to a small well-chosen one

Literary Digest ≈ 10 million ballots mailed ≈ 2.4 million returned (from phone books and car lists) Predicted Landon would win: wrong Gallup ≈ 50,000 people, better chosen Predicted Roosevelt would win: right
Result: Roosevelt won about 61% of the popular vote and 46 of the 48 states. Bars drawn to scale.

3 · Population, sample, parameter, statistic

We study a sample to learn about a population

Population everyone we want to know about Parameter: μ, σ (usually unknown) collect data from part of it Sample the part we measure Statistic: x̄, s the statistic estimates the parameter
Memory aid: Population – Parameter; Sample – Statistic.

4 · Types of variables

Every variable is categorical or numerical

Variable Categorical Numerical Nominalno orderblood type, countryOrdinalnatural orderlow / medium / high Discretecountsnumber of siblingsContinuousmeasurementsheight, time
Watch out: a postcode or a student ID is categorical. Averaging them means nothing.

5 · Levels of measurement

Only ratio data have a true zero

NominalOrdinalIntervalRatio
Order?noyesyesyes
Equal intervals?nonoyesyes
True zero?nononoyes
Exampleeye colourrace finishing positiontemperature in °Cweight, income, time

20 °C is not “twice as hot” as 10 °C; 20 kg is twice 10 kg.

Where do the data come from?

How data are collected matters more than how much

Study design, sampling methods, and the biases that mislead.

6 · Observational studies and experiments

Only a randomised experiment can show cause and effect

Subjects assignedat random Treatment group Control groupgets a placebo Compare outcomes Double-blind: neithersubjects nor researchersknow who got what
An observational study only watches and measures, so it can show an association, not cause and effect.

7 · Sampling methods

Pick a random method; avoid convenience samples

  1. Every group of n has the same chance. Draw 100 student IDs at random.

  2. A random sample from each group. 25 students from each year of study.

  3. Randomly choose whole groups. Pick 5 lecture sections, survey everyone in them.

  4. Every k-th after a random start. Every 20th name on the class list.

  5. Whoever is easiest to reach: not random, avoid. Asking friends in the cafeteria.

A bigger sample does not fix bias

What do the data say?

Plot first, then measure centre, spread and shape

Graphs, the mean and median, IQR and standard deviation, outliers, z-scores.

9 · Graphs

Match the graph to the data, and plot first

DataGraphWhat it shows
One categorical variablebar chart (or pie chart)counts or percentages per category
One numerical variablehistogramshape of the distribution
One numerical variablebox plotfive-number summary and outliers
Two numerical variablesscatter plotdirection, form, strength
A variable over timeline graphtrends

9 · Anscombe’s quartet, 1973

Same summary numbers, four different pictures

straight-line cloudcurveline + one outlierstack + one far point
Each set: 11 points, mean of x 9, mean of y ≈ 7.50, correlation ≈ 0.816, line y = 3 + 0.5x.

10 · Describing a distribution

Describe shape, centre, spread and anything unusual

symmetricone peak, mirror halvesskewed rightlong right tail: incomesskewed leftlong tail to the leftbimodaltwo peaks
Centre: where the typical value is. Spread: how much values vary. Unusual: outliers, gaps.

11 · Measures of centre

The outlier pulls the mean; the median resists

01020304050607080 commute time (minutes), 10 students 76 mode 15 median 21 mean 26 without 76:mean ≈ 20.4, median 20
Mean x̄ = Σx / n = 260 / 10 = 26. Median: the middle of the ordered data, (20 + 22) / 2 = 21. Mode: most frequent.

12 · Measures of spread

The IQR measures the middle half: 27 − 15 = 12 minutes

12151518202225273076 median 21 lower half: Q1 = 15 upper half: Q3 = 27 IQR = Q3 − Q1 = 27 − 15 = 12 minutes Range = max − min = 76 − 12 = 64 minutes, very sensitive to outliers
Commute times, ordered. Q1 is the median of the lower half; Q3 the median of the upper half.

12 · Standard deviation

One outlier triples the standard deviation

s = √( Σ(x − x)² / (n − 1) )
s
roughly the typical distance of values from the mean
n − 1
for a sample; the sample mean sits closer to the data than the true mean

Commute: variance ≈ 341.3, s ≈ 18.5 min. Without the 76: s ≈ 6.1 min.

13 · Five-number summary, box plots and outliers

Beyond the 45-minute fence, the 76-minute commute is an outlier

-1001020304050607080 Q1medianQ3 152127 fence −3fence 45 76: outlier
Five-number summary: 12, 15, 21, 27, 76. IQR 12, so 1.5 × IQR = 18: fences 15 − 18 = −3 and 27 + 18 = 45.

14 · z-scores

A z-score counts standard deviations from the mean

z = (x − mean) / SD
SD
standard deviation; z > 0 above the mean, z < 0 below
use
compare a hard test with an easy one

Exam mean 70, SD 8: z for 86 = (86 − 70) / 8 = 2

15 · The 68–95–99.7 rule

Bell-shaped data: 68% within 1 SD, 95% within 2, 99.7% within 3

46546270788694 68% 95% 99.7% 86 (z = 2) beats≈ 97.5% of the class
Exam: mean 70, SD 8. Only for roughly bell-shaped data; not for skewed data like the commute times.

16 · Correlation is not causation

Ice cream does not cause drowning; hot weather drives both

Ice-cream sales Drownings rise and fall together Hot weather confounding variable
Other non-causal reasons: reverse causation, coincidence (especially when many variables are searched).

Check your understanding · 1 of 6

Is “favourite colour” categorical or numerical, and at what level?

  1. Categorical, nominal
  2. Categorical, ordinal
  3. Numerical, discrete
  4. Numerical, continuous

Check your understanding · 2 of 6

A survey about exercise habits only asks people leaving a gym. What is the problem?

  1. The sample is too small
  2. Selection bias: gym-goers exercise more
  3. Response bias from the wording
  4. No problem: it is random

Check your understanding · 3 of 6

Find the mean and median of 2, 4, 4, 5, 10.

  1. mean 5, median 4
  2. mean 4, median 5
  3. mean 5, median 5
  4. mean 4, median 4

Check your understanding · 4 of 6

Which is resistant to outliers: the mean or the median?

  1. The mean
  2. The median

Check your understanding · 5 of 6

An exam has mean 70 and SD 8. What is the z-score of 82?

  1. 1
  2. 1.5
  3. 2
  4. 12

Check your understanding · 6 of 6

Ice-cream sales and drownings are correlated. Does ice cream cause drowning?

  1. Yes: the correlation proves it
  2. No: hot weather is a confounding variable
  3. Yes, if the sample is big enough

Summary · next: Module 2, Probability

You can now ask three questions of any data set

Where from?

  • Population → parameter (μ, σ); sample → statistic (x̄, s)
  • Collect at random; more biased data doesn’t help

What kind?

  • Categorical: nominal, ordinal
  • Numerical: discrete, continuous

What do they say?

  • Plot first; mean vs median; IQR, SD
  • 1.5 × IQR; z; 68–95–99.7
  • Correlation is not causation