One-variable statistics

Print the chapter

Every lesson of the chapter, ready for paper. Exercise sets are lettered A, B, C… and answered at the end.

To save a PDF, choose “Save as PDF” in the print dialog.

1. Cases and variables: categorical and quantitative

Warm-up

Three quick questions from earlier lessons.

Discover

A spreadsheet has one row per student and columns for age, favorite color and number of pets. Which column holds categorical data?

  1. Favorite color
  2. Number of pets

Key idea

Data are values of variables recorded on cases.

Cases (individuals) are what the data describe; variables are what is recorded. A categorical variable places cases in groups; a quantitative variable takes numerical values for which arithmetic makes sense (discrete counts or continuous measurements).

Worked example

A café records each order: drink size (S, M, L), price in dollars, and table number.

Cases: the orders
Each row is an order.
Price: quantitative
Price: averaging makes sense.
Size and table number: categorical
Table numbers are labels; size is a category.

Your turn, guided

Your turn: how many quantitative variables among height, jersey number, goals scored?

22
Height and goals; jersey numbers are labels.

Practice ★

  1. A survey of 23 students records the following. Tick all the categorical variables.
    1. Eye color
    2. ZIP code
    3. Takes the bus to school (yes/no)
    4. Height in cm
    5. Number of siblings
  2. A survey of 80 students records the following. Tick all the categorical variables.
    1. Eye color
    2. ZIP code
    3. Takes the bus to school (yes/no)
    4. Height in cm
    5. Number of siblings

Watch out!

Practice ★★

  1. Area codes such as 770 are numbers. Is the area code of a phone number a quantitative variable?
    1. No: it is categorical, a label that only looks like a number
    2. Yes: its values are numbers
    3. Yes, a discrete quantitative variable
  1. A study measures the resting heart rate of 29 runners. What are the cases (observational units)?
    1. The 29 runners
    2. The heart rates
    3. The number 29

Exit ticket

Three questions to check you have got it.

  1. A survey of 23 students records the following. Tick all the categorical variables.
    1. Eye color
    2. ZIP code
    3. Takes the bus to school (yes/no)
    4. Height in cm
    5. Number of siblings
  2. A survey of 80 students records the following. Tick all the categorical variables.
    1. Eye color
    2. ZIP code
    3. Takes the bus to school (yes/no)
    4. Height in cm
    5. Number of siblings
  3. A survey of 54 students records the following. Tick all the categorical variables.
    1. Eye color
    2. ZIP code
    3. Takes the bus to school (yes/no)
    4. Height in cm
    5. Number of siblings

Summary card

Variables

  • Cases: who or what. Variables: what is recorded.
  • Categorical: groups. Quantitative: meaningful numbers.

Watch out: numeric codes (ZIP, ID) are categorical.

2. Displaying and describing distributions

Warm-up

Three quick questions from earlier lessons.

Discover

House prices in a town: most around 300 thousand dollars, a few mansions above 2 million dollars. Which is pulled up by the mansions?

  1. The mean
  2. The median

Key idea

Describe a distribution by its shape, center, spread and unusual values.

Shape: symmetric, skewed right (long tail of high values) or skewed left; number of peaks. Center: mean or median. Spread: SD, IQR or range. Outliers: values far from the rest. In a right-skewed distribution the mean is usually above the median.

Worked example

Commute times: median 22 min, mean 29 min, a few 90-min commutes.

Mean > median
The mean is pulled towards the long tail.
Skewed right
The tail is on the high side.
The median describes a typical commute better
Resistant to the tail.

Your turn, guided

Your turn: test scores have mean 61 and median 70. How far below the median is the mean?

99 points: skewed left
70 − 61: the mean is pulled down by a tail of low scores, so the distribution is skewed left.

Practice ★

  1. A distribution of incomes has mean 54 thousand dollars and median 43 thousand dollars. What is its most likely shape?
    1. Skewed right: a long tail of high values pulls the mean up
    2. Skewed left
    3. Symmetric
  2. A distribution of incomes has mean 59 thousand dollars and median 54 thousand dollars. What is its most likely shape?
    1. Skewed right: a long tail of high values pulls the mean up
    2. Skewed left
    3. Symmetric
  1. 43 students name their favorite sport. Which display suits these data?
    1. A bar chart
    2. A histogram
    3. A boxplot

