[Scipy-tickets] [SciPy] #1545: stats.tukeylambda.stats looks wrong

SciPy Trac scipy-tickets@scipy....
Sun Oct 30 16:57:50 CDT 2011


#1545: stats.tukeylambda.stats looks wrong
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  somebody   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  0.9.0      
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by warren.weckesser):

 Here's a quick implementation of the formula from
 http://en.wikipedia.org/wiki/Tukey_lambda_distribution (gamma is from
 scipy.special):
 {{{
 In [31]: def tlvar(lam):
    ....:     v = (2/(lam**2))*(1/(1+2*lam) -
 gamma(lam+1)**2/gamma(2*lam+2))
    ....:     return v
    ....:

 In [32]: tlvar(0.14)
 Out[32]: 2.1102970222144855

 In [33]: tlvar(3.1321477856738267)
 Out[33]: 0.02687245442325796
 }}}
 Here what is in scipy.stats.distributions.py:
 {{{
         mu2 = 2*gam(lam+1.5)-lam*pow(4,-lam)*sqrt(pi)*gam(lam)*(1-2*lam)
         mu2 /= lam*lam*(1+2*lam)*gam(1+1.5)
 }}}
 I don't know where that formula comes from, and it certainly doesn't
 appear to be correct.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1545#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list