[Scipy-tickets] [SciPy] #1097: stats.anderson wrong results for gumbel?

SciPy Trac scipy-tickets@scipy....
Thu Jan 21 23:21:50 CST 2010


#1097: stats.anderson wrong results for gumbel?
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:  0.8.0   
Component:  scipy.stats  |     Version:  0.7.0   
 Keywords:               |  
-------------------------+--------------------------------------------------

Old description:

> the results of stats.anderson for gumbel don't look correct
> Unless it is the wrong distribution, then the test should be accepted in
> this case
>
> {{{
> >>> rvs_g = stats.gumbel_l.rvs(size=1000)
> >>> stats.anderson(rvs_g,dist='gumbel')
> (294.7242586779887, array([ 0.471,  0.633,  0.752,  0.871,  1.031]),
> array([ 25. ,  10. ,   5. ,   2.5,   1. ]))
> }}}
>

> the other ones look ok
>
> {{{
> >>> rvs_l = stats.logistic.rvs(size=1000)
> >>> print stats.anderson(rvs_l,dist='logistic')
> (0.2534015725422023, array([ 0.426,  0.563,  0.66 ,  0.769,  0.906,  1.01
> ]), array([ 25. ,  10. ,   5. ,   2.5,   1. ,   0.5]))
>
> >>> rvs_e = stats.expon.rvs(size=1000)
> >>> stats.anderson(rvs_e,dist='expon')
> (0.36914960049273304, array([ 0.921,  1.077,  1.34 ,  1.605,  1.956]),
> array([ 15. ,  10. ,   5. ,   2.5,   1. ]))
> >>>
>
> >>> rvs_n = stats.norm.rvs(loc=2.0, scale=5, size=5000)
> >>> stats.anderson(rvs_n,dist='norm')
> (0.36402451624690002, array([ 0.576,  0.655,  0.786,  0.917,  1.091]),
> array([ 15. ,  10. ,   5. ,   2.5,   1. ]))
>
> }}}

New description:

 the results of stats.anderson for gumbel don't look correct
 Unless it is the wrong distribution, then the test should be accepted in
 this case

 {{{
 >>> rvs_g = stats.gumbel_l.rvs(size=1000)
 >>> stats.anderson(rvs_g,dist='gumbel')
 (294.7242586779887, array([ 0.471,  0.633,  0.752,  0.871,  1.031]),
 array([ 25. ,  10. ,   5. ,   2.5,   1. ]))
 }}}


 the other ones look ok

 {{{
 >>> rvs_l = stats.logistic.rvs(size=1000)
 >>> print stats.anderson(rvs_l,dist='logistic')
 (0.2534015725422023, array([ 0.426,  0.563,  0.66 ,  0.769,  0.906,  1.01
 ]), array([ 25. ,  10. ,   5. ,   2.5,   1. ,   0.5]))

 >>> rvs_e = stats.expon.rvs(size=1000)
 >>> stats.anderson(rvs_e,dist='expon')
 (0.36914960049273304, array([ 0.921,  1.077,  1.34 ,  1.605,  1.956]),
 array([ 15. ,  10. ,   5. ,   2.5,   1. ]))
 >>>

 >>> rvs_n = stats.norm.rvs(loc=2.0, scale=5, size=5000)
 >>> stats.anderson(rvs_n,dist='norm')
 (0.36402451624690002, array([ 0.576,  0.655,  0.786,  0.917,  1.091]),
 array([ 15. ,  10. ,   5. ,   2.5,   1. ]))

 }}}

--

Comment(by josefpktd):

 I don't understand the moment estimator for the standard deviation for
 gumbel, but replacing the moment estimator by the maximum likelihood
 estimator with fit, works well in the example

 {{{
 xbar, s = distributions.gumbel_l.fit(x)
 }}}

 {{{
 >>> anderson(np.random.randn(500),dist='gumbel')
 (5.5578954978178103, array([ 0.47 ,  0.631,  0.75 ,  0.869,  1.029]),
 array([ 25. ,  10. ,   5. ,   2.5,   1. ]), (0.5158023736320041,
 0.99211497217305677))


 >>> anderson(stats.gumbel_l.rvs(size=500),dist='gumbel')
 (0.55956587277995595, array([ 0.47 ,  0.631,  0.75 ,  0.869,  1.029]),
 array([ 25. ,  10. ,   5. ,   2.5,   1. ]), (0.017635128908579666,
 1.0070121042176601))
 >>>
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1097#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