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}\)

\[\qquad \qquad W_{xy} = \sum R_i =\# (X_i < Y_j,i \in I_m j \in I_n)
\]

我们得到\(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的更多相关文章

  1. 非参数检验|Sign test|Wilcoxon signed rank test|Wilcoxon rank sum test|Bootstrapping

    非参数检验条件没有参数,因此就没有分布,利用数据等级之间的差距,依次赋值之后再用参数方法测试.将连续型变量转化为离散型变量,即顺序变量.与参数检验相比,正态分布较弱(p值有可能不显著,浪费信息,比如最 ...

  2. 曼-惠特尼U检验Mann–Whitney U Test

    sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&am ...

  3. Wilcoxon Signed Rank Test

    1.Wilcoxon Signed Rank Test Wilcoxon有符号秩检验(也称为Wilcoxon有符号秩和检验)是一种非参数检验.当统计数据中使用“非参数”一词时,并不意味着您对总体一无所 ...

  4. 学习笔记53—Wilcoxon检验和Mann-whitney检验的区别

    Wilcoxon signed-rank test应用于两个related samples Mann–Whitney U test也叫Wilcoxon rank-sum test,应用于两个indep ...

  5. R in action读书笔记(7)-第七章:基本统计分析(下)

    7.3相关 相关系数可以用来描述定量变量之间的关系.相关系数的符号(±)表明关系的方向(正相关或负相关),其值的大小表示关系的强弱程度(完全不相关时为0,完全相关时为1).除了基础安装以外,我们还将使 ...

  6. Statistics in Python

    Statistics in Python Materials for the “Statistics in Python” euroscipy 2015 tutorial. Requirements ...

  7. Parametric Statistics

    1.What are “Parametric Statistics”? 统计中的参数指的是总体的一个方面,而不是统计中的一个方面,后者指的是样本的一个方面.例如,总体均值是一个参数,而样本均值是一个统 ...

  8. ROC 曲线/准确率、覆盖率(召回)、命中率、Specificity(负例的覆盖率)

      欢迎关注博主主页,学习python视频资源 sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频教程) https://study.163.com/course/introduction.ht ...

  9. 统计学_Wilcoxon signed-rank test(python脚本)

    python机器学习-乳腺癌细胞挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003&u ...

随机推荐

  1. c语言const和c++const

    1.常量 常量是指值不能被改变的量,又叫做字面值 1.1常量分类 1)字符常量:'a', 'A', '*'. 2)字符串常量:"helloworld","ilovechi ...

  2. SSH三大框架的工作原理

    Hibernate工作原理 原理:1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件2.由hibernate.cfg.xml中的< ...

  3. ckeditor粘帖上传图片控件-更新-2.0.15版本

    泽优Word图片上传产品测试 泽优Word图片上传控件WordPaster2,基于php开发环境测试. 泽优软件官网Word图片上传产品介绍页面: http://www.ncmem.com/webap ...

  4. webservice之helloword(web)rs

    spring整合webservice 1.pom.xml文件 <dependencies> <!-- cxf 进行rs开发 必须导入 --> <dependency> ...

  5. 浅尝辄止之MongoDB

    1 简介 MongoDB是一个介于关系数据库和非关系数据库之间的产品,基于分布式文件存储的数据库,旨在为WEB应用提供可扩展的高性能数据存储 解决方案.MongoDB将数据存储为一个文档,数据结构由键 ...

  6. Establish a website in 5 minutes

    $sudo apt-get update                                    //update   $sudo apt-get install tasksel     ...

  7. 服务化实战之 dubbo、dubbox、motan、thrift、grpc等RPC框架比较及选型

    转自: http://blog.csdn.net/liubenlong007/article/details/54692241 概述 前段时间项目要做服务化,所以我比较了现在流行的几大RPC框架的优缺 ...

  8. Android 百度云推送

    http://developer.baidu.com/wiki/index.php?title=docs/cplat/push/sdk/clientsdk. public class DemoAppl ...

  9. hdu 5072 两两(不)互质个数逆向+容斥

    http://acm.hdu.edu.cn/showproblem.php?pid=5072 求n个不同的数(<=1e5)中有多少组三元组(a, b, c)两两不互质或者两两互质. 逆向求解,把 ...

  10. DXP 板层

    一)DXP-设置板层(D+K )在PCB编辑 Design->Layer Stack Manager(层管理) 1)快捷命令 D + K   进入么多层置管理器 2.鼠标右键 TopLayer- ...