Session Ready
Exercise

The sampling distribution

Not surprisingly, every time we take another random sample, we get a different sample mean. It's useful to get a sense of just how much variability we should expect when estimating the population mean this way.

The distribution of sample means, called the sampling distribution, can help us understand this variability. In this lab, because we have access to the population, we can build up the sampling distribution for the sample mean by repeating the above steps many times. Here we will generate 5000 samples and compute the sample mean of each.

The code in the editor takes 5000 samples of size 50 from the population, calculates the mean of each sample, and stores each result in a vector called sample_means50, using what we call a for loop.

If this is completely new to you, do not fear, in the next exercises we'll review in detail how these lines of code work.

Instructions
100 XP
  • Inspect the code in the editor.
  • Run it to see what it does, try and see if you can more or less understand how it works.