觀察到的統計量與 p 值
你現在已經有虛無分佈了。若要取得 p 值並評估反對虛無假設的證據,你需要計算 late_shipments 樣本中觀察到的比例差。
已提供 late_shipments;dplyr、infer 與 ggplot2 都已載入。
本練習屬於課程
R 中的假設檢定
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
null_distn <- late_shipments %>%
specify(
late ~ freight_cost_group,
success = "Yes"
) %>%
hypothesize(null = "independence") %>%
generate(reps = 2000, type = "permute") %>%
calculate(
stat = "diff in props",
order = c("expensive", "reasonable")
)
# Copy, paste, and modify the pipeline to get the observed statistic
obs_stat <- ___
# See the result
obs_stat