抽樣分配 vs. 自助法(bootstrap)分配
抽樣分配與自助法分配密切相關。當你能夠反覆從母體抽樣時(這種情況其實很少見),而且正在同時學習這兩種方法時,依序產生抽樣分配與自助法分配,會有助於你觀察它們之間的關係。
在這裡,你關心的統計量是歌曲 popularity(人氣)分數的平均數。
已提供 spotify_population(整個資料集)與 spotify_sample(僅 500 列,代表原始樣本);並已載入 dplyr。
本練習屬於課程
R 的抽樣
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Generate a sampling distribution
mean_popularity_2000_samp <- ___(
# Use 2000 replicates
___,
expr = {
# Start with the population
___ %>%
# Sample 500 rows without replacement
___ %>%
# Calculate the mean popularity as mean_popularity
___ %>%
# Pull out the mean popularity
___
}
)
# See the result
mean_popularity_2000_samp