產生與計算
在假設檢定的 infer 流程中,為了計算虛無分佈,需要四個步驟:specify、hypothesize、generate、calculate。
延續你在前一個程式練習中開始的流程。我們將取得一組「母體比例差」的結果,這些結果會像是在虛無假設為真時的分佈:也就是不同運費成本群組之間,延遲出貨的比例相同。
已提供 late_shipments;且已載入 dplyr、infer 和 ggplot2。
本練習屬於課程
R 中的假設檢定
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Extend the pipeline to generate 2000 permutations
generated <- late_shipments %>%
specify(
late ~ freight_cost_group,
success = "Yes"
) %>%
hypothesize(null = "independence") %>%
___
# See the result
generated