地震間隔時間平均值的估計
上一題的圖形化 EDA 顯示地震頻率在 2010 年前後有明顯變化。為了比較,請分別計算 1980 年至 2009 年,以及 2010 年至 2017 年中期間,規模(magnitude)達 3 以上地震之間的平均間隔時間。並加入平均值的 95% 信賴區間。變數 dt_pre 與 dt_post 分別包含 2010 年前與 2010 年後,所有規模至少為 3 的地震之間的時間間隔(單位為天)。
本練習屬於課程
統計思維個案研究
練習說明
- 計算 2010 年前(
dt_pre)與 2010 年後(dt_post)的地震間隔時間平均值。 - 對兩個資料集各自抽取 10,000 個平均值的自助法(bootstrap)重抽樣複本。
- 使用
np.percentile()計算兩個資料集平均值的 95% 信賴區間。 - 按下「Submit Answer」將結果印出到畫面。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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))