適合度の可視化
カイ二乗適合度検定は、カテゴリ変数の各水準の比率を仮説上の値と比較します。この検定を実行する前に、サンプルの分布と仮説分布を視覚的に比べておくと役に立ちます。
late_shipments データセットのベンダーのインコタームズを思い出してください。出荷全体の母集団では、次の頻度で4つの値が出現すると仮定しましょう。
EXW: 0.75CIP: 0.05DDP: 0.1FCA: 0.1
late_shipments は使用可能で、tibble、dplyr、ggplot2、infer は読み込まれています。
この演習はコースの一部です
Rによる仮説検定
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Using late_shipments, count the vendor incoterms
vendor_inco_term_counts <- ___
# Get the number of rows in the whole sample
n_total <- ___
hypothesized <- tribble(
~ vendor_inco_term, ~ prop,
"EXW", 0.75,
"CIP", 0.05,
"DDP", 0.1,
"FCA", 0.1
) %>%
# Add a column of hypothesized counts for the incoterms
___
# See the results
hypothesized