两个样本的 proportions_ztest()
手动计算 p 值非常费力。了解计算过程很有用,但在真实分析中并不实用。日常使用时,最好使用 statsmodels 包。
回顾假设。
$H_{0}$:\(late_{\text{expensive}} - late_{\text{reasonable}} = 0\)
$H_{A}$:\(late_{\text{expensive}} - late_{\text{reasonable}} > 0\)
提供了 late_shipments,其中包含 freight_cost_group 列。numpy 和 pandas 已按常用别名加载,并且已从 statsmodels.stats.proportion 导入了 proportions_ztest。
本练习是课程的一部分
Python 假设检验
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Count the late column values for each freight_cost_group
late_by_freight_cost_group = ____
# Print the counts
print(late_by_freight_cost_group)