Probability and sampling

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. Probability with equally likely outcomes; the complement

Warm-up

Three quick questions from earlier lessons.

Discover

Two dice are rolled. The sums go from 2 to 12: eleven values. Is each sum equally likely, with probability 111\tfrac{1}{11}?

  1. No
  2. Yes

Roll two dice 1,000 times. Which sum comes up most often?

  1. 7
  2. All sums come up about equally often

Key idea

Probability with equally likely outcomes, and the complement.

If all outcomes in the sample space are equally likely, P(A)=number of outcomes in Anumber of outcomesP(A) = \dfrac{\text{number of outcomes in } A}{\text{number of outcomes}}. Always 0≤P(A)≤10 \le P(A) \le 1, and P(not A)=1−P(A)P(\text{not } A) = 1 - P(A).

Worked example

At least one head in 3 coin tosses.

P(no heads)=18P(\text{no heads}) = \tfrac{1}{8}
8 equally likely sequences.
P(at least one head)=1−18P(\text{at least one head}) = 1 - \tfrac{1}{8}
Complement.
=78= \tfrac{7}{8}
Compute.

Your turn, guided

Your turn: P(sum = 7) with two dice.

16\tfrac{1}{6}
6 pairs of 36.

Practice ★

  1. Two fair dice are rolled. Find the probability that the sum is 2.
  2. Two fair dice are rolled. Find the probability that the sum is 12.
  1. The probability that a flight is late is 0.78. Find the probability that it is not late.

Watch out!

Practice ★★

  1. A fair die is rolled 2 times. Find the probability of at least one six.
  2. A fair die is rolled 6 times. Find the probability of at least one six.

Exit ticket

Three questions to check you have got it.

  1. Two fair dice are rolled. Find the probability that the sum is 2.
  2. Two fair dice are rolled. Find the probability that the sum is 12.
  3. Two fair dice are rolled. Find the probability that the sum is 8.

Summary card

Basics

  • Equally likely: favorable ÷ total.
  • P(not A)=1−P(A)P(\text{not } A) = 1 - P(A); "at least one" via the complement.

Watch out: make sure the outcomes really are equally likely.

2. Long-run frequency and simulation

Warm-up

Three quick questions from earlier lessons.

Discover

A fair coin gave 7 heads in 10 tosses. If you toss it 10,000 times, what do you expect?

  1. A proportion of heads close to 0.5
  2. More tails than heads, to make up for the 7 heads

Run 10 tosses a few times, then 1,000. What happens to the proportion of heads?

  1. It gets close to 0.5
  2. It swings further from 0.5 to make up for streaks

Key idea

Probability is a long-run relative frequency.

Law of large numbers: as a random process is repeated many times, the proportion of times an event occurs gets close to its probability. Independent trials have no memory. A simulation imitates a random process with random numbers to estimate probabilities.

Worked example

Simulate a 30% chance with random digits.

Let 0, 1, 2 mean "success"
Each digit has probability 0.1.
Read 1,000 random digits; count successes
Repeat many times.
About 300 successes expected
Relative frequency.

Your turn, guided

Your turn: how many digits for a 60% chance?

66
0.6 ÷ 0.1.

Practice ★

  1. A fair coin lands heads 7 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak
  1. What does it mean that the probability of rain tomorrow is 0.7?
    1. On many days like tomorrow, it rains on about 70% of them
    2. It will rain for 70% of the day
    3. It will rain if the probability is above 0.5

Watch out!

Practice ★★

  1. To simulate a free throw made with probability 0.6 using random digits 0–9, how many of the ten digits should stand for 'made'?
  2. To simulate a free throw made with probability 0.4 using random digits 0–9, how many of the ten digits should stand for 'made'?

Exit ticket

Three questions to check you have got it.

  1. A fair coin lands heads 7 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak
  2. A fair coin lands heads 5 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak
  3. A fair coin lands heads 10 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak

Summary card

Long run

  • Probability = long-run relative frequency.
  • Simulate with random numbers.

Watch out: no memory, no "due" outcomes.

3. Tree diagrams and reverse conditioning

