Bug 14145 - apparently incorrect p-values from 2-sided Kolmogorov-Smirnov test
Summary: apparently incorrect p-values from 2-sided Kolmogorov-Smirnov test
Alias: None
Product: R
Classification: Unclassified
Component: Analyses (show other bugs)
Version: old
Hardware: All All
: P5 normal
Assignee: Jitterbug compatibility account
Depends on:
Reported: 2009-12-15 23:00 UTC by Jitterbug compatibility account
Modified: 2009-12-15 23:00 UTC (History)
0 users

See Also:

(1.09 KB, text/plain)
2009-12-15 23:00 UTC, Jitterbug compatibility account

Note You need to log in before you can comment on or make changes to this bug.
Description Jitterbug compatibility account 2009-12-15 23:00:36 UTC
From: David John Allwright <allwrigh@maths.ox.ac.uk>
I am using R version 2.6.2 (2008-02-08) on a Ubuntu Linux system.
I seemed to be finding occasional errors in the p-values produced by 
ks.test(a,b) when a and b were vectors of 10 to 20 values.
So I tried to find simpler examples, and one that illustrates what I mean 
is included below and as the attached typescript file.
It is just


The value of the D_2,5 statistic is calculated as 0.4 correctly, but the 
p-value is stated by R as 1, though in fact it should be 20/21=0.9524
As I say this is just one example of quite a lot of errors of this kind 
that I am finding.
If you want more examples I can try to be more systematic about tracking 
them down.
Thank you,
David Allwright.
Dr DJ Allwright              E-mail    : allwrigh@maths.ox.ac.uk
OCIAM(Oxford Centre for Industrial and Applied Mathematics)
Mathematical Institute       Telephone : [+44](0)1865-280604
24-29 St.Giles'              FAX                     -270515
Oxford OX1 3LB, UK. 

Script started on Tue 15 Dec 2009 16:49:46 GMT
]0;swamp-thing: ~/smithinst/be2swamp-thing:be2% R

R version 2.6.2 (2008-02-08)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

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.

> x<-1:5
> y<-c(2.5,4.5)
> ks.test(x,y)

 	Two-sample Kolmogorov-Smirnov test

data:  x and y 
D = 0.4, p-value = 1
alternative hypothesis: two-sided

> q()
Save workspace image? [y/n/c]: n
]0;swamp-thing: ~/smithinst/be2swamp-thing:be2% exit 

Script done on Tue 15 Dec 2009 16:50:13 GMT

(Attached 'typescript' of type 'TEXT/PLAIN')

Comment 1 Jitterbug compatibility account 2009-12-15 23:00:36 UTC
Created attachment 946 [details]
Comment 2 Jitterbug compatibility account 2009-12-21 14:18:00 UTC
 fixed in 2.10.1 patched: see PR14151
Comment 3 Jitterbug compatibility account 2009-12-21 14:18:07 UTC
Audit (from Jitterbug):
Fri Dec 18 07:30:15 2009	ripley	changed notes
Fri Dec 18 07:30:15 2009	ripley	moved from incoming to Analyses-fixed
Mon Dec 21 08:18:07 2009	ripley	changed notes