Repeated sampling, point estimates and inference
In the previous exercise, you used a single sample of ninety days to make your conclusion. However, what if you had a different ninety days. Would your conclusions be different?
One way to assess this is by taking repeated samples. By repeatedly sampling from your data and computing your point estimate you can see how it changes.
The same data btc_sp_df
has been loaded for you, as have the packages Pandas as pd
and NumPy as np
.
Cet exercice fait partie du cours
Foundations of Inference in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Write a for loop which repeats the sampling ten times
for i in ____:
# Select a random starting row number
initial_row_number = ____(____(btc_sp_df.shape[0] - 90))
# Select the next 90 rows after the starting row
sample_df = ____[____:____ + ____]
# Compute the percent change in closing price of BTC and print it
btc_pct_change = (____.iloc[0][____] - ____.iloc[-1][____]) / ____.iloc[0][____]
print(btc_pct_change)