Skip to content
Family Table Math
Auto

Sampling Distributions and Simulation

If you and a friend each survey a different random sample of 5050 students, you’ll almost certainly get different answers. That’s not a mistake; it’s sampling variability, and it’s the reason statistics needs probability. A sampling distribution describes exactly how much a statistic varies from sample to sample, and you can build one just by simulating. This idea sits under every confidence interval and significance test in AP Statistics.

A parameter (like the population proportion pp or mean μ\mu) is a fixed number describing a population. A statistic (like p^\hat{p} or xˉ\bar{x}) is calculated from a sample, and its value changes from one random sample to the next.

It’s easy to mix these up:

DistributionWhat it showsExample (sleep of all students at a school)
Population distributionthe values of the variable for every individual in the populationevery student’s hours of sleep
Distribution of sample datathe values for the individuals in one samplethe 4040 students you surveyed
Sampling distribution of a statisticthe values of the statistic for all possible samples of the same sizethe xˉ\bar{x} values from every possible sample of 4040 students

The sampling distribution is about the statistic, not about individuals. Its centre tells you whether the statistic is biased; its spread tells you how variable the statistic is.

You can’t usually list every possible sample, but you can approximate the sampling distribution by simulation:

  1. Assume a value for the parameter (for example, p=0.30p = 0.30).
  2. Use a random mechanism (a random number generator, cards, spinners) to generate a random sample of size nn from that population, and calculate the statistic.
  3. Repeat many times (hundreds or thousands) and record each value.
  4. Graph the values. Their distribution approximates the sampling distribution.
Histogram of 1000 simulated sample proportions from samples of 50 with p = 0.30. It is roughly symmetric and centred near 0.30, with most values between 0.16 and 0.44. The bars at 0.42 and above are highlighted: 54 of the 1000 values. 0.1 0.2 0.3 0.4 0.5 40 80 120 54 of 1000 values are 0.42 or more simulated sample proportion
10001000 simulated values of p^\hat{p} for samples of 5050 when p=0.30p = 0.30. Their mean is 0.3010.301 and their standard deviation is 0.0650.065.

To decide whether an observed result is surprising under some assumption, simulate assuming it’s true, and find the proportion of simulated values at least as extreme as the observed one. A small proportion means the result would rarely happen by chance if the assumption were true, which is evidence against the assumption. This proportion is an estimated p-value; it’s how significance tests work.

In an experiment, a slightly different simulation asks: “could the random assignment alone produce a difference this big?”

  1. Assume the treatment has no effect, so each unit’s response would be the same whichever group it was in.
  2. Reshuffle: randomly reassign the observed responses to the treatment groups (same group sizes), and calculate the statistic (for example, the difference in means or proportions).
  3. Repeat many times.

The distribution of the reshuffled statistics is a randomization distribution. It approximates the sampling distribution of the statistic if the treatment has no effect.

For the sample mean xˉ\bar{x} from a random sample of size nn, from a population with mean μ\mu and standard deviation σ\sigma:

μxˉ=μσxˉ=σn\mu_{\bar{x}} = \mu \qquad \sigma_{\bar{x}} = \frac{\sigma}{\sqrt{n}}

And the shape:

  • If the population is normal, the sampling distribution of xˉ\bar{x} is normal for any nn.
  • The central limit theorem (CLT): even if the population isn’t normal, the sampling distribution of xˉ\bar{x} is approximately normal when nn is large. The larger nn is, the better the approximation. AP Statistics uses n≥30n \ge 30 as the guideline; a very skewed population may need more.
Three density curves on the same axis from 0 to 32 minutes. Left: a right-skewed population with mean 10. Middle: the sampling distribution of the sample mean for n = 5, still somewhat skewed right and narrower. Right: for n = 30, approximately normal, centred at 10, and much narrower. Population (skewed right) 0 10 20 30 Sample means, n = 5 0 10 20 30 Sample means, n = 30 0 10 20 30
Wait times with mean μ=10\mu = 10 minutes (skewed right). As nn grows, xˉ\bar{x} stays centred at 1010, gets less variable, and becomes approximately normal.

The CLT is about the sampling distribution of xˉ\bar{x}, not about the data. A large sample from a skewed population still looks skewed; it’s the distribution of the sample means that becomes normal. (The central limit theorem page has more examples.)

Know which distribution a question is about (population, one sample, or sampling distribution). When you use a simulation, explain how it was carried out and how the result answers the question: “In the simulation, 5454 of 10001000 samples had p^≥0.42\hat{p} \ge 0.42, so…”. When you use a normal model for xˉ\bar{x}, justify it (population normal, or n≥30n \ge 30 by the CLT).

