Simple scipy question F-distribution

Robert Kern kern at ugcs.caltech.edu
Mon Nov 3 21:03:40 EST 2003


Kurt <kurt at etool.com> wrote:
> Okay,
>
> This should be a really beginner question.  I'd like to calculate the
> cutoff value for the F-distribution given for example F(x)=0.95 and
> m=2, n=9 which should be about 4.26.  Is there an easy way to this in
> python with say scipy?

Yes. The following should work, but I think there's currently a bug in the F
distribution if the numbers you give are actually correct (I have not checked
independently).

from scipy.stats import distributions
x = distributions.f.ppf(0.95, 2, 9)

This currently gives the wrong result if your numbers are right.
distributions.f.ppf(0.05, 2, 9) does give something close to 4.26 .
The PPF is supposed to be the inverse of the CDF and f.cdf(4.26, 2, 9) does give
0.95 or thereabouts, I think this is actually a bug. I shall report it.

Also, SciPy questions are usually better addressed on the SciPy mailing list.
http://www.scipy.org/site_content/MailList

> Thanks!
> -kurt
> http://schwehr.org/

-- 
Robert Kern
kern at ugcs.caltech.edu

"In the fields of Hell where the grass grows high
 Are the graves of dreams allowed to die."
                     -- Richard Harter




More information about the Python-list mailing list