1. Learn
  2. /
  3. Courses
  4. /
  5. Foundations of Probability in Python

Connected

Exercise

Sample means follow a normal distribution

In the previous exercise, we generated a population that followed a binomial distribution, chose 20 random samples from the population, and calculated the sample mean. Now we're going to test some other probability distributions to see the shape of the sample means.

From the scipy.stats library, we've loaded the poisson and geom objects and the describe() function. We've also imported matplotlib.pyplot as plt and numpy as np.

As you'll see, the shape of the distribution of the means is the same even though the samples are generated from different distributions.

Instructions 1/2

undefined XP
  • 1

    Select 20 values from the population, add the sample mean to the sample_means list, and plot a histogram.

  • 2

    Select 20 values from the population, populate the sample_means list, and plot a histogram.