重複抽樣、點估計與推論
在前一個練習中,你用了單一的 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)