当前位置:网站首页>Wilcoxon rank-sum 和 signed-rank
Wilcoxon rank-sum 和 signed-rank
2022-07-27 10:59:00 【想搞钱的小陈】
转载至:Wilcoxon 检验之 rank-sum 与 signed-rank_Yongfeng's Blog-CSDN博客
Wilcoxon rank-sum test和signed-rank test 经常在做时间序列分析的时候会用到,主要用于多个算法之间的对比 ,还有cd图。
1. Wilcoxon 秩和检验
用于判断2者算法是否有差异。计算每个算法对应数据集的排名(rank),然后把rank进行求和,得到R1,R2。然后计算U1和U2
U1=n1*n2+n1(n1+1)/2 -T
U2=n1*n2-U1
然后查 Wilcoxon 双尾临界表,如果U1<临界值,拒绝原假设,U1>临界值,接受原假设。(原假设是2个算法无差异)
from scipy import stats
def wilcoxon_rank_sum_test(x, y):
res = stats.mannwhitneyu(x ,y)
print(res)得到的结果有2个值,一个statistic,一个是p-value
> MannwhitneyuResult(statistic=6.5, pvalue=0.006966479792405637)
2. Wilcoxon 符号秩检验



最后,根据|W|查表,得到Wilcoxon 在α=0.05,n=9的时候的临界值为5,而我们计算出来的|w|=9>5,因此不能拒绝原假设,2者没有显著性差异。
from scipy import stats
def wilcoxon_signed_rank_test(y1, y2):
res = stats.wilcoxon(y1, y2)
print(res) 得到的结果如下,其中 statistic = 18.0,表示 2 类符号秩和较小的一个(w+和w-最小的是18);pvalue=0.5936,就是我们需要的p-value ,之所以出现Warning信息是因为我们的数据量太少,一般来讲大于 20 是比较合适做假设检验的。
> E:\Software\Anaconda2\lib\site-packages\scipy\stats\morestats.py:2397: UserWarning:
> Warning: sample size too small for normal approximation.
> warnings.warn("Warning: sample size too small for normal approximation.")
> WilcoxonResult(statistic=18.0, pvalue=0.5936305914425295)
边栏推荐
- SQL statement learning and the use of pymysql
- First experience of three.js: simulating the growth of a small branch
- Moveit2 - 5. Scenario Planning
- Smart pointer (shared_ptr, unique_ptr, weak_ptr)
- ZABBIX custom monitoring items
- 多种进制之间的转换
- Summary of C language knowledge involved in learning STM32F103 (link only)
- Win10 vscode code code format setting and remote breakpoint debugging
- 82. (cesium home) cesium points move on 3D models
- Longest ascending subsequence model acwing 1010. Interceptor missile
猜你喜欢

Longest ascending subsequence model acwing 1014. mountaineering

When std:: bind meets this

Knapsack model acwing 423. Picking herbs

Backpack model acwing 1022. Collection of pet elves

Find the combination number acwing 886. find the combination number II

Codeforces round #664C

【Unity入门计划】CreatorKitFPS:第一人称射击3D小游戏

区间问题 AcWing 906. 区间分组

Moveit2 -- 2. Quick start of moveit in rviz

为什么TCP三次握手的时候ACK=Seq+1
随机推荐
开源flink有写holo的Datastream connector或者flink sql conn
(9) Shell I / O redirection
PAT(乙级)2022年夏季考试
Why choose smart TV?
(10) File contains
Error encountered in adding quick open option to right-click menu:
The C programming language (2nd) -- Notes -- 1.6
Kepserver configuration
The difference between extern and static
What is private traffic?
Everything cannot be searched for startup_ Lpc11x.s file
Stm32f10x -- C Language-1
Error while unzipping file in win10: unable to create symbolic link. You may need to run WinRAR with administrator privileges. The client does not have the required privileges
49 letter ectopic grouping and 242 effective letter ectopic words
LeetCode 01: T1. 两数之和 ; T1108. IP 地址无效化 ; T344. 反转字符串
CTF crypto RSA getting started
Summary of C language knowledge involved in learning STM32F103 (link only)
C programming language (2nd Edition) -- Reading Notes -- 1.4
JUC框架 从Runnable到Callable到FutureTask 使用浅析
为什么选择智能电视?