1. Learn
  2. /
  3. Courses
  4. /
  5. Practicing Statistics Interview Questions in Python

Connected

Exercise

Simulating central limit theorem

Now that we have some practice creating a sample, we'll look at simulating the central limit theorem, similar to what you saw in the slides. We'll also continue dealing with a standard die numbered 1 through 6.

In order to do this, you'll take a collection of sample means from numpy and examine the distribution of them using the matplotlib package, which has been imported as plt for the rest of the chapter.

Instructions 1/3

undefined XP
  • 1

    Create a list named means with 1000 sample means from samples of 30 rolled dice by using list comprehension.

  • 2

    Create and show a histogram of the means using the hist() function; examine the shape of the distribution.

  • 3

    Adapt your code to visualize only 100 samples in the means list; did the distribution change at all?