[SciPy-dev] Numerical Recipes (was tagging 0.7rc1 this weekend?)
josef.pktd@gmai...
josef.pktd@gmai...
Thu Dec 4 09:29:52 CST 2008
>>
> Hi,
> Could you also please replace the use of 'betai' with the appropriate
> call to the t-distribution to the the probabilities?
> Numerical Recipes uses betai and also it is more understandable to use
> the actual t-distribution.
>
> Bruce
>
betai is used in several places in scipy.stats, until now I never
touched scipy.special calls unless there was a real bug.
There is some duplication in scipy.special, but I have no idea about
the relative advantages and disadvantages of the different
implementations. For some functions, I know that they don't work
correctly over some parameter range. So, until now I'm reluctant to
change any of the calls to special.
Usually I don't change anything without having some tests first, and
neither ttest_ind nor ttest_rand have any tests in the test suite and
I'm running out of time to write tests before 0.70.
but this replacement looks simple enough:
>>> df=5;t=0.5;stats.betai(0.5*df,0.5,float(df)/(df+t*t));stats.t.sf(t,df)*2
0.6382988716409288
0.63829887164092902
>>> df=500;t=0.5;stats.betai(0.5*df,0.5,float(df)/(df+t*t));stats.t.sf(t,df)*2
0.61729505009465102
0.61729505009466568
>>> df=5000;t=0.5;stats.betai(0.5*df,0.5,float(df)/(df+t*t));stats.t.sf(t,df)*2
0.61709708085302761
0.61709708085403392
>>> df=50000;t=0.5;stats.betai(0.5*df,0.5,float(df)/(df+t*t));stats.t.sf(t,df)*2
0.61707727784367095
0.61707727785345856
>>> df=2;t=0.5;stats.betai(0.5*df,0.5,float(df)/(df+t*t));stats.t.sf(t,df)*2
0.66666666666666596
0.66666666666666652
I will make the change tonight.
Josef
More information about the Scipy-dev
mailing list