Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Case Studies in Statistical Thinking

Cursus bekijken

Oefeninstructies

  • 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 for mags_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(). Use dcst.diff_of_means as the argument for func.
  • Compute and print the p-value taking "at least as extreme as" to mean that the test statistic is smaller than what was observed.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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)
Code bewerken en uitvoeren