2015 年は異常だったのでしょうか?
1990 年と 2015 年のシーズンは、野球史上最多のノーヒットノーラン(7 回)を記録しました。1 シーズンあたりの平均が 251/115 回だとすると、1 シーズンに 7 回以上起こる確率はどれくらいでしょうか?
この演習はコースの一部です
Pythonで学ぶ統計的思考(パート1)
演習の手順
- 平均
251/115の Poisson 分布から10000サンプルを生成し、n_nohittersに代入します。 - そのうち結果が
7以上のサンプル数を数え、n_largeに代入します。 n_largeをサンプル総数(10000)で割り、ノーヒットノーランが7回以上起こる確率p_largeを計算します。- Submit を押して、計算した確率を出力します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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)