proportions_ztest() for two samples
That took a lot of effort to calculate the p-value, so while it is useful to see how the calculations work, it isn't practical to do in real-world analyses. For daily usage, it's better to use the statsmodels
package.
Recall the hypotheses.
\(H_{0}\): \(late_{\text{expensive}} - late_{\text{reasonable}} = 0\)
\(H_{A}\): \(late_{\text{expensive}} - late_{\text{reasonable}} > 0\)
late_shipments
is available, containing the freight_cost_group
column. numpy
and pandas
have been loaded under their standard aliases, and proportions_ztest
has been loaded from statsmodels.stats.proportion
.
This exercise is part of the course
Hypothesis Testing in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Count the late column values for each freight_cost_group
late_by_freight_cost_group = ____
# Print the counts
print(late_by_freight_cost_group)