관측 통계량과 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