ComeçarComece de graça

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.

Este exercício faz parte do curso

Case Studies in Statistical Thinking

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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)
Editar e executar o código