地震間隔の平均推定
前の演習でのグラフによる探索的データ分析から、2010年頃を境に地震の頻度が明らかに変化していることがわかります。比較のため、1980年から2009年と2010年から2017年半ばまでの期間それぞれについて、マグニチュード3以上の地震間の平均時間を計算しましょう。また、平均の95%信頼区間も求めてください。変数 dt_pre と dt_post には、2010年以前および2010年以降のマグニチュード3以上の地震間隔(単位:日)がそれぞれ格納されています。
この演習はコースの一部です
統計的思考 ケーススタディ
演習の手順
- 2010年以前(
dt_pre)と2010年以降(dt_post)について、地震間隔の平均を計算しましょう。 - 2010年以前・以降のデータセットそれぞれについて、平均のブートストラップ複製を10,000個生成しましょう。
np.percentile()を使って、両データセットの平均に対する95%信頼区間を計算しましょう。- '回答を送信' をクリックして、結果を画面に表示しましょう。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Compute mean interearthquake time
mean_dt_pre = ____
mean_dt_post = ____
# Draw 10,000 bootstrap replicates of the mean
bs_reps_pre = ____
bs_reps_post = ____
# Compute the confidence interval
conf_int_pre = ____
conf_int_post = ____
# Print the results
print("""1980 through 2009
mean time gap: {0:.2f} days
95% conf int: [{1:.2f}, {2:.2f}] days""".format(mean_dt_pre, *conf_int_pre))
print("""
2010 through mid-2017
mean time gap: {0:.2f} days
95% conf int: [{1:.2f}, {2:.2f}] days""".format(mean_dt_post, *conf_int_post))