俺的学习笔记

Tuesday, November 13, 2018

The Wilcoxon Signed Rank Test for a Median

The one-sample Wilcoxon signed rank test is a non-parametric alternative to one-sample t-test when the data cannot be assumed to be normally distributed. It’s used to determine whether the median of the sample is equal to a known standard value (i.e. theoretical value).
言い換えれば、Wilcoxonテストは正規分布でないときのt-testであること(トレーニング資料にはOrdinalデータに適用すると書いてある)。
ですので、Wilcoxonテストは平均値を検証するじゃなくて、中間値を検証します。
つまり、統計学的に下記と定義します。
H0:
    m=m0
    m≤m0
    m≥m0
Hα:
    m≠m0  (different)
    m>m0 (greater)
    m<m0(less)
m=標本の中間値(median)
m0=論理の中間値

RでWilcoxonテストを簡単

# こんなデータがあります。
> y=c(4.45,5.23,3.77,4.83,5.04,5.98,5.8,2.75,3.53,5.36)
# 中間値(median)は4.9であるかをテストします。
> wilcox.test(y, mu = 4.9, alternative = "two.sided")

    Wilcoxon signed rank test

data: y
V = 23, p-value = 0.6953
alternative hypothesis: true location is not equal to 4.9
# 結果、p-valueは0.6953となり、0.05より遥かに大きいので、H0が成立。つまりm=4.9

# m=3.7かを検証してみます
> wilcox.test(y, mu = 3.7, alternative = "two.sided")

    Wilcoxon signed rank test

data: y
V = 49, p-value = 0.02734
alternative hypothesis: true location is not equal to 3.7
# 結局p-valueは0.027で、0.05より小さく、Hαが成立。つまりm≠3.7


> wilcox.test(y, mu = 3.7, alternative = "less")

    Wilcoxon signed rank test

data: y
V = 49, p-value = 0.9902
alternative hypothesis: true location is less than 3.7
# m>3.7の確率は0.99、H0が成立

> wilcox.test(y, mu = 3.7, alternative = "greater")

    Wilcoxon signed rank test

data: y
V = 49, p-value = 0.01367
alternative hypothesis: true location is greater than 3.7
# m<3.7の確率は0.014、Hαが成立。つまりm>3.7
https://onlinecourses.science.psu.edu/stat414/node/319/
http://www.sthda.com/english/wiki/one-sample-wilcoxon-signed-rank-test-in-r
http://rcompanion.org/handbook/F_02.html

Labels: , ,

0 Comments:

Post a Comment

<< Home