2つの比率の検定
運賃の支払い額が、発送が遅れたかどうかに影響するのか知りたくなるかもしれません。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