Session Ready
Exercise

Influence of sample size

To see the effect that different sample sizes have on the sampling distribution, let's plot the three distributions on top of one another.

In R you can plot all three of them on the same graph by specifying that you'd like to divide the plotting area into three rows and one column of plots. You do this with the following command:

par(mfrow = c(3, 1)).

For easy comparison, we'd also like to use the same scale for each histogram. As a common scale, we'll use to the limits (min, max) of the first sample distribution: xlimits <- range(sample_means10).

Now we can set the xlim argument of the hist() function to the xlimits object to specify the range of the x-axis of the histograms.

Instructions
100 XP
  • To help you get started we've already divided the plotting area and initialized the xlimits.
  • Use the hist() function three times to draw the sample distributions sample_means10, sample_means50 and sample_means100.
  • Set the breaks argument of each of the histograms to 20.
  • Set the xlim argument of each of the histograms to xlimits.