10/13
Part 7 of 7 · Follow-upsLearn
The normal approximation to the binomial
Two follow-ups come up after this question.
The CLT also covers counts, since a count of yeses is a sum of Bernoulli trials. The shop's returns in 1,000 orders at 10% have mean 100 and standard deviation √90, about 9.5.
from math import comb
from statistics import NormalDist
exact = sum(comb(1000, k) * 0.1 ** k * 0.9 ** (1000 - k) for k in range(121, 1001))
approx = 1 - NormalDist(100, 90 ** 0.5).cdf(120.5)
print(f"exact {exact:.4f}, normal approximation {approx:.4f}")
Does the normal curve estimate the chance of more than 120 returns too high or too low?
Pick one to see what it prints.
Pick an answer above to see the rest