我正在对我的数据进行 Wilcoxon 秩和检验。数据的单位不同,尺度也大不相同。在运行测试之前我需要输入这个命令吗?
## where x is my data frame
scale(x, center = TRUE, scale = TRUE)
还是 Wilcoxon 秩和检验本身就是这样做的?
我正在对我的数据进行 Wilcoxon 秩和检验。数据的单位不同,尺度也大不相同。在运行测试之前我需要输入这个命令吗?
## where x is my data frame
scale(x, center = TRUE, scale = TRUE)
还是 Wilcoxon 秩和检验本身就是这样做的?
您无法缩放,因为 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