Wilcoxon-Mann-Whitney rank sum test
Wilcoxon-Mann-Whitney ranksum test
无节点状况,假定为样本服从类似形状,如果不是类似形状的话,秩的比较没有过多意义。
这里补充一下:对于含有秩参与的非参数检验,如果形状不类似(比如某个分布过偏或者直接他们的散点图差异很大)、以及分布的密集程度不是很相符合。秩检验对位置参数的确认很不准确。
X有m个数,Y有n个数
\(H_0:\mu_1=\mu_2 \qquad H_1:\mu_1\neq\mu_2\)
define: \(R_i=\#(X_j<Y_i,j \in I_m) + \# (Y_k < Y_i, k\in I_n)\) 为示性函数,表示小于\(Y_i\)混合数据的时记为1。
\(\qquad \qquad W_Y = \sum_{i=1}^{n} R_i = \#(X_j<Y_i,j \in I_m) + \frac{(n)(n+1)}{2}\)
\]
我们得到\(W_{xy} = W_y - \frac{(n)(n+1)}{2}\) 同样得到 \(W_{yx}\)
总和 \(W_x + W_y = \frac{(m+n)(m+n+1)}{2}\)
所以$W_{xy}+ W_{yx} = mn $ 这两个量成为Mann-Whitney 统计量
又由于原假设下,他们同分布,不独立。
我们根据其分步满足的规律,这里举一例:
\(P(R_i=k,R_j = l)= \frac{1}{(m+n)(m+n-1)}, k \neq l\)
得到
\(E(W_y)=\frac{n(n+m+1)}{2} \qquad Var(W_x)= \frac{(mn)(m+n+1)}{2}\)
\(E(W_{xy})=\frac{mn}{2} \qquad\qquad Var(W_{xy}) = \frac{(mn)(m+n+1)}{2}\)
使用时,只需要计算$W_y 和 W_x $ 并计算出相应的$W_{xy} 或者 W_{yx} $ 来和表判断。
R代码解释:
wilcox.test(x,...)
x numeric vector
y optional numeric vector
alternative default: two.sided optinal choice:"greater" or "less"
paired logic TRUE 进行的配对样本检测,此时参数mu = 1为 x-y = 1 的配对样本检测,所以要求两组数据的长度一致。
FALSE 时,进行的时Mann-Whitney 检验。
mu paired test 当 paired 为TRUE时,已说明。 当paired为FALSE时,可以规定M-W检验x-y 的location parameter.
exact a logical indicating whether an exact p-value should be computed.
correct a logical indicating whether to apply continuity correction in the normal approximation for the p-value.// 是否进行正太校正
conf.int a logical indicating whether a confidence interval should be computed.
conf.level confidence level of the interval.
其余参数暂时不会用到
例子:
两组饲料,一组高蛋白,一组低蛋白,分别饲养老鼠,老鼠增加的体重/g
weight.high <- c(134,146,104,119,124,161,107,83,113,129,97,123)
weight.low <- c(70,118,101,85,112,132,94)
wilcox.test(weight.high,weight.low)
Wilcoxon rank sum test
结果:
data: weight.high and weight.low
W = 62, p-value = 0.1003
alternative hypothesis: true location shift is not equal to 0
这和下面的参数效果相同
wilcox.test(weight.high,weight.low,mu=0,paired = FALSE, exact = TRUE)
Wilcoxon rank sum test
data: weight.high and weight.low
W = 62, p-value = 0.1003
alternative hypothesis: true location shift is not equal to 0
这是信息最全的检测,参数mu 和默认为TRUE的可以不写,只写conf.int 和 conf.level
wilcox.test(weight.high,weight.low,mu=0,paired = FALSE, exact = TRUE, correct = TRUE, conf.int = TRUE,conf.level = 0.95)
Wilcoxon rank sum test
data: weight.high and weight.low
W = 62, p-value = 0.1003
alternative hypothesis: true location shift is not equal to 0
95 percent confidence interval:
-5 40
sample estimates:
difference in location
17.5
p-value=0.1003 ,所以肯定拒绝原假设x-y=0了。
我们可以在检验前,先画出散点图
plot(weight.high,c(1:12))
plot(weight.low,c(1:7))
数据量太小,看出来差别确实不大。。。散点图很乱。
下一次更新,关于bootstrap方法的R代码。
Wilcoxon-Mann-Whitney rank sum test的更多相关文章
- 非参数检验|Sign test|Wilcoxon signed rank test|Wilcoxon rank sum test|Bootstrapping
非参数检验条件没有参数,因此就没有分布,利用数据等级之间的差距,依次赋值之后再用参数方法测试.将连续型变量转化为离散型变量,即顺序变量.与参数检验相比,正态分布较弱(p值有可能不显著,浪费信息,比如最 ...
- 曼-惠特尼U检验Mann–Whitney U Test
sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&am ...
- Wilcoxon Signed Rank Test
1.Wilcoxon Signed Rank Test Wilcoxon有符号秩检验(也称为Wilcoxon有符号秩和检验)是一种非参数检验.当统计数据中使用“非参数”一词时,并不意味着您对总体一无所 ...
- 学习笔记53—Wilcoxon检验和Mann-whitney检验的区别
Wilcoxon signed-rank test应用于两个related samples Mann–Whitney U test也叫Wilcoxon rank-sum test,应用于两个indep ...
- R in action读书笔记(7)-第七章:基本统计分析(下)
7.3相关 相关系数可以用来描述定量变量之间的关系.相关系数的符号(±)表明关系的方向(正相关或负相关),其值的大小表示关系的强弱程度(完全不相关时为0,完全相关时为1).除了基础安装以外,我们还将使 ...
- Statistics in Python
Statistics in Python Materials for the “Statistics in Python” euroscipy 2015 tutorial. Requirements ...
- Parametric Statistics
1.What are “Parametric Statistics”? 统计中的参数指的是总体的一个方面,而不是统计中的一个方面,后者指的是样本的一个方面.例如,总体均值是一个参数,而样本均值是一个统 ...
- ROC 曲线/准确率、覆盖率(召回)、命中率、Specificity(负例的覆盖率)
欢迎关注博主主页,学习python视频资源 sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频教程) https://study.163.com/course/introduction.ht ...
- 统计学_Wilcoxon signed-rank test(python脚本)
python机器学习-乳腺癌细胞挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003&u ...
随机推荐
- SQL2008 2机镜像
清除设置 //删除端点 declare @sql varchar() declare @mirrName varchar() select @mirrName=name from sys.databa ...
- java常用设计模式十:模板模式
一.定义 定义一个操作中的算法的骨架,而将一些步骤延迟到子类中.模板方法使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤. 如果上面的话不好理解,请看下面的例子 二.示例 1)定义一个模 ...
- C# 中的委托(Delegate)
委托(Delegate) 是存有对某个方法的引用的一种引用类型变量.引用可在运行时被改变. 委托(Delegate)特别用于实现事件和回调方法.所有的委托(Delegate)都派生自 System.D ...
- HDU 2147 kiki's game (奇偶博弈)
题意:给定一个 n * m 的格子,从右上角(1, m) 开始每个玩家只能从向下,向左,或者向左下走,谁不能走,谁输. 析:自己做出来,看了网上的几个博客,好像都没说为什么是只有全奇的情况才会输,个人 ...
- 以太网MAC地址规范
原文地址:http://blog.csdn.net/skyflying2012/article/details/40322563 之前一段时间在做网卡驱动的工作,现在产品量产,利用ifconfig e ...
- typecho 调用评论最多热门文章
在当前主题的functions.php文件中添加以下函数代码: function getHotComments($limit = 10){ $db = Typecho_Db::get(); $resu ...
- 为什么要用GCD-Swift2.x
为什么要用GCD-Swift2.x 当今世界,多核已然普及.但是APP却不见得很好的跟上了这个趋势.APP 想要利用好多核就必须可以保证任务能有效的分配.并行执行可以让APP同时执行很多 的任务.这个 ...
- UIActivityIndicatorView 的使用
// // UIActivityIndicator.m // ToolBar // // Created by lanouhn on 15/1/3. // Copyright (c) 2015 ...
- Memory Allocation Error
Memory allocation error happened when I tried to install MySQL 5.7.13 in my server, which has 2G mem ...
- webService之helloword(web)
spring 整合webservice pom.xml文件 <dependencies> <!-- CXF WS开发 --> <dependency> <gr ...