下一次帕克菲尔德大地震何时发生?
帕克菲尔德地区上一次大地震发生在 2004 年 9 月 27 日晚(当地时间)。您的任务是分别在指数模型和高斯模型的假设下,估计下一次帕克菲尔德地震的发生时间。在这两种情况下,最佳点估计为平均时间间隔,您在上一个练习中计算为 24.62 年,也就是说下一次地震约在 2029 年。请在指数分布的假设下(由您在上一个练习计算得到的 mean_time_gap 参数化),计算下一次地震发生时间的 95% 置信区间。在正态分布的假设下(由 mean_time_gap 和 std_time_gap 参数化)也做同样的计算。
本练习是课程的一部分
统计思维案例研习
练习说明
- 从均值为
mean_time_gap的指数分布中抽取 100,000 个样本。将结果存为exp_samples。 - 从均值为
mean_time_gap、标准差为std_time_gap的正态分布中抽取 100,000 个样本。将结果存为norm_samples。 - 由于截至今天仍未发生新的帕克菲尔德地震,请切片保留大于
today - last_quake的样本。其中,今天的十进制年份已存为today,且last_quake = 2004.74,表示上一次帕克菲尔德地震的十进制年份。用切片后的数组覆盖相应的exp_samples和norm_samples变量。 - 使用
np.percentile()计算下一次帕克菲尔德地震发生时间的 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)