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

SciPy Trac scipy-tickets@scipy....
Sun Oct 30 13:01: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:               |  
-------------------------+--------------------------------------------------
 The results of stats() for variance looks incorrect.

 I don't know why this wasn't caught by the tests. The test looks like like
 having a bug, check_sample_var doesn't use sv

 {{{
 chi2 = (n-1)*popvar/float(popvar)
 }}


 {{{
 >>> stats.tukeylambda.stats(0.14)
 (array(0.0), array(24.379664446968761))
 >>> rvstl = stats.tukeylambda.rvs(0.14, size=10000)
 >>> rvstl.var()
 2.1189856477953875
 >>> rvstl.mean()
 0.0071349518029833999
 }}}

 with lambda from the tests
 {{{
 >>> rvstl = stats.tukeylambda.rvs(3.1321477856738267, size=10000)
 >>> rvstl.var()
 0.026861570524679308
 >>> rvstl.mean()
 -0.00042148338748570043
 >>> stats.tukeylambda.stats(3.1321477856738267)
 (array(0.0), array(0.30476472279111871))
 }}}

 compare to integration


 {{{
 >>> stats.tukeylambda._mom0_sc(2, 3.1321477856738267)
 0.026872452542708088
 >>> stats.tukeylambda._mom0_sc(2, 0.14)
 2.1102970222056117
 }}}

 checking pdf as approximation to normal, looks good using sample std
 instead of the results in stats.

 {{{
 >>> stats.norm.pdf(np.linspace(-2,2,11), scale=1.45)
 array([ 0.1062723 ,  0.14967318,  0.19535213,  0.23628848,  0.26486049,
         0.27513261,  0.26486049,  0.23628848,  0.19535213,  0.14967318,
         0.1062723 ])
 >>> stats.tukeylambda.pdf(np.linspace(-2,2,11), 0.14)
 array([ 0.1059094 ,  0.14891156,  0.19459617,  0.23592703,  0.26498728,
         0.27547628,  0.26498728,  0.23592703,  0.19459617,  0.14891156,
         0.1059094 ])
 }}}

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


More information about the Scipy-tickets mailing list