A researcher measures the time (in minutes) that each of 4040 randomly chosen customers waits at a bank. Identify the population distribution, the distribution of the sample data, and the sampling distribution of xˉ\bar{x}.

Solution.

  • Population distribution: the wait times of all the bank’s customers.
  • Distribution of sample data: the 4040 wait times the researcher recorded.
  • Sampling distribution of xˉ\bar{x}: the mean wait times from all possible random samples of 4040 customers.

Example 2: Describing a simulated sampling distribution

Section titled “Example 2: Describing a simulated sampling distribution”

The histogram above shows 10001000 simulated values of p^\hat{p} for random samples of 5050 students, assuming 30%30\% of all students bike to school.

Solution.

(a) Shape: roughly symmetric and unimodal (slightly skewed right). Centre: mean 0.3010.301, close to 0.300.30. Variability: standard deviation 0.0650.065; most values are between about 0.160.16 and 0.440.44.

(b) The formulas give μp^=0.30\mu_{\hat{p}} = 0.30 and σp^=0.30(0.70)50=0.0648\sigma_{\hat{p}} = \sqrt{\dfrac{0.30(0.70)}{50}} = 0.0648. The simulation’s mean (0.3010.301) and standard deviation (0.0650.065) are very close, as expected: simulation and theory describe the same sampling distribution.

Example 3: Using the simulation to judge a claim

Section titled “Example 3: Using the simulation to judge a claim”

A city report says 30%30\% of students at a large high school bike to school. A student surveys a random sample of 5050 students and finds that 2121 bike, so p^=0.42\hat{p} = 0.42. Use the simulation above to decide whether this is convincing evidence that more than 30%30\% of the school’s students bike.

Solution. In the simulation, which assumed p=0.30p = 0.30, 5454 of the 10001000 simulated values of p^\hat{p} were 0.420.42 or more. So if 30%30\% of students really bike, a sample proportion of 0.420.42 or more would happen in about

541000=0.054\frac{54}{1000} = 0.054

of random samples of 5050, roughly 11 sample in 1919. That’s somewhat unusual but not very rare. It gives some evidence that more than 30%30\% bike, but it isn’t strong: the simulated estimate, 0.0540.054, is just above the usual 5%5\% standard. The exact binomial probability, P(X≥21)=0.048P(X \ge 21) = 0.048, is just below it. The two land on either side of 0.050.05 because the simulation only estimates the probability, so the honest conclusion is that this result is right at the borderline.

Wait times at a busy clinic are strongly skewed right, with mean μ=10\mu = 10 minutes and standard deviation σ=10\sigma = 10 minutes.

  • (a) Find the mean and standard deviation of xˉ\bar{x} for random samples of 4040 patients.
  • (b) Find the probability that the mean wait for a random sample of 4040 patients is more than 1212 minutes.
  • (c) Could you use the same method for a random sample of 55 patients? Explain.

Solution.

(a)

μxˉ=10σxˉ=1040=1.581\mu_{\bar{x}} = 10 \qquad \sigma_{\bar{x}} = \frac{10}{\sqrt{40}} = 1.581

(b) The population is skewed, but n=40≥30n = 40 \ge 30, so by the CLT xˉ\bar{x} is approximately normal.

P(xˉ>12)=P(Z>12−101.581)=P(Z>1.26)=0.103P(\bar{x} \gt 12) = P\left(Z \gt \frac{12 - 10}{1.581}\right) = P(Z \gt 1.26) = 0.103

About 10%10\% of samples of 4040 patients would have a mean wait over 1212 minutes.

(c) No. With n=5n = 5 from a strongly skewed population, the sampling distribution of xˉ\bar{x} is still noticeably skewed right (see the middle panel above), so a normal calculation could be quite inaccurate.

Confusing the sampling distribution with the sample’s data. A histogram of one sample’s values is the distribution of the sample data. The sampling distribution is made of statistics, one from each of many samples.

Thinking a large sample makes the data normal. The CLT says the distribution of xˉ\bar{x} becomes approximately normal. The individual values in a big sample still follow the population’s shape.

Using σ instead of σ/√n. For a probability about one individual, use σ\sigma. For a probability about the mean of a sample, use σxˉ=σn\sigma_{\bar{x}} = \dfrac{\sigma}{\sqrt{n}}.

Treating a simulated proportion as exact. A simulation estimates a probability. A different set of 10001000 repetitions would give a slightly different answer; more repetitions give a better estimate.

Simulating under the wrong assumption. To judge a claim, simulate assuming the claim (or “no effect”) is true, not using the observed sample result.

Forgetting what “as extreme” means. Count simulated values at least as far from the assumed value as the observed one, in the direction that matters (≥0.42\ge 0.42 for “more than”, both tails for “different from”).

