# [SciPy-User] how does scipy.stats.t.isf work?

neurino neurino@gmail....
Wed Jun 16 11:53:17 CDT 2010

```Thank you very much,

now I can get my function to work as expected, I'm afraid not founding
myself these notes online.

Greetings
Renzo

2010/6/16 Warren Weckesser <warren.weckesser@enthought.com>

> josef.pktd@gmail.com wrote:
> > On Wed, Jun 16, 2010 at 12:13 PM, neurino <neurino@gmail.com> wrote:
> >
> >> Honestly the full question is
> >> "how does scipy.stats.t.isf work compared to common spreadsheets
> function
> >> T.INV?"
> >> I have to translate an excel calculation using TINV
> >> In all excel, ooo or abiword I get:
> >>
> >> TINV: inverse of the survival function of the Student t-distribution
> >> Arguments:
> >> p: probability
> >> dof: number of degrees of freedom
> >> The survival function is 1 minus the cumulative distribution function.
> >> Note: If p < 0 or p > 1 or dof < 1 this function returns a #NUM! error.
> >> Microsoft Excel: This function is Excel compatible.
> >> Examples:
> >> tinv(0,4;32) evaluates to 0,852998453651888.
> >>
> >> while with scipy I get:
> >>
> >>>>> from scipy.stats import t
> >>>>>  t.isf(.4, 32)
> >>>>>
> >> 0.25546356665122449
> >> Any advice welcome, please consider I'm an informatic but not a
> >> mathematician.
> >> Thanks for your support
> >>
> >
> > I guess Excel uses a two-sided tail probability
> >
> >
> >>>> stats.t.isf(.4/2., 32)
> >>>>
> > 0.85299845247181938
> >
> >
>
> Yes.
>
> Check out the documentation for TINV here:
>
> http://support.microsoft.com/kb/828340
>
> Note that TINV(p, df) is the inverse for TDIST(x, df, 2). That '2' means
> TDIST is two-sided. To quote from the above link:
>
> "For any particular positive value of x, TDIST(x, df, 2) returns the
> probability that a t-distributed random variable with df degrees of
> freedom is greater than or equal to x or is less than or equal to –x."
>
> So you will need to divide the probability by 2 to compare t.isf to TINV.
> For example, this matches TINV(0.4; 32):
>
>  >>> t.isf(0.2, 32)
> 0.8529984524718196
>
>
> Warren
>
> > Josef
> >
> >
> >
> >> _______________________________________________
> >> SciPy-User mailing list
> >> SciPy-User@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/scipy-user
> >>
> >>
> >>
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> >
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100616/3bb5ecc6/attachment.html
```