抽樣分佈 vs. 自助法分佈
抽樣分佈與自助法(bootstrapping)分佈彼此緊密相關。在你能夠反覆從母體抽樣的情況下(這種情況其實很少見),先後產生抽樣分佈與自助法分佈,能幫助你觀察兩者的關係。
這裡你關心的統計量是歌曲 popularity(熱門度)的平均值。
已提供 spotify_population(整個資料集)與 spotify_sample(從 spotify_population 隨機抽出的 500 列);pandas 與 numpy 也已以慣用別名載入。
本練習屬於課程
Python 中的抽樣
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
mean_popularity_2000_samp = []
# Generate a sampling distribution of 2000 replicates
____:
mean_popularity_2000_samp.append(
# Sample 500 rows and calculate the mean popularity
____
)
# Print the sampling distribution results
print(mean_popularity_2000_samp)