重复抽样、点估计与推断
在上一个练习中,您使用了一个为期 90 天的单一样本来得出结论。不过,如果换成「另一组」90 天呢?您的结论会不会不同?
评估这一点的一种方法是进行重复抽样。通过从数据中反复抽样并计算点估计,您可以观察它的变化情况。
同一份数据 btc_sp_df 已为您加载,同时还加载了 Pandas(命名为 pd)和 NumPy(命名为 np)。
本练习是课程的一部分
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)