1. (Warm-up) A teacher records the number of hours of sleep for each of 2525 randomly chosen students at her school. For each description, say whether it is the population distribution, the distribution of sample data, or the sampling distribution of xˉ\bar{x}.

  • (a) A dotplot of the 2525 students’ hours of sleep.
  • (b) The hours of sleep of all 11001100 students at the school.
  • (c) The mean hours of sleep from every possible sample of 2525 students.
Solution

(a) Distribution of sample data. (b) Population distribution. (c) Sampling distribution of xˉ\bar{x}.

2. (Warm-up) In the simulation on this page (10001000 samples of 5050, p=0.30p = 0.30), 5050 simulated values of p^\hat{p} were 0.180.18 or less. Estimate P(p^≤0.18)P(\hat{p} \le 0.18) when p=0.30p = 0.30 and n=50n = 50.

SolutionP(p^≤0.18)≈501000=0.05P(\hat{p} \le 0.18) \approx \frac{50}{1000} = 0.05

3. (Warm-up) A population has mean μ=80\mu = 80 and standard deviation σ=12\sigma = 12. Find μxˉ\mu_{\bar{x}} and σxˉ\sigma_{\bar{x}} for random samples of n=36n = 36 and n=144n = 144.

Solution

For both, μxˉ=80\mu_{\bar{x}} = 80. For n=36n = 36: σxˉ=126=2\sigma_{\bar{x}} = \dfrac{12}{6} = 2. For n=144n = 144: σxˉ=1212=1\sigma_{\bar{x}} = \dfrac{12}{12} = 1. Four times the sample size halves the standard deviation.

4. (Core) Describe how to use a random number generator to simulate one sample of 5050 students from a population in which 30%30\% bike to school, and how to use it to build a simulated sampling distribution of p^\hat{p}.

Solution

For each of the 5050 students, generate a random integer from 11 to 1010: let 11, 22, 33 represent “bikes” (probability 0.300.30) and 44 to 1010 represent “doesn’t bike”. Count how many of the 5050 are 11, 22, or 33, and divide by 5050 to get p^\hat{p}. Repeat this many times (say 10001000), recording p^\hat{p} each time, and make a histogram or dotplot of the values.

5. (Core) The masses of bags of flour from a machine are approximately normal with mean 10001000 g and standard deviation 1212 g. An inspector weighs random samples of 3636 bags.

  • (a) Find the probability that a single bag weighs less than 997997 g.
  • (b) Find the probability that the mean of a sample of 3636 bags is less than 997997 g.
  • (c) Explain why the answers are so different.
Solution

(a) P(X<997)=P(Z<997−100012)=P(Z<−0.25)=0.401P(X \lt 997) = P\left(Z \lt \dfrac{997 - 1000}{12}\right) = P(Z \lt -0.25) = 0.401.

(b) σxˉ=1236=2\sigma_{\bar{x}} = \dfrac{12}{\sqrt{36}} = 2, and xˉ\bar{x} is normal (the population is normal):

P(xˉ<997)=P(Z<997−10002)=P(Z<−1.5)=0.0668P(\bar{x} \lt 997) = P\left(Z \lt \frac{997 - 1000}{2}\right) = P(Z \lt -1.5) = 0.0668

(c) Sample means vary much less than individual bags: a single light bag is common, but a whole sample of 3636 averaging that light is unusual.

6. (Core) For the clinic in Example 4 (skewed right, μ=10\mu = 10, σ=10\sigma = 10), a student uses a normal model to find the probability that the mean wait of a random sample of 55 patients is more than 1212 minutes, and gets 0.3270.327. Is the normal model appropriate? Explain.

Solution

No. The population is strongly skewed and n=5n = 5 is far below 3030, so the CLT doesn’t guarantee that xˉ\bar{x} is approximately normal; its sampling distribution is still skewed right. (If the wait times follow an exponential model like the one in the figure, the exact probability is about 0.2850.285, so the normal answer of 0.3270.327 is noticeably off.)

7. (Core) A class does an experiment: 88 students study with flashcards and 88 study by rereading, and the flashcard group’s mean score is 6.56.5 points higher. The class reshuffles the 1616 scores into two groups of 88 many times, recording the difference in means each time.

  • (a) What assumption does the reshuffling make?
  • (b) In 200200 reshuffles, 77 differences were 6.56.5 or more. What does this suggest?
Solution

(a) That the study method has no effect: each student would have got the same score with either method, so any difference between the groups is due only to which students happened to be assigned to which group.

(b) If the method made no difference, a difference of 6.56.5 or more would happen in only about 7200=0.035\dfrac{7}{200} = 0.035 of random assignments. That’s unusual, so it’s evidence that flashcards really do lead to higher scores for students like these.

