开始使用免费开始使用

两样本比例检验

您也许会关心,运费金额是否会影响运输是否延迟。回顾 late_shipments 数据集,是否延迟存放在 late 列。运费分组存放在 freight_cost_group 列,类别为 "expensive""reasonable"

我们可以提出如下假设进行检验。

\(H_{0}\): \(late_{\text{expensive}} - late_{\text{reasonable}} = 0\)

\(H_{A}\): \(late_{\text{expensive}} - late_{\text{reasonable}} > 0\)

p_hats 包含 "expensive" 与 "reasonable" 两组的总体比例估计(样本比例)。ns 包含这两组的样本量。

本练习是课程的一部分

R 中的假设检验

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# See the sample variables
print(p_hats)
print(ns)

# Calculate the pooled estimate of the population proportion
p_hat <- ___



# See the result
p_hat
编辑并运行代码