Interearthquake time estimates for Parkfield
In this exercise, you will first compute the best estimates for the parameters for the Exponential and Gaussian models for interearthquake times. You will then plot the theoretical CDFs for the respective models along with the formal ECDF of the actual Parkfield interearthquake times.
Este exercício faz parte do curso
Case Studies in Statistical Thinking
Instruções do exercício
- Compute the mean interearthquake time and store it as
mean_time_gap
. The time gaps between the major earthquakes, in units of years, are stored intime_gap
. - Compute the standard deviation of the interearthquake times and store it as
std_time_gap
. - Use
np.random.exponential()
to draw 10,000 samples out of an Exponential distribution with the appropriate mean. Store them in the variabletime_gap_exp
. - Use
np.random.normal()
to draw 10,000 samples out of a Normal distribution with the appropriate mean and standard deviation. Store them in the variabletime_gap_norm
. - Plot the theoretical CDFs in one line each, using the
*dcst.ecdf()
approach introduced earlier in this chapter. - Plot the ECDF using the
formal=True
,min_x=-10
, andmax_x=50
keyword arguments.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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()