ค่าสถิติที่สังเกตได้และ p-value
ตอนนี้มี null distribution แล้ว เพื่อให้ได้ p-value และประเมินหลักฐานเทียบกับ null hypothesis จึงต้องคำนวณความแตกต่างของสัดส่วนที่สังเกตได้จากตัวอย่าง late_shipments
โหลด late_shipments ไว้แล้ว รวมถึง dplyr, infer, และ ggplot2
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Hypothesis Testing in R
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
null_distn <- late_shipments %>%
specify(
late ~ freight_cost_group,
success = "Yes"
) %>%
hypothesize(null = "independence") %>%
generate(reps = 2000, type = "permute") %>%
calculate(
stat = "diff in props",
order = c("expensive", "reasonable")
)
# Copy, paste, and modify the pipeline to get the observed statistic
obs_stat <- ___
# See the result
obs_stat