Was 2015 anomalous?
1990 and 2015 featured the most no-hitters of any season of baseball (there were seven). Given that there are on average 251/115 no-hitters per season, what is the probability of having seven or more in a season?
This exercise is part of the course
Statistical Thinking in Python (Part 1)
Exercise instructions
- Draw
10000samples from a Poisson distribution with a mean of251/115and assign ton_nohitters. - Determine how many of your samples had a result greater than or equal to
7and assign ton_large. - Compute the probability,
p_large, of having7or more no-hitters by dividingn_largeby the total number of samples (10000). - Hit submit to print the probability that you calculated.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Draw 10,000 samples out of Poisson distribution: n_nohitters
# Compute number of samples that are seven or greater: n_large
n_large = np.sum(____)
# Compute probability of getting seven or more: p_large
# Print the result
print('Probability of seven or more no-hitters:', p_large)