scipy and excel result are different in T distribution

Viewed 188

scipy and excel result are different in T distribution

The values from scipy and excel for 95% double tail t values are different. The conditions are degrees of freedom is 59,

in scipy

from scipy import stats
print (stats.t.ppf(1-0.025, 59)) 
2.00099537704821

in excel

TINV(0.025, 59)
2.3000469 

Those are supposed to be same but different. Which is right?

1 Answers

There is a two tail requirement for python from scipy import stats print (stats.t.ppf(1-0.025/2, 59)) answer: python3 tinv.py 2.3000468960888583 This compares with your excel result: =TINV(0.025, 59) 2.3000469 Excel defaults to a two tale test where as python defaults to a one tale test. That is why you divide the probability by 2.

Related