我正在对我的数据运行Wilcoxon秩和检验。数据具有不同的单位,并且差异很大。 在运行测试之前是否需要输入此命令?
## where x is my data frame
scale(x, center = TRUE, scale = TRUE)
或Wilcoxon秩和检验本身就是这样做的吗?
答案 0 :(得分:4)
由于Wilcoxon是位置测试(R中的默认值为mu = 0),因此无法缩放,如果扩展数据,则会丢失真实的位置信息。
> x <- rnorm(100,700,20)
>
> wilcox.test(x) # Mu = 0
Wilcoxon signed rank test with continuity correction
data: x
V = 5050, p-value < 2.2e-16
alternative hypothesis: true location is not equal to 0
> wilcox.test(x,mu=mean(x))
Wilcoxon signed rank test with continuity correction
data: x
V = 2650, p-value = 0.6686
alternative hypothesis: true location is not equal to 697.4377
> wilcox.test(scale(x)) # Mu = 0
Wilcoxon signed rank test with continuity correction
data: scale(x)
V = 2650, p-value = 0.6686
alternative hypothesis: true location is not equal to 0