본문 바로가기
5. 평균비교(2집단) | 비모수/1) 윌콕슨 순위합검정

[R 통계분석] 윌콕슨 순위합 검정 (Mann–Whitney U test)

by makhimh 2019. 11. 29.
반응형

[R 통계분석] 윌콕슨 순위합 검정 (Mann–Whitney U test)


#1. 방법


wilcox.test(x, y = NULL,
            alternative = c("two.sided", "less", "greater"),
            mu = 0, paired = FALSE, exact = NULL, correct = TRUE,
            conf.int = FALSE, conf.level = 0.95, ...)


▶ x,y 자리에 데이터 입력함.
▶ 독립표본 t검정 대신 사용하는 비모수검정.
▶ 정규성 검정이 기각될 경우 사용.
▶ Mann–Whitney U test 라고도 부름.



#2. 예제


> 코드


#데이터 생성
set.seed(1)
height_male=rnorm(15,175,5)
height_female=rnorm(15,165,5)

#윌콕슨 순위 합 검정 수행
#귀무가설 : height_male = height_female
wilcox.test(height_male,height_female)

#귀무가설 : height_male < height_female
wilcox.test(height_male,height_female, alternative="greater")

#귀무가설 : height_male > height_female
wilcox.test(height_male,height_female, alternative="less")


> 실행결과


> wilcox.test(height_male,height_female)

    Wilcoxon rank sum test

data:  height_male and height_female
W = 213, p-value = 3.507e-06
alternative hypothesis: true location shift is not equal to 0


> wilcox.test(height_male,height_female, alternative="greater")

    Wilcoxon rank sum test

data:  height_male and height_female
W = 213, p-value = 1.754e-06
alternative hypothesis: true location shift is greater than 0


> wilcox.test(height_male,height_female, alternative="less")

    Wilcoxon rank sum test

data:  height_male and height_female
W = 213, p-value = 1
alternative hypothesis: true location shift is less than 0


반응형

댓글