Discussion:
[SciPy-User] how does scipy.stats.t.isf work?
neurino
2010-06-16 16:13:36 UTC
Permalink
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.
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
j***@gmail.com
2010-06-16 16:40:14 UTC
Permalink
Post by neurino
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
TINV: inverse of the survival function of the Student t-distribution
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.
tinv(0,4;32) evaluates to 0,852998453651888.
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
Post by neurino
stats.t.isf(.4/2., 32)
0.85299845247181938

Josef
Post by neurino
_______________________________________________
SciPy-User mailing list
http://mail.scipy.org/mailman/listinfo/scipy-user
Warren Weckesser
2010-06-16 16:42:06 UTC
Permalink
Post by j***@gmail.com
Post by neurino
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
TINV: inverse of the survival function of the Student t-distribution
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.
tinv(0,4;32) evaluates to 0,852998453651888.
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
Post by neurino
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.
Post by j***@gmail.com
Post by neurino
t.isf(0.2, 32)
0.8529984524718196


Warren
Post by j***@gmail.com
Josef
Post by neurino
_______________________________________________
SciPy-User mailing list
http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________
SciPy-User mailing list
http://mail.scipy.org/mailman/listinfo/scipy-user
neurino
2010-06-16 16:53:17 UTC
Permalink
Thank you very much,

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

Thanks again for your support.

Greetings
Renzo
Post by neurino
Post by j***@gmail.com
Post by neurino
Honestly the full question is
"how does scipy.stats.t.isf work compared to common spreadsheets
function
Post by j***@gmail.com
Post by neurino
T.INV?"
I have to translate an excel calculation using TINV
TINV: inverse of the survival function of the Student t-distribution
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.
tinv(0,4;32) evaluates to 0,852998453651888.
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
Post by neurino
stats.t.isf(.4/2., 32)
0.85299845247181938
Yes.
http://support.microsoft.com/kb/828340
Note that TINV(p, df) is the inverse for TDIST(x, df, 2). That '2' means
"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.
Post by j***@gmail.com
Post by neurino
t.isf(0.2, 32)
0.8529984524718196
Warren
Post by j***@gmail.com
Josef
Post by neurino
_______________________________________________
SciPy-User mailing list
http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________
SciPy-User mailing list
http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________
SciPy-User mailing list
http://mail.scipy.org/mailman/listinfo/scipy-user
Loading...