Brown Mood Median Test
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的定义,防止出现多余计算。
\]
大样本计算时,趋于正态分布:
binom 分布的 $$E[X] = μ = t\cdot\frac{m}{m+n}$$
\]
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的更多相关文章
- 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 ...
- [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 ...
- [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 ...
- Applying vector median filter on RGB image based on matlab
前言: 最近想看看矢量中值滤波(Vector median filter, VMF)在GRB图像上的滤波效果,意外的是找了一大圈却发现网上没有现成的code,所以通过matab亲自实现了一个,需要学习 ...
- 【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 ...
- 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 ...
- 【leedcode】 Median of Two Sorted Arrays
https://leetcode.com/problems/median-of-two-sorted-arrays/ There are two sorted arrays nums1 and num ...
- Find Median from Data Stream
常规方法 超时 class MedianFinder { vector<int> coll; public: MedianFinder(){ } void heapfu(vector< ...
- 数据结构与算法(1)支线任务8——Find Median from Data Stream
题目如下:(https://leetcode.com/problems/find-median-from-data-stream/) Median is the middle value in an ...
随机推荐
- Ionic Framework - Getting 'ionic start [appName]' Working Behind a Proxy
This is a quick hacky way to get the ionic start [appName] command working from behind a proxy. I ra ...
- Visual Studio 2017 15.7 下的.NET Core
Visual Studio 2017 15.7版本发布,对.NET Core项目的主要相关改变如下, 同时对Xamarin.Android和iOS项目的支持上也做了较大改进. 一. .NET Core ...
- JeeSite数据分页与翻页
本文章介绍的是JeeSite开源项目二次开发时的一些笔记,对于没有使用过JeeSite的可以不用往下看了,因为下面的代码是跟JeeSite二次开发相关的代码,不做JeeSite的二次开发,以下代码对您 ...
- Lintcode399 Nuts & Bolts Problem solution 题解
[题目描述] Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one m ...
- 《Complete Guide to Value Investing》读书总结
大好的周末,决定写一篇读书笔记.:) 最近读了一些股票估值以及价值投资相关的文章和书籍.今天将其中的一本做一些笔记以及简单的总结. 该书名为<Complete Guide to Value In ...
- NSURLSession 所有的都在这里(二)
前面一篇我们说了什么? 这是这个关于NSURLSession的第二篇文章,第一篇再加上这篇文章,就大概的把NSURLSession的API以及一些简单使用我们也就说的差不多了,这篇文章总结哪些点呢?相 ...
- ML.NET指南
ML.NET是一个免费的.开源和跨平台的机器学习框架,使您能够构建定制的机器学习解决方案,并将它们集成到您的. net应用程序.本指南提供了许多关于与ML.NET合作资源. 关于ML.NET的更多信息 ...
- 利用webmagic获取天猫评论
引言 爬取商品信息 爬取商品评论 数据清洗 1. 引言 现代网页往往其HTML只有基本结构,而数据是通过AJAX或其他方法获取后填充,这样的模式对爬虫有一定阻碍,但是熟练以后获取并不困难,本文以爬取天 ...
- 5月11日——IOS下如何检测用户是否安装微信
执行如下代码: var WXApi = plus.ios.import("WXApi"); var isWXInstalled = WXApi.isWXAppInsta ...
- Git的一些操作
前言 记录一些经常需要用到的命令. 私钥.公钥的生成(默认在C盘用户文件下生成) ssh-keygen -t rsa //rsa加密 拉取远程分支并与本地分支合并 git pull [url] 上述效 ...