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. WPF编程宝典(Pro wpf in c# 2012)(文摘)

    第一部分 基础知识 第1章 WPF概述 第2章 XAML 第3章 布局 第4章 依赖项属性 第5章 路由事件 第二部分 进一步研究WPF 第6章 控件 第7章 Application类 第8章 元素绑 ...

  2. vue中的前置守卫

    前置守卫是为了验证用户信息真实性,一些内容只能在用户登陆以后才能进行查看,例如个人中心,我的购物车,等个人页面,非隐私页面 用router.beforeEach进行验证,这个方法必须写在router实 ...

  3. arguments[0]()的详解

    var length = 10; function fn(){ console.log(this.length); } var obj = { length:5, method:function(fn ...

  4. php 微信登录 公众号 获取用户信息 微信网页授权

    php 微信登录 公众号 获取用户信息 微信网页授权 先自己建立两个文件: index.php  和  getUserInfo.php index.php <?php //scope=snsap ...

  5. Word图片上传控件-eWebEditor9x整合教程-Xproer.WordPaster

    示例下载(JSP):eWebEditor9x, 示例下载(.NET):eWebEditor9x,   1.1. 集成到eWebEditor9x 主要步骤如下: 1.增加WordPaster文件夹   ...

  6. _ZSkill_快捷键_Xcode快捷键

    Xcode 快捷键使用 Command 用来导航,控制导航区域 Alt 控制右边的部分. 如Assistant Editor ,utility editor. Control 编辑区域上的jump b ...

  7. Hdu2819 Swap

    Swap Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  8. SurfaceView+MediaPlayer播放视频

    SurfaceView拥有独立的绘图表面,因此SurfaceView的UI就可以在一个独立的线程中进行行绘制.又由于不占用主线程资源,SurfaceView一方面可以实现复杂而高效的UI,另一方面又不 ...

  9. libtool 创建库的工具

    libtool 创建库的工具 1. 背景 在不同的系统中建立动态链接库的方法有很大的差别,这主要是因为每个系统对动态链接库的用法和实现并不相同,以及编译器对动态链接库支持的选项也不太一样. 对于开发人 ...

  10. nutch从搜索引擎到网络爬虫

    人物介绍 姓名:DougCutting 个人名望:开发出开源全文检索引擎工具包Lucene. 个人简介/主要荣誉:除了 Lucene,还开发了著名的网络爬虫工具 Nutch,分布式系统基础架构Hado ...