ComeçarComece de graça

EDA: Comparing magnitudes before and after 2010

Make an ECDF of earthquake magnitudes from 1980 through 2009. On the same plot, show an ECDF of magnitudes of earthquakes from 2010 through mid-2017. The time of the earthquakes, as decimal years, are stored in the NumPy array time and the magnitudes in the NumPy array mags.

Este exercício faz parte do curso

Case Studies in Statistical Thinking

Ver curso

Instruções do exercício

  • Use Boolean indexing to slice out the magnitudes of all earthquakes before 2010 and store the result in mags_pre. Similarly, generate a numpy array mags_post that has all magnitudes of earthquakes in and after 2010.
  • Use plt.plot() with a *dcst.ecdf(____) argument to make ECDFs for pre- and post- 2010 earthquake magnitudes. Remember to specify arguments for the marker and linestyle parameters.
  • Hit 'Submit Answer' to view the plot.

Exercício interativo prático

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

# Get magnitudes before and after 2010
mags_pre = ____[____ < ____]
mags_post = ____[____ >= ____]

# Generate ECDFs


# Label axes and show plot
_ = plt.xlabel('magnitude')
_ = plt.ylabel('ECDF')
plt.legend(('1980 though 2009', '2010 through mid-2017'), loc='upper left')
plt.show()
Editar e executar o código