Applied Nonparametric Statistics-lec5
今天继续two-sample test
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6
- Mann-Whitney Test
前面说这个和Wilcoxon是identical的,只是统计量不同。现在我们来看一下它的统计量U。注意,现在检查的仍然是两个独立样本。
Treatment 1: x1, x2, ... , xm
Treatment 2: y1, y2, ... , yn
U = # of pairs of (Xi, Yj) for which Xi < Yj
H0 : the distributions are the same
H1 : the distributions are not the same
Table A4 contains lower tailed and upper tailed values for U under the null hypothesis. It can be shown that Uupper = mn - Ulower.
实际在R中的操作:
wilcox.test(new, trad, alternative="greater")
现在,我们来构造U的置信区间。好了,直接用R就好了啊:)
wilcox.test(ugrad, grad, conf.level=0.90, conf.int=T)
以上我们检查的都是两个样本的位置情况,下面要检查scale,也就是分布的形状,variability。
我们现在假设两个样本的均值相等,方差不同,现在想判断哪个方差更大。如果两个样本来自正态分布的总体,那么可以分别计算方差,然后

但是如果这两个不是来自正态分布的,就不可以了。此时,我们考虑非参数检验的方法。
- Siegel-Tukey Test (ST test):检查方差
- 把数据合在一起,从小到大排列。
- 最小的rank为1,最大的为2,次小的为3,次大的为4,蛇形排序。
- 做Wilcoxon rank-sum test. The smaller rank sums are associated with the treatment that has the largest variability.

如果把指定rank的方式改为:最小和最大为1,次小和次大为2,以此类推,这样就是Ansari-Bradley test。
R下,可以使用jmuOutlier包内的函数
siegel.test(x, y, alternative = c("two.sided", "less", "greater"), reverse = FALSE,all.perms = TRUE, num.sim = 20000)
Ansari-Bradley test:
ansari.test(x, y,
alternative = c("two.sided", "less", "greater"),
exact = NULL, conf.int = FALSE, conf.level = 0.95,
...)
事实上,检查方差一致性homogeneity of variance (homoscedasticity)还有其他方法,参考这篇文章:
http://www.cookbook-r.com/Statistical_analysis/Homogeneity_of_variance/
- Bartlett’s test:适合于数据是正态分布的;
- Levene’s test :在car包里,对于非正态分布的数据,比Bartlett's test更具健壮性;
- Fligner-Killeen test :非参数检验方法。
- Tests on Deviances
1. Obtain the deviances for the two treatments (devix and devjy) and compute RMD from the orginal data, denoted RMDobs.


2. Permute.样本数大的话,循环指定次数,否则循环所有。计算RMD。

- Kolmogorov-Smirnov Test
这个是检查general difference的,也就是说,会考虑location,scale,shape。如果两个样本分布的位置是否不同这一点未知,使用这个;如果已经
知道两个样本数据分布的位置是不同的,那么应该用wilcoxon。
- Calculate the observed test statistic, KSobs

^F1(W)是sample CDF
2. Find all the possible permutation of the data and calculate KS for each permutation.
3. The p-value is found by

R语言就简单了:
ks.test(a, b)
Applied Nonparametric Statistics-lec5的更多相关文章
- Applied Nonparametric Statistics-lec10
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/14 估计CDF The Empirical CDF ...
- Applied Nonparametric Statistics-lec9
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/12 前面我们考虑的情况是:response是连续的, ...
- Applied Nonparametric Statistics-lec8
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/11 additive model value = t ...
- Applied Nonparametric Statistics-lec7
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/9 经过前面的步骤,我们已经可以判断几个样本之间是否 ...
- Applied Nonparametric Statistics-lec6
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/8 前面都是对一两个样本的检查,现在考虑k个样本的情 ...
- Applied Nonparametric Statistics-lec4
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/5 Two sample test 直接使用R的t- ...
- Applied Nonparametric Statistics-lec3
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/4 使用非参数方法的优势: 1. 对总体分布做的假设 ...
- Applied Nonparametric Statistics-lec2
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/3 The Binomial Distributio ...
- Applied Nonparametric Statistics-lec1
参考网址: https://onlinecourses.science.psu.edu/stat464/node/2 Binomial Distribution Normal Distribution ...
随机推荐
- netty~引用对象引用
从InBound里读取的ByteBuf要手动释放,还有自己创建的ByteBuf要自己负责释放.这两处要调用这个release方法. write Bytebuf到OutBound时由netty负责释放, ...
- 050 Pow(x, n)
实现 pow(x, n).示例 1:输入: 2.00000, 10输出: 1024.00000示例 2:输入: 2.10000, 3输出: 9.26100详见:https://leetcode.com ...
- nginx超时问题
一. 戏说不管你是做运维还是做开发,哪怕你是游客,时不时会遇到502 Bad Gateway或504 Gateway Time-out.出现这页面,把服务重启下,再实在不行重启下服务器,问题就解决了, ...
- JS filter使用
filter 用于筛选数组中符合条件的所以元素,filter只能接受函数 注意:filter只返回筛选结果,不会对原来数组改变 实现方法: <html lang="en"&g ...
- P4868 天天和不可描述
http://www.tyvj.cn/p/4868 思路: 本想用站做的,但发现要用很多站同时做,还要来回倒. 我怕超时,所以换了种做法. 因为每遇到一次括号都要把输出方向改变,而括号是成对存在的,所 ...
- Linux的优缺点,Linux与windows的区别
Linux 一. 什么是linux? Linux是一套免费使用和自由传播的类Unix操作系统,是一个多用户.多任务.支持多线程和多CPU的操作系统.它能运行主要的UNIX工具软件.应用程序和网络协议. ...
- Redis集群批量操作
Redis在3.0版正式引入了集群这个特性,扩展变得非常简单.然而当你开心的升级到3.0后,却发现有些很好用的功能现在工作不了了, 比如我们今天要聊的pipeline功能等批量操作. Redis集群是 ...
- Kendo MVVM 数据绑定(十一) Value
Kendo MVVM 数据绑定(十一) Value Value 绑定可以把 ViewModel 的某个属性绑定到 DOM 元素或某个 UI 组件的 Value 属性.当用户修改 DOM 元素或 UI ...
- 像音乐播放App一样移动背景
如果你经常听歌,你会发现歌曲app的背景会随着音乐移动的,从左到右或者从上到下,这种动画虽然简单,但是这里有一个技巧.如果你还不明白这种动效看看下面的demo (更多详细请参考:https://git ...
- Android 自定义Android ORM 框架greenDAO数据库文件的路径
import android.content.Context; import android.content.ContextWrapper; import android.database.Datab ...