Warm-up

Three quick questions from earlier lessons.

Discover

1% of people have a condition. A test is positive for 95% of them, and for 5% of healthy people. Of 10,000 people, about how many test positive in total?

  1. About 590
  2. About 5,000

Key idea

A tree organizes conditional probabilities.

First branches: P(A)P(A) and P(not A)P(\text{not } A); second branches: conditional probabilities. Multiply along a path; add the paths that end in BB to get P(B)P(B). Then P(A∣B)=P(A and B)P(B)P(A \mid B) = \dfrac{P(A \text{ and } B)}{P(B)} (reverse conditioning, Bayes' rule).

Worked example

With the numbers above: P(condition | positive).

0.01×0.95=0.00950.01 \times 0.95 = 0.0095
Path: condition, positive.
P(+)=0.0095+0.99×0.05=0.059P(+) = 0.0095 + 0.99 \times 0.05 = 0.059
Both paths to positive.
P(condition∣+)=0.00950.059≈0.16P(\text{condition} \mid +) = \tfrac{0.0095}{0.059} \approx 0.16
Divide.

Your turn, guided

Your turn: P(A) = 0.2, P(B | A) = 0.5, P(B | not A) = 0.25. Find P(B).

0.30.3
0.2 × 0.5 + 0.8 × 0.25.

Practice ★

  1. 12% of a population has a condition. A test is positive for 86% of people with the condition and for 11% of people without it. Find P(positive).
  2. 14% of a population has a condition. A test is positive for 94% of people with the condition and for 8% of people without it. Find P(positive).
  1. 22% of a population has a condition. A test is positive for 81% of people with the condition and for 12% of people without it. Find P(condition | positive).

Watch out!

Practice ★★

  1. A disease affects 1 in 1,000 people. A test is 93% accurate for both sick and healthy people. Your test is positive. What is most likely?
    1. You are still more likely healthy: false positives from the many healthy people outnumber the true positives
    2. You are about 93% likely to be sick
    3. You are certainly sick
  1. Boss problem. 5% of people have a disease. A test is positive for 90% of people with the disease and for 7% of people without it.

Exit ticket

Three questions to check you have got it.

  1. 12% of a population has a condition. A test is positive for 86% of people with the condition and for 11% of people without it. Find P(positive).
  2. 14% of a population has a condition. A test is positive for 94% of people with the condition and for 8% of people without it. Find P(positive).
  3. 28% of a population has a condition. A test is positive for 95% of people with the condition and for 14% of people without it. Find P(positive).

Summary card

Trees

  • Multiply along paths; add paths to the same end.
  • P(A∣B)=P(A and B)/P(B)P(A \mid B) = P(A \text{ and } B)/P(B).

Watch out: with rare events, most positives can be false.

4. Populations, samples, parameters and statistics

Warm-up

Three quick questions from earlier lessons.

Discover

A poll of 1,000 voters finds 52% support for a candidate. Is 52% the support among all voters?

  1. Not exactly: it estimates it
  2. Yes

Key idea

We study a sample to learn about a population.

The population is the whole group of interest; a sample is the part we actually observe. A parameter is a number describing the population (usually unknown); a statistic is a number computed from the sample, used to estimate the parameter.

Worked example

A factory tests 200 of today's 10,000 bulbs; 3% are faulty.

Population: the 10,000 bulbs
Everything produced today.
Sample: the 200 bulbs
Those tested.
3% is a statistic estimating the faulty rate today
Computed from the sample.

Your turn, guided

Your turn: how many faulty bulbs were found in the sample?

66
3% of 200.

Practice ★

  1. A researcher measures the sleep of 376 randomly chosen teenagers and finds a mean of 7.1 hours. What is 7.1?
    1. A statistic: it describes the sample
    2. A parameter: it describes all teenagers
    3. The population
  1. To learn how much US college students spend on books, a team surveys 671 students at 20 colleges. What is the population?
    1. All US college students
    2. The 671 students surveyed
    3. The 20 colleges

Watch out!

Practice ★★

  1. Census records show that 52% of all households in a town own a car. What is 52%?
    1. A parameter: it describes the whole population
    2. A statistic
    3. A sample proportion

Exit ticket

Three questions to check you have got it.

  1. A researcher measures the sleep of 376 randomly chosen teenagers and finds a mean of 7.1 hours. What is 7.1?
    1. A statistic: it describes the sample
    2. A parameter: it describes all teenagers
    3. The population
  2. A researcher measures the sleep of 288 randomly chosen teenagers and finds a mean of 7.1 hours. What is 7.1?
    1. A statistic: it describes the sample
    2. A parameter: it describes all teenagers
    3. The population
  3. A researcher measures the sleep of 121 randomly chosen teenagers and finds a mean of 7.1 hours. What is 7.1?
    1. A statistic: it describes the sample
    2. A parameter: it describes all teenagers
    3. The population

Summary card

Population and sample

  • Population → parameter (usually unknown).
  • Sample → statistic (an estimate).

Watch out: a number from the sample is a statistic.

5. Bias in sampling

Warm-up

Three quick questions from earlier lessons.

Discover

A TV show asks viewers to text in their opinion; 50,000 do. Is that a better sample than 1,000 randomly chosen adults?

  1. No, the random 1,000 is better
  2. Yes, it is 50 times bigger

Key idea

Bias is a systematic error from how data are collected.

Voluntary response: people choose to respond. Convenience sampling: easy-to-reach individuals. Undercoverage: part of the population cannot be chosen. Nonresponse: chosen people do not answer. Response bias: wording or setting distorts answers. A larger sample does not reduce bias.

Worked example

A survey by phone at 2 p.m. on weekdays.

Working adults are rarely reached
Who is home?
Undercoverage
They cannot be in the sample.
The bias does not shrink with more calls
The estimate leans towards people at home.

Your turn, guided

Your turn: of 1,200 people chosen, 300 answered. The response rate as a fraction:

14\tfrac{1}{4}
300 ÷ 1,200: a high risk of nonresponse bias.

Practice ★

  1. A news website asks readers to vote online; 4824 vote and 80% favor a new law. What is the main problem?
    1. Voluntary response bias: people with strong opinions choose to respond
    2. The sample is too small
    3. None: 4824 responses are representative
  1. A survey of 115 adults is done by calling landline numbers. What kind of bias is most likely?
    1. Undercoverage: people without landlines cannot be chosen
    2. Response bias from the wording
    3. None, if the numbers are chosen at random

Watch out!

Practice ★★

  1. A biased survey of 238 people is repeated with 10 times as many people, chosen the same way. What happens to the bias?
    1. It stays: a larger sample reduces random variability, not bias
    2. It disappears
    3. It becomes 10 times smaller
  2. A biased survey of 402 people is repeated with 10 times as many people, chosen the same way. What happens to the bias?
    1. It stays: a larger sample reduces random variability, not bias
    2. It disappears
    3. It becomes 10 times smaller

Exit ticket

Three questions to check you have got it.

  1. A news website asks readers to vote online; 4824 vote and 80% favor a new law. What is the main problem?
    1. Voluntary response bias: people with strong opinions choose to respond
    2. The sample is too small
    3. None: 4824 responses are representative
  2. A news website asks readers to vote online; 1714 vote and 80% favor a new law. What is the main problem?
    1. Voluntary response bias: people with strong opinions choose to respond
    2. The sample is too small
    3. None: 1714 responses are representative
  3. A news website asks readers to vote online; 3716 vote and 80% favor a new law. What is the main problem?
    1. Voluntary response bias: people with strong opinions choose to respond
    2. The sample is too small
    3. None: 3716 responses are representative

Summary card

Bias

Voluntary response, convenience, undercoverage, nonresponse, response bias.

Watch out: a bigger biased sample is still biased.

6. Sampling variability and sampling distributions

Warm-up

Three quick questions from earlier lessons.

Discover

Five classmates each survey 20 random students about a new rule. Will they all get the same percentage in favor?

  1. No, the percentages will vary
  2. Yes, if they all sample at random

Key idea

A statistic has a distribution of its own.

  1. Step 110 samples: a few values of p̂, scattered.
  2. Step 2100 samples: a shape appears.
  3. Step 31,000 samples (scaled): a mound centered near p — the sampling distribution.

The sampling distribution of a statistic is its distribution over all possible random samples of the same size. Its center tells us about bias; its spread (standard error) shrinks as the sample size grows.

Worked example

Imagine 1,000 samples of 50 students and the p̂ of each.

A histogram of p̂ values
Plot the 1,000 values.
Centered near the true p
Where it is centered.
Narrower: less variability
With samples of 200 instead.

Your turn, guided

Your turn: by what factor does SD(x̄) change when nn goes from 25 to 100?

It is halved: factor 12\tfrac{1}{2}
√25/√100.

Practice ★

  1. Many random samples of size 161 are taken from the same population. Which quantity changes from sample to sample?
    1. The sample proportion p̂ (a statistic)
    2. The population proportion p (a parameter)
    3. The sample size
  1. Compared with samples of size 73, samples of size 292 give sample means that…
    1. vary less around the population mean
    2. vary more
    3. are more biased

Watch out!

Practice ★★

  1. What is the sampling distribution of the sample mean for samples of size 25?
    1. The distribution of x̄ over all possible samples of size 25
    2. The distribution of the 25 values in one sample
    3. The distribution of the population

Exit ticket

Three questions to check you have got it.

  1. Many random samples of size 161 are taken from the same population. Which quantity changes from sample to sample?
    1. The sample proportion p̂ (a statistic)
    2. The population proportion p (a parameter)
    3. The sample size
  2. Many random samples of size 224 are taken from the same population. Which quantity changes from sample to sample?
    1. The sample proportion p̂ (a statistic)
    2. The population proportion p (a parameter)
    3. The sample size
  3. Many random samples of size 490 are taken from the same population. Which quantity changes from sample to sample?
    1. The sample proportion p̂ (a statistic)
    2. The population proportion p (a parameter)
    3. The sample size

Summary card

Sampling variability

  • Statistics vary from sample to sample.
  • Sampling distribution: a statistic over all samples.
  • Larger nn: less variability.

Watch out: data distribution vs sampling distribution.

7. Mean and mean absolute deviation (MAD)

Warm-up

Three quick questions from earlier lessons.

Discover

Two players both average 10 points a game. One scores 9, 10, 11; the other 0, 10, 20. Who is more consistent?

  1. The first player
  2. Both: the means are equal

Key idea

The MAD measures spread around the mean.

The mean is the sum ÷ the count (the balance point). The mean absolute deviation (MAD) is the average distance of the values from the mean: find each distance (always positive), then average them. A larger MAD means more variability.

Worked example

Data 2, 4, 6, 8.

Mean 5
Sum 20 ÷ 4.
3, 1, 1, 3
Distances.
MAD = 2
Average.

Your turn, guided

Your turn: the mean of 3, 7, 8.

66
18 ÷ 3.

Practice ★

  1. The mean of 4 numbers is 15. What is their sum?
  2. The mean of 7 numbers is 20. What is their sum?
  1. Two classes both have a mean test score of 61. Class A has a MAD of 3 points and class B a MAD of 7 points. Which statement is true?
    1. Class B's scores are more spread out
    2. Class A's scores are more spread out
    3. The scores are equally spread, because the means are equal

Watch out!

Practice ★★

  1. Find the mean absolute deviation (MAD) of the data 8, 13, 15, 20.
  2. Find the mean absolute deviation (MAD) of the data 10, 13, 15, 18.
  1. Boss problem. Four plants grew 5, 12, 14 and 21 cm.

Exit ticket

Three questions to check you have got it.

  1. Find the mean absolute deviation (MAD) of the data 8, 13, 15, 20.
  2. Find the mean absolute deviation (MAD) of the data 10, 13, 15, 18.
  3. Find the mean absolute deviation (MAD) of the data 1, 8, 12, 19.

Summary card

Mean absolute deviation

Average distance from the mean.

Watch out: distances, not signed differences.

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