การคำนวณช่วงความเชื่อมั่น
คุณได้เรียนรู้วิธีการคำนวณช่วงความเชื่อมั่น 2 วิธี ได้แก่ วิธี quantile และ วิธี standard error วิธี standard error ใช้ inverse cumulative distribution function (inverse CDF) ของการแจกแจงแบบปกติในการคำนวณช่วงความเชื่อมั่น ในแบบฝึกหัดนี้ จะได้ลองใช้ทั้งสองวิธีกับข้อมูล Spotify
มี spotify_population, spotify_sample และ bootstrap_distribution พร้อมใช้งานแล้ว รวมถึง pandas และ numpy ที่โหลดด้วย alias ตามปกติ และ norm ที่โหลดจาก scipy.stats
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การสุ่มตัวอย่างใน Python
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Generate a 95% confidence interval using the quantile method
lower_quant = ____
upper_quant = ____
# Print quantile method confidence interval
print((lower_quant, upper_quant))