観測統計量と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