[R 통계분석] 윌콕슨 부호순위 검정
#1. 방법
wilcox.test(x, y = NULL,
alternative = c("two.sided", "less", "greater"),
mu = 0, paired = TRUE, exact = NULL, correct = TRUE,
conf.int = FALSE, conf.level = 0.95, ...)
▶ x,y 자리에 데이터 입력함.
▶ 대응표본 t검정 대신 사용하는 비모수검정.
▶ 정규성 검정이 기각될 경우 사용.
▶ paired 옵션을 TRUE로 설정할 경우 윌콕슨 순위합 검정이 수행됨.
#2. 예제
> 코드
set.seed(1)
height_before=rnorm(15,175,5)
height_after=rnorm(15,165,5)
#윌콕슨 부호 순위 검정 수행
#귀무가설 : height_before = height_after
wilcox.test(height_before,height_after,paired=TRUE)
#귀무가설 : height_before < height_after
wilcox.test(height_before,height_after,paired=TRUE, alternative="greater")
#귀무가설 : height_before > height_after
wilcox.test(height_before,height_after,paired=TRUE, alternative="less")
> 실행결과
> wilcox.test(height_before,height_after,paired=TRUE)
Wilcoxon signed rank test
data: height_before and height_after
V = 120, p-value = 6.104e-05
alternative hypothesis: true location shift is not equal to 0
> wilcox.test(height_before,height_after,paired=TRUE, alternative="greater")
Wilcoxon signed rank test
data: height_before and height_after
V = 120, p-value = 3.052e-05
alternative hypothesis: true location shift is greater than 0
> wilcox.test(height_before,height_after,paired=TRUE, alternative="less")
Wilcoxon signed rank test
data: height_before and height_after
V = 120, p-value = 1
alternative hypothesis: true location shift is less than 0
댓글