Watch out!

Practice ★★

  1. Which four features should you describe for the distribution of a quantitative variable (here, 42 test scores)?
    1. Shape, center, spread and unusual values (outliers)
    2. The mean, the median, the mode and the sample size
    3. The type of graph, the title, the axes and the colors

Exit ticket

Three questions to check you have got it.

  1. A distribution of incomes has mean 54 thousand dollars and median 43 thousand dollars. What is its most likely shape?
    1. Skewed right: a long tail of high values pulls the mean up
    2. Skewed left
    3. Symmetric
  2. A distribution of incomes has mean 59 thousand dollars and median 54 thousand dollars. What is its most likely shape?
    1. Skewed right: a long tail of high values pulls the mean up
    2. Skewed left
    3. Symmetric
  3. A distribution of incomes has mean 58 thousand dollars and median 46 thousand dollars. What is its most likely shape?
    1. Skewed right: a long tail of high values pulls the mean up
    2. Skewed left
    3. Symmetric

Summary card

Describing a distribution

Shape, center, spread, outliers, in context.

Watch out: skewed right means mean > median (usually).

3. Measures of center: mean and median

Warm-up

Three quick questions from earlier lessons.

Discover

Five friends earn 10, 12, 13, 15 and 150 dollars an hour. Which number describes a typical friend better?

  1. The median, 13 dollars
  2. The mean, 40 dollars

Key idea

Two ways to measure the center.

Mean xˉ=∑xin\bar{x} = \dfrac{\sum x_i}{n}: the balance point; sensitive to extremes. Median: the middle value of the ordered data (with an even count, the average of the two middle values); resistant to extremes.

Worked example

Data: 4, 7, 7, 9, 13, 20.

Mean =10= 10
Sum 60, six values.
Median =8= 8
Middle values 7 and 9.
Mean > median: slight right skew
The 20 pulls the mean up.

Your turn, guided

Your turn: the median of 3, 8, 10, 15.

99
(8 + 10)/2.

Practice ★

  1. Find the mean of the data 5, 11, 24, 33, 41.
  2. Find the mean of the data 3, 11, 20, 38, 65.
  3. Find the mean of the data 9, 19, 24, 39, 68.

Watch out!

Practice ★★

  1. Find the median of the data 9, 14, 24, 37, 44, 79.
  2. Find the median of the data 2, 10, 28, 36, 43, 64.
  1. One value in a data set is changed from 20 to 712. What happens to the mean and the median?
    1. The mean increases; the median stays about the same
    2. Both increase by the same amount
    3. The median increases; the mean stays the same

Exit ticket

Three questions to check you have got it.

  1. Find the median of the data 9, 14, 24, 37, 44, 79.
  2. Find the median of the data 2, 10, 28, 36, 43, 64.
  3. Find the median of the data 8, 18, 26, 32, 43, 97.

Summary card

Center

  • Mean: sum ÷ n; pulled by extremes.
  • Median: middle value; resistant.

Watch out: even count: average the two middle values.

4. Measures of spread: range, IQR, standard deviation

Warm-up

Three quick questions from earlier lessons.

Discover

Data A: 48, 50, 52. Data B: 20, 50, 80. Same mean, 50. Which is more spread out?

  1. B
  2. Neither: the means are equal

Key idea

Spread measures how far values lie from each other or from the center.

Range = max − min. IQR = Q3−Q1Q_3 - Q_1 (spread of the middle half; resistant). Sample standard deviation s=∑(xi−xˉ)2n−1s = \sqrt{\dfrac{\sum (x_i - \bar{x})^2}{n - 1}} (typical distance from the mean; s2s^2 is the variance).

Worked example

ss for 2, 4, 6.

Squares: 4, 0, 4, sum 8
Mean 4; deviations −2, 0, 2.
s2=4s^2 = 4
Divide by n − 1 = 2.
s=2s = 2
Square root.

Your turn, guided

Your turn: the IQR when Q1=12Q_1 = 12 and Q3=30Q_3 = 30.

IQR =18= 18
30 − 12.

