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\)的关系。

>\(M_{xy}\)ABt
<\(M_{xy}\)CD(m+n)-(A+B)
\(\sum\)mnm=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(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
05-08 08:09