ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 대응 2표본에 대한 윌콕슨의 부호순위 검정(Paired Comparison : Wilcoxon Signed Rank Test)
    R/NonParametricMethod 2017. 12. 10. 23:34

    install.packages("BSDA")

    install.packages("exactRankTests")

    library(BSDA)

    library(exactRankTests)



    # H0 : mu_A equal mu_B
    # H1 : mu_A not equal mu_B



    # 1. Dependent-samples Sign-Test
    pre.A <- c(5, 2, 4, 7, 4, 4, 8, 3, 7, 6)
    post.A <- c(6, 5, 4, 9, 4, 6, 8, 5, 6, 7)
    BSDA::SIGN.test(pre.A, post.A, md = 0, paired = TRUE, alternative = "two.sided")


    # 결과물
    Dependent-samples Sign-Test

    data: pre.A and post.A
    S = 1, p-value = 0.125
    alternative hypothesis: true median difference is not equal to 0
    95 percent confidence interval:
    -2 0
    sample estimates:
    median of x-y 
    -1

    Achieved and Interpolated Confidence Intervals:

    Conf.Level L.E.pt U.E.pt
    Lower Achieved CI 0.8906 -2 0
    Interpolated CI 0.9500 -2 0
    Upper Achieved CI 0.9785 -2 0


    # 결론 : 유의확률이 0.125이므로 귀무가설을 기각할 수 없다.



    # 2. Wilcoxon Signed Rank Test
    wilcox.test(pre.A, post.A, paired = TRUE, alternative = "two.sided")


    # 결과물
    Wilcoxon signed rank test with continuity correction

    data: pre.A and post.A
    V = 2, p-value = 0.04858
    alternative hypothesis: true location shift is not equal to 0


    # 결론 : 유의확률이 0.04858이므로 귀무가설을 기각할 수 있다.



    # 3. Exact Wilcoxon signed rank test
    exactRankTests::wilcox.exact(pre.A, post.A, paired = TRUE, alternative = "two.sided")


    # 결과물
    Exact Wilcoxon signed rank test

    data: pre.A and post.A
    V = 2, p-value = 0.0625
    alternative hypothesis: true mu is not equal to 0


    # 결론 : 유의확률이 0.0625이므로 귀무가설을 기각할 수 없다.



    [출처] R을 이용한 비모수 통계학, 임동훈 지음, 자유아카데미, p41~44


Designed by Tistory.