今天继续two-sample test

Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6


  • Mann-Whitney Test

前面说这个和Wilcoxon是identical的,只是统计量不同。现在我们来看一下它的统计量U。注意,现在检查的仍然是两个独立样本。

Treatment 1:  x1x2, ... , xm
Treatment 2:  y1y2, ... , yn

U = # of pairs of (XiYj)  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):检查方差
  1. 把数据合在一起,从小到大排列。
  2. 最小的rank为1,最大的为2,次小的为3,次大的为4,蛇形排序。
  3. 做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/

  1. Bartlett’s test:适合于数据是正态分布的;
  2. Levene’s test :在car包里,对于非正态分布的数据,比Bartlett's test更具健壮性;
  3. 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。

  1. 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的更多相关文章

  1. Applied Nonparametric Statistics-lec10

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/14 估计CDF The Empirical CDF ...

  2. Applied Nonparametric Statistics-lec9

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/12 前面我们考虑的情况是:response是连续的, ...

  3. Applied Nonparametric Statistics-lec8

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/11 additive model value = t ...

  4. Applied Nonparametric Statistics-lec7

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/9 经过前面的步骤,我们已经可以判断几个样本之间是否 ...

  5. Applied Nonparametric Statistics-lec6

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/8 前面都是对一两个样本的检查,现在考虑k个样本的情 ...

  6. Applied Nonparametric Statistics-lec4

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/5 Two sample test 直接使用R的t- ...

  7. Applied Nonparametric Statistics-lec3

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/4 使用非参数方法的优势: 1. 对总体分布做的假设 ...

  8. Applied Nonparametric Statistics-lec2

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/3 The Binomial Distributio ...

  9. Applied Nonparametric Statistics-lec1

    参考网址: https://onlinecourses.science.psu.edu/stat464/node/2 Binomial Distribution Normal Distribution ...

随机推荐

  1. 转 dos 下的 find 和 重定向 and 删除

    1.find /i "ora-" *.* > check.log del /Q .\log\*.* 附录: 我对findstr是如此的依赖,以至于当我向各位讲解find命令的 ...

  2. Win10 插入耳机后没有声音,拔出后电脑有声音

  3. 2017 ACM Arabella Collegiate Programming Contest div2的题,部分题目写个题解

    F. Monkeying Around   维护点在多少个线段上 http://codeforces.com/gym/101350/problem/F 题意:有m个笑话,每个笑话的区间是[L, R], ...

  4. P2737 [USACO4.1]麦香牛块Beef McNuggets 数学题 + 放缩思想

    https://www.luogu.org/problem/show?pid=2737#sub 先说一个结论:对于两个数p, q,且gcd(p, q) = 1(这个很重要,是条件来的).他们不能组合成 ...

  5. npoi导出excel合并单元格

    需要引用NPOI.dll程序集和Ionic.Zip.dll程序集 string[] headerRowName = { "序号", "地市", "镇街 ...

  6. 9、数值的整数次方------------>剑指offer系列

    数值的整数次方 给定一个double类型的浮点数base和int类型的整数exponent.求base的exponent次方. 思路 这道题逻辑上很简单,但很容易出错 关键是要考虑全面,考虑到所有情况 ...

  7. 洛谷 P1137 旅行计划

    旅行计划 待证明这样dp的正确性. #include <iostream> #include <cstdio> #include <cstring> #includ ...

  8. ESP8266串口WiFi扩展板详解

    产品简介 ESP8266串口WiFi扩展板是深圳四博智联科技有限公司开发的一款基于乐鑫ESP8266的超低功耗的UART-WiFi模块,兼容Arduino UNO.Mega等标准主板,可以方便地进行二 ...

  9. Python+selenium之unittest单元测试(3)关于测试用例执行的顺序

    一.测试用例执行的顺序 用例的执行顺序涉及多个层级,在多个测试目录的情况下,先执行哪个目录?在多个测试文件的情况下,先执行哪个文件?在多个测试类的情况下,先执行哪个测试类?,在多个测试方法(用例)的情 ...

  10. javaSe-线程2

    package com.java.chap09.sec02; public class Thread3 implements Runnable{ private int baoZi=1; privat ...