Brown-Mood Median Test

对于两独立样本尺度中的位置参数(中位数)检验问题:

\(H_0: med_x = med_y\)   \(H_1=med_x > med_y\)

在\(H_0\)假设下,两组数据具有相同的中位数

对于X,Y两组数据组成的两个数组,进行中位数比较。

核心是比较\(med_xy\) 和\(med_x\) \(med-y\)的关系。

X Y sum
>\(M_{xy}\) A B t
<\(M_{xy}\) C D (m+n)-(A+B)
\(\sum\) m n m=n=A+B+C+D

when m,n,t are fixed.

则A的密度函数如下:

\(P(A=k)=\frac{\binom{m}{k}\binom{n}{n-k}}{\binom{m+n}{t}}\), k\(\leqslant\) min{m,t}

以下是Brown-Mood R代码

#Brown-Mood median test
BM.test <- function(x,y,alt)
{
xy <- c(x,y)
md.xy <-median(xy)
t <- sum(xy > md.xy)
lx <- length(x)
ly <- length(y)
lxy <- lx + ly
A <- sum(x > md.xy)
if(alt == "greater")
{w <- 1 - phyper(A,lx,ly,t)}
else if (alt == "less")
{w <- phyper(A,lx,ly,t)}
conting.table = matrix(c(A,lx-A,lx,t-A,ly-(t-A),ly,t,lxy-t,lxy),3,3)
col.name <- c("X","Y","X+Y")
row.name <- c(">MXY","<MXY","TOTAL")
dimnames(conting.table)<-list(row.name,col.name)
list(contingencu.table=conting.table,p.value = w)
}

这里要特别注意phyper()函数的参数中关于 lower.tail = TRUE 和 FALSE的定义,防止出现多余计算。

\[phyper(q,m,n,k) = \frac{\binom{m}{k}\binom{n}{n-k}}{\binom{m+n}{t}}, k\leqslant min(m,t)
\]

大样本计算时,趋于正态分布:

binom 分布的 $$E[X] = μ = t\cdot\frac{m}{m+n}$$

\[D[x]
\]

example:

x <- c(698,688,675,656,655,648,640,639,620)
y <- c(780,754,740,712,693,680,621) BM.test(x,y,"less")
$contingencu.table
X Y X+Y
>MXY 2 6 8
<MXY 7 1 8
TOTAL 9 7 16

Brown Mood Median Test的更多相关文章

  1. No.004:Median of Two Sorted Arrays

    问题: There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the ...

  2. [LeetCode] Find Median from Data Stream 找出数据流的中位数

    Median is the middle value in an ordered integer list. If the size of the list is even, there is no ...

  3. [LeetCode] Median of Two Sorted Arrays 两个有序数组的中位数

    There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...

  4. Applying vector median filter on RGB image based on matlab

    前言: 最近想看看矢量中值滤波(Vector median filter, VMF)在GRB图像上的滤波效果,意外的是找了一大圈却发现网上没有现成的code,所以通过matab亲自实现了一个,需要学习 ...

  5. 【leetcode】Median of Two Sorted Arrays

    题目简述: There are two sorted arrays A and B of size m and n respectively. Find the median of the two s ...

  6. Codeforces Round #327 (Div. 2) B. Rebranding C. Median Smoothing

    B. Rebranding The name of one small but proud corporation consists of n lowercase English letters. T ...

  7. 【leedcode】 Median of Two Sorted Arrays

    https://leetcode.com/problems/median-of-two-sorted-arrays/ There are two sorted arrays nums1 and num ...

  8. Find Median from Data Stream

    常规方法 超时 class MedianFinder { vector<int> coll; public: MedianFinder(){ } void heapfu(vector< ...

  9. 数据结构与算法(1)支线任务8——Find Median from Data Stream

    题目如下:(https://leetcode.com/problems/find-median-from-data-stream/) Median is the middle value in an ...

随机推荐

  1. JavaScript教程大纲

    因为考虑到Python的接受难度,改为推广较为简单和流行的JavaScript.先列主要参考资料:         JavaScript权威指南(第6版):http://book.douban.com ...

  2. php中的抽象方法和抽象类,简单明了,一点通

    1.什么是抽象方法?    我们在类里面定义的没有方法提的方法就是抽象方法.所谓的没有方法体指的是,在声明的时候没有大括号以及其中的内容,而是直接在声明时在方法名后加上分号结束,另外在声明抽象方法时方 ...

  3. 常用域名记录解释:A记录、MX记录、CNAME记录、TXT记录、AAAA记录、NS记录

    A记录 A记录是用来创建到IP地址的记录. A记录设置技巧 1.如果想创建不带www的记录,即ezloo.com,在主机记录中填写@或者留空,不同的注册商可能不一样. 2.创建多个域名到同一个IP,比 ...

  4. grub rescue 主引导修复

    使用windows 和 ubuntu 双系统的人,很有可能碰到重装某一个系统,或者另外添加分区,导致系统重启出现 : GRUB loading error:unknow filesystem grub ...

  5. socket和webService的区别

    网络七层协议为:物理层.数据链路层.网络层.传输层.会话层.表示层.应用层 socket 只是 java在网络层定义的类,用来实现网络层.上面的各层需要我们自己在程序里实现. 例如端口可以自己定义 . ...

  6. div布局之面向对象

    栗子之导航条(navbar) http://www.runoob.com/try/try2.php?filename=bootstrap-using-glyphicons-navbar <!DO ...

  7. meta 元标签的常用用法

    < meta > 元素 概要 标签提供关于HTML文档的元数据.元数据不会显示在页面上,但是对于机器是可读的.它可用于浏览器(如何显示内容或重新加载页面),搜索引擎(关键词),或其他 we ...

  8. jquery遍历table为每一个单元格取值及赋值

    表格代码 <tr> <td> <input type="text" style="border: none; text-align: cen ...

  9. 解决Kali用户名密码正确但是无法登陆的问题

    本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=684 前言: 用户名和密码都正确,但是登陆Kali的时候总是提示用户名或密码错误,无法登陆,本文介绍一种解决办法. ...

  10. DAY2-MySQL专业安装

    MySQL安装 安装方法: 1.源码 2.二进制 (建议使用) 3.rpm (尽量不用) 一.下载MySQL: 一定要从官网下载,防止被勒索. 官网: http://dev/mysql.com 版本: ...