적합도 시각화하기
카이제곱 적합도 검정은 범주형 변수의 각 수준 비율을 가설값과 비교합니다. 검정을 실행하기 전, 표본 분포와 가설 분포를 시각적으로 비교해 보면 도움이 됩니다.
late_shipments 데이터셋의 vendor incoterms를 떠올려 보세요. 전체 배송 집단에서 네 값의 빈도가 다음과 같다고 가정해 보겠습니다.
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