Sample means
An important result in probability and statistics is that the shape of the distribution of the means of random variables tends to a normal distribution, which happens when you add random variables with any distribution with the same expected value and variance.
For your convenience, we've loaded binom
and describe()
from the scipy.stats
library and imported matplotlib.pyplot
as plt
and numpy
as np
. We generated a simulated population with size 1,000 that follows a binomial distribution for 10 fair coin flips and is available in the population
variable.
This exercise is part of the course
Foundations of Probability in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create list for sample means
sample_means = []
for _ in range(1500):
# Take 20 values from the population
sample = ____(population, ____)