[RsR] About the inconsistency p-value of two sample Kolmogorov–Smirnov test in R and Matlab

Zhou, Xionghui X|onghu|@Zhou @end|ng |rom cchmc@org
Tue Nov 19 22:35:46 CET 2019


Dear Phillip,
Thanks for your reply. If I use two-sample KS test in R to test whether one vector is significantly smaller than another vector, I use the command below as a demo:  p = ks.test((1:10), (20:200), alternative = "greater"). The p is 5.873e-09. However, If I use Matlab to do the same case: [~,p]=kstest2((1:10)',(20:200)','tail','larger'). P-value is 8.2222e-10. The differences are also present in other method, such as Wilcoxon rank sum test and Poission test. Thanks!

Regards,


Xionghui 

On 11/18/19, 11:26 AM, "Phillip Alday" <phillip.alday using mpi.nl> wrote:

    Dear Xionghui,
    
    Cross-posting to two lists simultaneously generally isn't desirable.
    
    Can you provide a minimum working example (code+data) for this? 
    Otherwise, it's hard to see what's going on.
    
    Best,
    Phillip
    
    
    
    On 11/11/19 9:50 pm, Zhou, Xionghui wrote:
    > Hi guys,
    > 
    > 
    > Recently, when I try to repeat my method using R, which was implemented in Matlab before, I found that the p-values for the two-sample ks-test in the two languages are different, even with the same data and parameters (The p-value in R is greater than the one in Matlab). In the meanwhile, the p-values of two-sample ks-test are the same in Matlab and python. In addition, I also test the p-value in Mann-Whitney-Wilcoxon test and Poission test, the p-values for the tests in R and Matlab are also different. Of course, the difference in two-sample ks-test is the most significant. May anyone tell me the reason for that and which language is more reliable? Thanks in advance!
    > 
    > 
    > Best,
    > 
    > 
    > 
    > Xionghui
    > 
    > 
    > Xionghui Zhou Ph.D.
    > Research Fellow
    > Division of Human Genetics
    > Cincinnati Children�s Hospital Medical Center
    > 
    > Phone: +1 (513) 636-4200
    > Email: Xionghui.Zhou using cchmc.org<mailto:Yaping.Liu using cchmc.org>
    > Office: R1.1026
    > 3333 Burnet Ave
    > Cincinnati, OH 45229
    > 
    > 
    > 	[[alternative HTML version deleted]]
    > 
    > 
    > _______________________________________________
    > R-SIG-Robust using r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-sig-robust
    > 
    



More information about the R-SIG-Robust mailing list