การระบุและตั้งสมมติฐาน
ในบทที่ 3 คุณได้รันการทดสอบสัดส่วนสองกลุ่มบนสัดส่วนของการจัดส่งล่าช้าในแต่ละกลุ่มค่าขนส่ง ขอทบทวนสมมติฐานกันอีกครั้ง
\(H_{0}\): \(late_{\text{expensive}} - late_{\text{reasonable}} = 0\)
\(H_{A}\): \(late_{\text{expensive}} - late_{\text{reasonable}} > 0\)
มาเปรียบเทียบวิธีดั้งเดิมที่ใช้ prop_test() กับ infer pipeline แบบ simulation กัน
ชุดข้อมูล late_shipments พร้อมใช้งานแล้ว และโหลด dplyr กับ infer ไว้เรียบร้อยแล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Hypothesis Testing in R
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Perform a proportion test appropriate to the hypotheses
test_results <- late_shipments %>%
prop_test(
late ~ freight_cost_group,
order = c("expensive", "reasonable"),
success = "Yes",
alternative = "greater",
correct = FALSE
)
# See the results
test_results