The b-value for Parkfield
The ECDF is effective at exposing roll-off, as you could see below magnitude 1. Because there are plenty of earthquakes above magnitude 3, you can use mt = 3 as your completeness threshold. With this completeness threshold, compute the b-value for the Parkfield region from 1950 to 2016, along with the 95% confidence interval. Print the results to the screen. The variable mags
with all the magnitudes is in your namespace.
Overlay the theoretical Exponential CDF to verify that the Parkfield region follows the Gutenberg-Richter Law.
This exercise is part of the course
Case Studies in Statistical Thinking
Exercise instructions
- Compute the b-value and the 95% confidence interval using your
b_value()
function. Use 10,000 bootstrap replicates. - Use
np.random.exponential()
to draw 100,000 samples from the theoretical distribution. The mean for the distribution isb/np.log(10)
, and you need to addmt
to your samples to appropriately handle the location parameter. Store the result inm_theor
. - Plot the ECDF of
m_theor
as a line. - Plot the ECDF of all magnitudes above
mt
as dots. - Hit 'Submit Answer' to display the plot and print the b-value and confidence interval to the screen.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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))