Hypothesis test: are the b-values different?
Perform the hypothesis test sketched out on the previous exercise. The variables mags_pre
and mags_post
are already loaded into your namespace, as is mt = 3
.
Diese Übung ist Teil des Kurses
Case Studies in Statistical Thinking
Anleitung zur Übung
- Slice out the magnitudes of earthquakes before 2010 that have a magnitude above (or equal) the completeness threshold and overwrite
mags_pre
with the result. Do the same formags_post
. - Compute the observed difference in mean magnitudes, subtracting the magnitudes of pre-2010 earthquakes from those of post-2010 earthquakes.
- Generate 10,000 permutation replicates using
dcst.draw_perm_reps()
. Usedcst.diff_of_means
as the argument forfunc
. - Compute and print the p-value taking "at least as extreme as" to mean that the test statistic is smaller than what was observed.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Only magnitudes above completeness threshold
mags_pre = ____[____ >= ____]
mags_post = ____[____ >= ____]
# Observed difference in mean magnitudes: diff_obs
diff_obs = ____ - ____
# Generate permutation replicates: perm_reps
perm_reps = ____
# Compute and print p-value
p_val = ____(____ < ____) / 10000
print('p =', p_val)