Robert Kern <kern@ugcs.caltech.edu> wrote:
> 
> Kurt <kurt@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.

Or you could use RPy (see http://rpy.sf.net) - 30 minutes work on a Linux box to 
compile R as a shared library and install RPy, but worth the effort if you are doing 
any sort of statistical analysis and/or statistical graphics:

>>> from rpy import *
>>> print r.qf(0.95,2,9)
4.256495
>>> print r.pf(4.256495,2,9)
0.95

Tim C



