兩樣本的 prop_test()
剛才為了算出 p 值花了不少功夫。雖然了解計算過程很有幫助,但在真實分析中不太實用。日常使用時,改用 infer 套件會更好。
回顧假設如下。
\(H_{0}\): \(late_{\text{expensive}} - late_{\text{reasonable}} = 0\)
\(H_{A}\): \(late_{\text{expensive}} - late_{\text{reasonable}} > 0\)
late_shipments 可使用;infer 已載入。
本練習屬於課程
R 中的假設檢定
練習說明
使用 late_shipments 資料集,呼叫 prop_test() 執行與上述假設相符的比例檢定。
- 指定
late相對freight_cost_group的假設。 - 設定運費成本群組的
order。 - 指定
late的success值與alternative假說的型別。 - 不要使用 Yates 連續性校正。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Perform a proportion test appropriate to the hypotheses
test_results <- ___
# See the results
test_results