table is ordered by descending magnitude and by taking 100 for sample 1 and 100 for sample 2,
we are calculating mean relative to time so both these samples are not representative of the mean
magnitude of earthquakes for the entire population.
Question 2.
Write code producing a sample that should represent the population of size

500 then take the mean of the magnitudes of the earthquakes in this sample.
Assign these to
representative_sample
and
representative_mean
respectively.
Hint:
In class, what sort of samples can properly represented the population?

11

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests
---------------------------------------------------------------------
Test summary
Passed: 1
Failed: 0
[ooooooooook] 100.0% passed
Question 3.
Suppose we want to figure out what the biggest magnitude earthquake was in
2017, but we are tasked with doing this only with a sample of 500 from the earthquakes table.
To determine whether trying to find the biggest magnitude from a sample is a plausible idea,
write code that simulates the maximum of a random sample of size 500 from the
earthquakes
table 5000 times. Assign your array of maximums to
maximums
.

12

In [85]:
_
=
ok
.
grade(
'
q4_3
'
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests
---------------------------------------------------------------------
Test summary
Passed: 1
Failed: 0
[ooooooooook] 100.0% passed
Question 4.
Is a random sample of size 500 likely to help you determine the largest magnitude
earthquake in the population? Find the magnitude of the (actual) strongest earthquake in 2017 to
help you determine your answer. After this, explain whether you believe you can accurately use
a sample size of 500 to determine the maximum. What is a specific con of using the maximum as
your estimator? Use the histogram above to help answer.
Question 5.
We would like to try and accurately predict the magnitude of the largest earth-

quake using a sample of 500 by using a different statistic, rather than the maximum.