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

Image: everyday statistics: an opinion poll, a weather forecast, a clinical trial

Today

Three questions run through today's lecture

  1. Where do the data come from?

    Populations, samples and study design

  2. What kind of data are they?

    Types of variables

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

Digest mailedphone books, car lists about 10 million Digest repliespredicted Landon about 2.4 million: wrong Gallup's samplepredicted Roosevelt about 50,000: right
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

Population all students at the university Parameter: μ, σ usually unknown Sample 200 students who answered a survey Statistic: x̄, s we collect data from part of it the statistic estimates the parameter
Memory aid: Population goes with Parameter; Sample goes with Statistic.

What kind of data are they?

Every variable is categorical or numerical

Variable Categorical Numerical Nominalno order blood type, favouritecolour, country Ordinalnatural order satisfaction,year of study Discretecounts number of siblings,goals scored Continuousmeasurements height, time,temperature
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

NominalOrdinalIntervalRatio
Order?noyesyesyes
Equal intervals?nonoyesyes
True zero?nononoyes
Exampleeye colourrace finishing positiontemperature in °Cweight, 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

Simple random same chance for any n 100 random IDs Stratified random from each group 25 per year of study Cluster pick whole groups 5 whole sections Systematic every k-th, random start every 20th name Convenience easiest to reach not random: avoid
Each panel: the same 20 people in 4 groups. Filled dots are the sample.

A bigger sample does not fix bias

The type of data picks the graph

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 plotRelationship: direction, form, strength
A variable over timeLine graphTrends

What do the data say?

Always plot the data before computing anything

I II III IV straight-line cloud a curve line + one outlier stack + one far point
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

Symmetricone peak, sides alike Skewed rightlong tail right: incomes Skewed leftlong tail to the left Bimodaltwo peaks
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

01020304050607080 minutes mode 15 median 21 mean 26 without the 76:mean ≈ 20.4, median 20
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

01020304050607080 minutes Q1 15 median 21 Q3 27 1230 lower cut-off −3 upper cut-off 45 76: 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

46546270788694 about 68% about 95% about 99.7% 86: z = 2 better than about 97.5%
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

Ice-cream sales Drownings rise and fall together Hot weather confounding variable not cause and effect
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?

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

Check your understanding · 2 of 6

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

  1. Response bias from the wording
  2. Selection bias from a convenience sample
  3. Non-response bias
  4. The sample is too small

Check your understanding · 3 of 6

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

  1. Mean 4, median 5
  2. Mean 5, median 5
  3. Mean 5, median 4
  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
  3. Both
  4. Neither

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 is strong
  2. No: hot weather drives both
  3. Yes: sales come first
  4. 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