Parkfield 的 b 值
ECDF 很擅長揭露低端遞減(roll-off),正如下方小於 1 級的區間所見。由於 3 級以上的地震相當多,你可以使用「完整性門檻」mt = 3。在此門檻下,請計算 1950 到 2016 年 Parkfield 區域的 b 值,以及 95% 信賴區間,並將結果印出。包含所有震級的變數 mags 已在你的命名空間中。
再將理論上的指數分佈 CDF 疊加到圖上,以驗證 Parkfield 區域是否符合 Gutenberg–Richter 定律。
本練習屬於課程
統計思維個案研究
練習說明
- 使用你寫的
b_value()函式計算 b 值與 95% 信賴區間。請使用 10,000 次自助抽樣(bootstrap) replicates。 - 使用
np.random.exponential()從理論分佈抽樣 100,000 個樣本。該分佈的平均數為b/np.log(10),且需要在樣本上加上mt以正確處理位置參數。將結果存成m_theor。 - 以線條繪製
m_theor的 ECDF。 - 以散點繪製所有大於
mt的震級之 ECDF。 - 按下「Submit Answer」以顯示圖形,並在畫面上印出 b 值與信賴區間。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Compute b-value and 95% confidence interval
b, conf_int = ____(____, ____, ____=[____, ____], n_reps=____)
# Generate samples to for theoretical ECDF
m_theor = ____(____, size=____) + ____
# Plot the theoretical CDF
_ = ____(*____)
# Plot the ECDF (slicing mags >= mt)
_ = plt.plot(*____(____[____ >= ____]), marker='.', linestyle='none')
# Pretty up and show the plot
_ = plt.xlabel('magnitude')
_ = plt.ylabel('ECDF')
_ = plt.xlim(2.8, 6.2)
plt.show()
# Report the results
print("""
b-value: {0:.2f}
95% conf int: [{1:.2f}, {2:.2f}]""".format(b, *conf_int))