Practice ★

  1. Find the (sample) standard deviation of 33, 38, 43.
  2. Find the (sample) standard deviation of 25, 34, 43.
  1. Find the interquartile range (IQR) of the 8 values 3, 9, 14, 17, 24, 27, 33, 46.
  2. Find the interquartile range (IQR) of the 8 values 4, 9, 13, 19, 24, 29, 32, 45.

Watch out!

Practice ★★

  1. Two classes both have mean score 78. In class A the scores range from 76 to 80; in class B from 63 to 93. Which has the larger standard deviation?
    1. Class B: its scores are more spread out
    2. Class A
    3. The same, because the means are equal
  1. Boss problem. The data are 67, 68, 69, 70, 71.

Exit ticket

Three questions to check you have got it.

  1. Find the (sample) standard deviation of 33, 38, 43.
  2. Find the (sample) standard deviation of 25, 34, 43.
  3. Find the (sample) standard deviation of 23, 32, 41.

Summary card

Spread

  • Range, IQR (resistant), standard deviation.
  • ss divides by n−1n - 1; s2s^2 is the variance.

Watch out: the SD is the square root of the variance.

5. Outliers and boxplots

Warm-up

Three quick questions from earlier lessons.

Discover

Q1=20Q_1 = 20, Q3=30Q_3 = 30, so IQR =10= 10. Is a value of 48 unusually large?

  1. Yes, it is above 30+1.5×10=4530 + 1.5 \times 10 = 45
  2. No: only values above twice Q3Q_3, 60, are outliers

Key idea

A rule of thumb for outliers, and a picture of the five-number summary.

1.5 × IQR rule: a value is an outlier if it is below Q1−1.5 IQRQ_1 - 1.5\,\text{IQR} or above Q3+1.5 IQRQ_3 + 1.5\,\text{IQR}. A boxplot draws the box from Q1Q_1 to Q3Q_3, a line at the median, whiskers to the most extreme non-outliers, and outliers as separate points.

Worked example

Q1=14Q_1 = 14, Q3=26Q_3 = 26. The fences.

IQR =12= 12
26 − 14.
Fences 14−18=−414 - 18 = -4 and 26+18=4426 + 18 = 44
1.5 × 12 = 18.
Outliers: below −4-4 or above 4444
Any value beyond them.

Your turn, guided

Your turn: Q1=40Q_1 = 40, Q3=50Q_3 = 50. The lower fence.

2525
40 − 15.

Practice ★

  1. A data set has Q1=24Q_1 = 24 and Q3=32Q_3 = 32. Above which value is a data point an outlier by the 1.5×IQR1.5 \times \text{IQR} rule?
  2. A data set has Q1=36Q_1 = 36 and Q3=66Q_3 = 66. Above which value is a data point an outlier by the 1.5×IQR1.5 \times \text{IQR} rule?
  3. A data set has Q1=19Q_1 = 19 and Q3=57Q_3 = 57. Above which value is a data point an outlier by the 1.5×IQR1.5 \times \text{IQR} rule?

Watch out!

Practice ★★

  1. Q1=34Q_1 = 34 and Q3=44Q_3 = 44. Below which value is a data point an outlier?
  2. Q1=40Q_1 = 40 and Q3=48Q_3 = 48. Below which value is a data point an outlier?
  1. A boxplot of 81 values shows which summary?
    1. The five-number summary (min, Q1, median, Q3, max), with outliers plotted separately
    2. The mean and the standard deviation
    3. How many values fall in each interval

Exit ticket

Three questions to check you have got it.

  1. A data set has Q1=24Q_1 = 24 and Q3=32Q_3 = 32. Above which value is a data point an outlier by the 1.5×IQR1.5 \times \text{IQR} rule?
  2. A data set has Q1=36Q_1 = 36 and Q3=66Q_3 = 66. Above which value is a data point an outlier by the 1.5×IQR1.5 \times \text{IQR} rule?
  3. A data set has Q1=19Q_1 = 19 and Q3=57Q_3 = 57. Above which value is a data point an outlier by the 1.5×IQR1.5 \times \text{IQR} rule?

Summary card

Outliers and boxplots

  • Fences: Q1−1.5 IQRQ_1 - 1.5\,\text{IQR} and Q3+1.5 IQRQ_3 + 1.5\,\text{IQR}.
  • Boxplot: five-number summary plus outliers.

Watch out: 1.5 × IQR, not 1 × IQR.