[Scipy-tickets] [SciPy] #767: Add the limiting gumbel distribution to genextreme distribution when shape c=0

SciPy scipy-tickets@scipy....
Fri Oct 31 12:19:27 CDT 2008


#767: Add the limiting gumbel distribution to genextreme distribution when shape
c=0
-------------------------+--------------------------------------------------
 Reporter:  pbrod        |        Owner:  somebody
     Type:  enhancement  |       Status:  new     
 Priority:  normal       |    Milestone:          
Component:  scipy.stats  |      Version:          
 Severity:  normal       |   Resolution:          
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by josefpktd):

 Yes, I realized this, I was trying to add a comment soon after, but my
 comment got blocked because of simultaneous editing.

 I looked at the limiting behavior and I think that the switch to gumbel
 should be done at around c=1e-8 for the cdf and pdf, since for smaller c
 the approximation seems to get worse. My initial thought was to use c=1e-8
 for all smaller values including 0.

 Below is my previous, blocked comment:

 Sorry, I think I misunderstood the issue if it means including the gumbel
 as the distribution conditional on c==0 inside of genextreme_gen, which I
 think it does after rereading it.

 The limiting behavior, when eg. restricting to c>=1e-8 seems for practical
 purposes quite good, deviation in the range of 1e-9 in cdf. For c<1e-8 the
 approximation actually gets worse with useless numbers for c<1e-20.

 So, it seems like setting c=1e-8 (or something in this range) for any
 c<1e-8 seems to give the more accurate answer and would also include an
 approximation for c=0. I didn't test this for a huge range of parameters
 and for other methods.

 {{{
 >>>
 stats.gumbel_r.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10])-stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-5)
 array([ -6.56687888e-67,  -9.13302872e-08,  -8.96867092e-07,
         -3.96300203e-07,  -1.57494786e-07,   0.00000000e+00,
         -1.27323722e-06,  -2.36411035e-06,  -2.26947734e-08])
 >>>
 stats.gumbel_r.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10])-stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-8)
 array([ -6.93280630e-70,  -4.54366995e-11,  -1.98701114e-09,
         -1.35970896e-09,   7.58649976e-10,   0.00000000e+00,
         -2.55276866e-09,  -2.23966334e-09,  -2.24600338e-11])
 >>>
 stats.gumbel_r.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10])-stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-15)
 array([  3.50738901e-65,  -7.33683479e-06,   1.79150655e-02,
         -1.80360349e-02,  -2.76215516e-02,   0.00000000e+00,
          2.03584625e-04,   1.89087835e-04,   3.64309018e-07])
 >>>
 stats.gumbel_r.pdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10])-stats.genextreme.pdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-8)
 array([ -1.01938405e-67,  -1.98971988e-10,  -1.62050429e-09,
          7.03137437e-10,   1.31538191e-09,   0.00000000e+00,
         -9.32806221e-10,  -4.27541183e-10,   1.79191712e-11])

 convergence of cdf:
 -------------------

 >>> stats.gumbel_r.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10])
 array([  3.50738920e-65,   6.17978989e-04,   6.59880358e-02,
          1.92295646e-01,   2.59276866e-01,   3.67879441e-01,
          6.92200628e-01,   8.73423018e-01,   9.99954601e-01])
 >>> stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-5)
 array([  3.57305799e-65,   6.18070320e-04,   6.59889327e-02,
          1.92296042e-01,   2.59277023e-01,   3.67879441e-01,
          6.92201901e-01,   8.73425383e-01,   9.99954624e-01])
 >>> stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-10)
 array([  3.50717450e-65,   6.17978235e-04,   6.59880210e-02,
          1.92295632e-01,   2.59276857e-01,   3.67879441e-01,
          6.92200649e-01,   8.73423038e-01,   9.99954601e-01])
 >>> stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-15)
 array([  1.83630951e-72,   6.25315824e-04,   4.80729704e-02,
          2.10331680e-01,   2.86898418e-01,   3.67879441e-01,
          6.91997043e-01,   8.73233931e-01,   9.99954237e-01])

 >>> stats.genextreme.cdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-20)
 array([ 0.36787944,  0.36787944,  0.36787944,  0.36787944,  0.36787944,
         0.36787944,  0.36787944,  0.36787944,  0.36787944])

 convergence of pdf:
 -------------------

 >>> stats.gumbel_r.pdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10])
 array([  5.20542711e-63,   4.56628142e-03,   1.79374079e-01,
          3.17041921e-01,   3.49987161e-01,   3.67879441e-01,
          2.54646380e-01,   1.18204952e-01,   4.53978687e-05])
 >>> stats.genextreme.pdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-15)
 array([  3.03318610e-70,   4.61311349e-03,   1.45903158e-01,
          3.27921721e-01,   3.58229131e-01,   3.67879441e-01,
          2.54775040e-01,   1.18368429e-01,   4.57621611e-05])
 >>> stats.genextreme.pdf([-5.0,-2.0,-1.0,-0.5,-0.3,0,1,2,10],1e-20)
 array([ 0.36787944,  0.36787944,  0.36787944,  0.36787944,  0.36787944,
         0.36787944,  0.36787944,  0.36787944,  0.36787944])
 }}}

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


More information about the Scipy-tickets mailing list