開始使用免費開始

Parkfield 下一次大地震會在什麼時候?

Parkfield 地區上一次大地震發生在當地時間 2004 年 9 月 27 日晚間。你的任務是估計下一次 Parkfield 地震可能發生的時間,分別在指數模型與高斯模型的假設下進行。在兩種情況下,最佳點估計是平均間隔時間;你在上一個練習中算得 24.62 年,也就是預估下一次地震在 2029 年。請在指數分配且以你在上一個練習求得的 mean_time_gap 作為參數的假設下,計算下一次地震時間的 95% 信賴區間。並在常態分配且以 mean_time_gapstd_time_gap 作為參數的假設下,做相同的計算。

本練習屬於課程

統計思維個案研究

檢視課程

練習說明

  • 從平均數為 mean_time_gap 的指數分配抽取 100,000 個樣本,存為 exp_samples
  • 從平均數為 mean_time_gap、標準差為 std_time_gap 的常態分配抽取 100,000 個樣本,存為 norm_samples
  • 由於截至今日尚未發生新的 Parkfield 地震,請將大於 today - last_quake 的樣本挑出,其中 today 為今天的十進位年份,last_quake = 2004.74 為上一次 Parkfield 地震的十進位年份。用這些切片後的陣列覆寫對應的 exp_samplesnorm_samples 變數。
  • 使用 np.percentile() 計算下一次 Parkfield 地震時間的 95% 信賴區間。在同一次呼叫中加入第 50 百分位數即可同時計算中位數。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Draw samples from the Exponential distribution: exp_samples
exp_samples = ____

# Draw samples from the Normal distribution: norm_samples
norm_samples = ____

# No earthquake as of today, so only keep samples that are long enough
exp_samples = ____[____ > ____ - ____]
norm_samples = ____[____ > ____ - ____]

# Compute the confidence intervals with medians
conf_int_exp = ____(____, [____, ____, ____]) + last_quake
conf_int_norm = ____(____, [____, ____, ____]) + last_quake

# Print the results
print('Exponential:', conf_int_exp)
print('     Normal:', conf_int_norm)
編輯並執行程式碼