MATLAB WRanksum test,python与Matlab的ranksum等价物是什么?

这取决于您使用的选项。检查以下示例:

1-MATLABrng('default') % for reproducibility

x = unifrnd(0,1,20,1);

y = unifrnd(0.25,1.25,20,1);

p = ranksum(x,y);

p =

0.2503

2-Python

(为了保持一致,我没有再次生成数字,但是我已经将MATLAB中生成的数字移动到Python脚本中)

^{pr2}$

此结果包含以下选项:

1-对于MATLAB:p = ranksum(x,y) returns the p-value of a two-sided Wilcoxon rank sum

test. ranksum tests the null hypothesis that data in x and y are

samples from continuous distributions with equal medians, against the

alternative that they are not. The test assumes that the two samples

are independent. x and y can have different lengths. This test is

equivalent to a Mann-Whitney U-test.

2-对于Python: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.

另一个例子

这里我使用的是相同的数据,具有相同的MATLAB功能,但有不同的选择。现在您可以看到结果等于Scipy中mannwhitneyu函数的结果。在

MATLAB[p,h,stats] = ranksum(x,y,'alpha',0.01,'tail','left','method','exact');

p =

0.1267

Pythonm = mannwhitneyu(xx, yy, use_continuity=True)

print m

MannwhitneyuResult(statistic=157.0, pvalue=0.12514839875175593)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值