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. Django push: Using Server-Sent Events and WebSocket with Django

    http://curella.org/blog/2012/jul/17/django-push-using-server-sent-events-and-websocket/ The goal of ...

  2. C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource

    C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource 解决办法: 在c ...

  3. C 上传文件到服务器(含接收端源码)

    本文demo下载地址:http://www.wisdomdd.cn/Wisdom/resource/articleDetail.htm?resourceId=1067 实例向大家展示了如何用Visua ...

  4. java之SpringMVC配置!配置!配置!

    工欲善其事,必先利其器,要想使用SpringMVC自然要先把配置文件写好. 1.web.xml文件 新建web项目之后webRoot目录下面会有一个web.xml文件,我们先来对其进行配置. < ...

  5. Chatbot思考录

    人工分词产生不一致性的原因主要在于人们对词的颗粒度的认知问题.在汉语里,词是表达意最基本的意思,再小意思就变了.在机器翻译中会有一种颗粒度比另外一种颗粒度更好的情况,颗粒度大的翻译效果好. 为了解决词 ...

  6. NewLife.Net——网络压测单机1.88亿tps

    NewLife.Net压力测试,峰值4.2Gbps,50万pps,消息大小24字节,消息处理速度1.88亿tps! 共集合20台高配ECS参与测试,主服务器带宽6Gbps.100万pps,16核心64 ...

  7. PHP采用Cookie实现 购物车

    先来看一下逻辑分析图:

  8. 适合Python 新手的5大练手项目,你练了么?

    接下来就给大家介绍几种适合新手的练手项目. 0.算法系列-排序与查找 Python写swap很方便,就一句话(a, b = b, a),于是写基于比较的排序能短小精悍.刚上手一门新语言练算法最合适不过 ...

  9. PAT1097:Deduplication on a Linked List

    1097. Deduplication on a Linked List (25) 时间限制 300 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 ...

  10. Spring Cloud微服务系统下的数据一致性探讨

    我想这个问题需要根据自己的系统具体架构来分别讨论,这边拿一个车联网的系统举例. 拆除GPS这个功能接口需要分几个步骤实现(不涉及数据更新的步骤略去了): ①更改GPS设备状态(设备管理服务) ②更改工 ...