Specifying and hypothesizing
In Chapter 3, you ran a two sample proportion test on the proportion of late shipments across freight cost groups. Recall the hypotheses.
\(H_{0}\): \(late_{\text{expensive}} - late_{\text{reasonable}} = 0\)
\(H_{A}\): \(late_{\text{expensive}} - late_{\text{reasonable}} > 0\)
Let's compare that traditional approach using prop_test()
with a simulation-based infer pipeline.
late_shipments
is available; dplyr
and infer
are loaded.
This exercise is part of the course
Hypothesis Testing in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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