Bug 14671 - ks.test reports negative p.values
ks.test reports negative p.values
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Accuracy
R-devel (trunk)
Other Mac OS X v10.6
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-09 17:17 UTC by Tim Reddy
Modified: 2011-09-22 18:04 UTC (History)
0 users

See Also:


Attachments
dataset and R code to reproduce (10.00 KB, application/x-tar)
2011-09-09 17:17 UTC, Tim Reddy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Reddy 2011-09-09 17:17:10 UTC
Created attachment 1227 [details]
dataset  and R code to reproduce

Taking in these two lists of specific numbers, ks.test reports a negative p.value.  See session transcript below


treddy$ cat bug.R | R --vanilla 

R Under development (unstable) (2011-07-29 r56550)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin10.8.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ks.test(read.table("a.txt")$V1,read.table("b.txt")$V1)$p.value
[1] -4.440892e-16
> 


Found this problem on Intel Mac OS X running R Under development (unstable) (2011-07-29 r56550)

and also on 64bit linux running R version 2.11.0 (2010-04-22)

Data:

a.txt:
0.0524
0.0585
0.0669
0.0711
0.0596
0.0485
0.0744
0.0255
0.0467
0.0366
0.035
0.0481
0.05
0.0587
0.1013
0.0798
0.0537
0.0322
0
0.0426
0.0505
0.0547
0.0811
0.1016
0.0795
0.1595
0.0947
0.0496
0.1344
0.0874
0.1173
0.1068
0.1128
0.1149
0.11
0.0906
0.1388
0.1209
0.1039
0.1008
0.0984
0.1176
0.1051
0.163
0.08
0.0756
0.0748
0.069
0.061
0.2013
0.1231
0.0564
0.1334
0.0664
0.0577
0.0311
0.0424
0.1932
0.1122
0.1216
0.2027
0.0857
0.0741


b.txt:
0.555
0.0471
0.2189
0.1973
0.1406
0.4414
0.3407
0.3412
0.4056
0.5099
0.4225
0.0785
0.2848
0.5348
0.298
0.4349
0.1918
0.1394
0.3133
0.1738
0.2883
0.2557
0.4091
0.3039
0.4251
0.138
0.1238
0.1473
NA
0.1369
0.2529
0.434
0.2113
0.0652
0.1103
0.2066
0.074
0.3948
0.2031
0.3291
0.2351
0.5335
0.4341
0.2089
0.3937
0.2898
0.1601
0.0553
0.4362
0.1459
0.1592
0.3852
0.4928
0.1203
0.4509
0.3156
0.0833
0.0607
0.0428
0.3325
0.6624
0.1729
0.3531
0.2799
0.1098
0.2161
0.2475
0.2887
0.2166
0.4735
0.2675
0.5499
0.3552
Comment 1 Brian Ripley 2011-09-22 18:04:42 UTC
Fixed in 2.13.2