[Numpy-discussion] Bug in the F distribution?

Alan Jackson alan at ajackson.org
Fri Jul 3 22:21:42 EDT 2009


I've tried the same scheme using R and it seems to give the right
answers

> quantile( rf(10000000,10,10), .99)
    99% 
4.84548 
> quantile( rf(10000000,11,10), .99)
     99% 
4.770002 
> quantile( rf(10000000,11,11), .99)
     99% 
4.465655 
> quantile( rf(10000000,10,11), .99)
     99% 
4.539423 


>> I either found a bug in the F distribution, or I'm really messed up.
>> 
>> From a table I find  
>> 
>> dfnum  dfden  F(P<.01)
>> 10      10     4.85
>> 11      10     4.78
>> 11      11     4.46
>> 10      11     4.54
>> 
>> So let's calculate the same quantities using numpy...
>> 
>> import scipy.stats as stats
>> import numpy as np
>> In [89]: stats.scoreatpercentile(np.random.f(10,10,1000000), 99)
>> Out[89]: 4.8575912131878365
>> In [90]: stats.scoreatpercentile(np.random.f(11,10,1000000), 99)
>> Out[90]: 5.2721528315236501
>> In [91]: stats.scoreatpercentile(np.random.f(11,11,1000000), 99)
>> Out[91]: 4.4695161332631841
>> In [92]: stats.scoreatpercentile(np.random.f(10,11,1000000), 99)
>> Out[92]: 4.1229323443042674
>> 
>> 
>> So at 10,10 and 11,11 it works (maybe), but all the other values are clearly
>> off. I tried re-running the example I put into the documentation last summer,
>> which worked, and I don't get the right answer any longer. 


-- 
-----------------------------------------------------------------------
| Alan K. Jackson            | To see a World in a Grain of Sand      |
| alan at ajackson.org          | And a Heaven in a Wild Flower,         |
| www.ajackson.org           | Hold Infinity in the palm of your hand |
| Houston, Texas             | And Eternity in an hour. - Blake       |
-----------------------------------------------------------------------



More information about the NumPy-Discussion mailing list