||
python 中Wilcoxon rank-sum 和 R 中的 wilcox.test
参考网页:http://stackoverflow.com/questions/12797658/pythons-scipy-stats-ranksums-vs-rs-wilcox-test
python scipy 中的 ranksums(x,y) 相当于
R中的 wilcox.text(x,y,exact=FALSE,correct=FALSE)
#### python code
x=[57.07168,46.95301,31.86423,38.27486,77.89309,76.78879,33.29809,58.61569,18.26473,62.92256,50.46951,19.14473,22.58552,24.14309]
y=[8.319966,2.569211,1.306941,8.450002,1.624244,1.887139,1.376355,2.521150,5.940253,1.458392,3.257468,1.574528,2.338976]
scipy.stats.ranksums(x, y)
(4.415880433163923, 1.0059968254463979e-05)
#### r code
x=c(57.07168,46.95301,31.86423,38.27486,77.89309,76.78879,33.29809,58.61569,18.26473,62.92256,50.46951,19.14473,22.58552,24.14309)
y=c(8.319966,2.569211,1.306941,8.450002,1.624244,1.887139,1.376355,2.521150,5.940253,1.458392,3.257468,1.574528,2.338976)
wilcox.test(x, y, exact=FALSE, correct=FALSE)
Wilcoxon rank sum test
data: x and y
W = 182, p-value = 1.006e-05
alternative hypothesis: true location shift is not equal to 0
Compute the Wilcoxon rank-sum statistic for two samples.
The Wilcoxon rank-sum test tests the null hypothesis that two sets of measurements are drawn from the same distribution. The alternative hypothesis is that values in one sample are more likely to be larger than the values in the other sample.
This test should be used to compare two samples from continuous distributions. It does not handle ties between measurements in x and y. For tie-handling and an optional continuity correction see scipy.stats.mannwhitneyu.
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-1-8 01:32
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社