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.
Cet exercice fait partie du cours
Foundations of Probability in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Create list for sample means
sample_means = []
for _ in range(1500):
# Take 20 values from the population
sample = ____(population, ____)