开始使用免费开始使用

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.

本练习是课程的一部分

Foundations of Inference in Python

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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)
编辑并运行代码