开始使用免费开始使用

Parkfield 的震间时间估计

在本练习中,您将先计算指数分布与高斯分布(正态分布)模型的震间时间参数的最佳估计。然后,您将把各自模型的理论 CDF 与 Parkfield 实际震间时间的正式 ECDF 一起绘制出来进行比较。

本练习是课程的一部分

统计思维案例研习

查看课程

练习说明

  • 计算震间时间的均值,并存为 mean_time_gap。主要地震之间的时间间隔(单位为年)已存于 time_gap
  • 计算震间时间的标准差,并存为 std_time_gap
  • 使用 np.random.exponential() 从具有相应均值的指数分布中抽取 10,000 个样本。将其存入变量 time_gap_exp
  • 使用 np.random.normal() 从具有相应均值与标准差的正态分布中抽取 10,000 个样本。将其存入变量 time_gap_norm
  • 使用本章前面介绍的 *dcst.ecdf() 方法,将每个理论 CDF 各用一条线绘出。
  • 绘制 ECDF 时,使用关键字参数 formal=Truemin_x=-10max_x=50

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Compute the mean time gap: mean_time_gap
mean_time_gap = ____

# Standard deviation of the time gap: std_time_gap
std_time_gap = ____

# Generate theoretical Exponential distribution of timings: time_gap_exp
time_gap_exp = ____

# Generate theoretical Normal distribution of timings: time_gap_norm
time_gap_norm = ____

# Plot theoretical CDFs
_ = plt.plot(*____)
_ = plt.plot(*____)

# Plot Parkfield ECDF
_ = plt.plot(*____(____, ____=____, ____=____, ____=____))

# Add legend
_ = plt.legend(('Exp.', 'Norm.'), loc='upper left')

# Label axes, set limits and show plot
_ = plt.xlabel('time gap (years)')
_ = plt.ylabel('ECDF')
_ = plt.xlim(-10, 50)
plt.show()
编辑并运行代码