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