andy
andy

Reputation: 1459

scipy p-value returns 0.0

Using a 2 sample Kolmogorov Smirnov test, I am getting a p-value of 0.0.

>>>scipy.stats.ks_2samp(dataset1, dataset2)
(0.65296076312083573, 0.0)

Looking at the histograms of the 2 datasets, I am quite confident they represent two different datasets. But, really, p = 0.0? That doesn't seem to make sense. Shouldn't it be a very small but positive number?

I know the return value is of type numpy.float64. Does that have something to do with it?

EDIT: data here: https://www.dropbox.com/s/jpixhz0pcybyh1t/data4stack.csv

scipy.version.full_version
'0.13.2'

Upvotes: 14

Views: 18113

Answers (1)

alko
alko

Reputation: 48287

Yes, the probability is very small:

>>> from pprint import pprint
>>> pprint ([(i, scipy.stats.ks_2samp(dataset1, dataset2[:i])[1]) 
...                for i in range(200,len(dataset2),200)])
[(200, 3.1281733251275881e-63),
 (400, 3.5780609056448825e-157),
 (600, 9.2884803664366062e-225),
 (800, 7.1429666685167604e-293),
 (1000, 0.0),
 (1200, 0.0),
 (1400, 0.0),
 (1600, 0.0),
 (1800, 0.0),
 (2000, 0.0),
 (2200, 0.0),
 (2400, 0.0)]

Upvotes: 16

Related Questions