เปรียบเทียบค่าเบี่ยงเบนมาตรฐานของการสุ่มตัวอย่างและ bootstrap
เช่นเดียวกับที่ได้ดูวิธีใช้การแจกแจงของการสุ่มตัวอย่างและการแจกแจง bootstrap เพื่อประมาณค่าเฉลี่ยของประชากร คราวนี้จะมาดูว่าทั้งสองสามารถนำมาใช้ประมาณความแปรผัน หรือโดยเฉพาะค่าเบี่ยงเบนมาตรฐานของประชากรได้อย่างไร
ขอให้จำไว้ว่าขนาดตัวอย่างคือ 5000
spotify_population, spotify_sample, sampling_distribution และ bootstrap_distribution พร้อมใช้งานแล้ว รวมถึง pandas และ numpy ที่โหลดไว้ด้วย alias ตามปกติ
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การสุ่มตัวอย่างใน Python
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Calculate the population std dev popularity
pop_sd = ____
# Calculate the original sample std dev popularity
samp_sd = ____
# Calculate the sampling dist'n estimate of std dev popularity
samp_distn_sd = ____
# Calculate the bootstrap dist'n estimate of std dev popularity
boot_distn_sd = ____
# Print the standard deviations
print([pop_sd, samp_sd, samp_distn_sd, boot_distn_sd])