8. (Challenge) Two methods of estimating a population mean μ=50\mu = 50 are simulated. Method A’s simulated estimates have mean 50.150.1 and standard deviation 66. Method B’s have mean 47.047.0 and standard deviation 1.51.5.

  • (a) Which method appears unbiased?
  • (b) Which method would you choose, and why? Could a different sample size change your answer?
Solution

(a) Method A: its estimates are centred at about 5050. Method B underestimates by about 33 on average.

(b) There’s a trade-off: A is unbiased but has a lot of variability; B is biased but much more consistent. With A, estimates are typically about 66 from 5050; with B, typically within about 1.51.5 of 4747, so about 33 off. B is often closer. But a larger sample would reduce A’s variability (its standard deviation shrinks as nn grows) while B’s bias wouldn’t go away, so with enough data A becomes clearly better.

9. (Challenge) A population is strongly skewed right with mean μ=4\mu = 4 and standard deviation σ=4\sigma = 4. A random sample of n=50n = 50 is taken.

  • (a) Find the probability that xˉ>5\bar{x} \gt 5.
  • (b) A friend says: “The population is skewed, so you can’t use a normal model.” Respond.
Solution

(a) σxˉ=450=0.566\sigma_{\bar{x}} = \dfrac{4}{\sqrt{50}} = 0.566. By the CLT (n=50≥30n = 50 \ge 30), xˉ\bar{x} is approximately normal:

P(xˉ>5)=P(Z>5−40.566)=P(Z>1.77)=0.0385P(\bar{x} \gt 5) = P\left(Z \gt \frac{5 - 4}{0.566}\right) = P(Z \gt 1.77) = 0.0385

(b) The normal model is for the sampling distribution of xˉ\bar{x}, not for the population. With n=50n = 50, the CLT says xˉ\bar{x} is approximately normal even though the individual values are skewed.

Try these independently after the practice questions. Explain how each simulation is carried out and what it shows, in context. Homework solutions are not provided on the published site.

All data in these questions are hypothetical.

H1. (Foundations) A coach records the 100100 m times of 2020 randomly selected swimmers in a provincial club. Describe, in context, the population distribution, the distribution of the sample data, and the sampling distribution of the sample mean time.

H2. (Foundations) A population has mean μ=55\mu = 55 and standard deviation σ=15\sigma = 15. Find the mean and standard deviation of xˉ\bar{x} for random samples of size 2525.

H3. (Core) For the population in H2, assume the population is normal. Find the probability that the mean of a random sample of 2525 is greater than 6060.

H4. (Core) A game company claims that 25%25\% of its mystery boxes contain a rare item. A player opens 4040 boxes and finds 1616 rare items. She simulates 500500 sets of 4040 boxes, assuming the claim is true, and finds that 1313 of the 500500 simulated sets had 1616 or more rare items.

  • (a) Explain how she could carry out one repetition of the simulation.
  • (b) What does the simulation suggest about the company’s claim?

H5. (Core) In a simulation of sample proportions from a population with p=0.5p = 0.5, one student uses samples of 3030 and another uses samples of 120120. Predict the centre and standard deviation of each simulated distribution, and explain how the two histograms will look different.

H6. (Core) The weights of apples in an orchard are skewed left with mean 180180 g and standard deviation 2525 g.

  • (a) Can you find the probability that a randomly chosen apple weighs more than 190190 g using a normal model? Explain.
  • (b) Find the probability that the mean weight of a random sample of 5050 apples is more than 190190 g.

H7. (Challenge) Explain the difference between “the sample is large, so the data are approximately normal” and “the sample is large, so the sampling distribution of xˉ\bar{x} is approximately normal”. Which is what the central limit theorem says?

H8. (Challenge) A simulation of xˉ\bar{x} for samples of size nn from a population with σ=20\sigma = 20 produces values with standard deviation about 2.52.5. Estimate nn. Then explain how the simulated distribution would change if nn were made four times as large.

H9. (Challenge) Two students simulate the sampling distribution of p^\hat{p} for n=50n = 50 and p=0.3p = 0.3. One uses 100100 repetitions and the other uses 10 00010\,000. Explain which features of the two histograms should be similar and which should differ. Does increasing the number of repetitions make p^\hat{p} less variable?

H10. (Challenge) In an experiment, 1616 volunteers are randomly split into two groups of 88. In the treatment group, 66 improve; in the control group, 22 improve.

  • (a) Describe how to build a randomization distribution for the difference in the number who improve.
  • (b) In 500500 reshuffles, 3333 gave 66 or more improvers in the treatment group. Estimate the p-value and write a conclusion at α=0.05\alpha = 0.05.
  • (c) Why might a larger experiment be worthwhile here?