[Scipy-tickets] [SciPy] #767: Add the limiting gumbel distribution to genextreme distribution when shape c=0
SciPy
scipy-tickets@scipy....
Mon Nov 17 12:04:54 CST 2008
#767: Add the limiting gumbel distribution to genextreme distribution when shape
c=0
-------------------------+--------------------------------------------------
Reporter: pbrod | Owner: josefpktd
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: scipy.stats | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Changes (by josefpktd):
* owner: somebody => josefpktd
Comment:
_rvs requires that _ppf accepts a vector of q, so I made the following
change to genextreme.2.py:
{{{
def _ppf(self, q, c):
#return 1.0/c*(1.-(-log(q))**c)
logq = log(q);
x = -log(-logq)
# _rvs requires that _ppf allows vectorized q
return where((q==q)*(c==0),x,-np.expm1(-c*x)/c)
}}}
All my tests pass for
{{{
['genextreme', (3.3184017469423535,)],
['genextreme', (0.01,)],
['genextreme', (0.00001,)]
}}}
except for nans for entropy for 0<c<0.01, which also did not work with the
old version. Before the change, I think entropy returned nans for at least
all c<1
I haven't looked at the calculation in detail, but since the tests pass
and the
precision for small c has increased, I will commit this as a replacement
for the previous genextreme.
One caveat to my tests: they only test for internal consistency, since
_rvs is also internal to this distribution class, I don't have any outside
verification for the correctness of the numbers.
--
Ticket URL: <http://scipy.org/scipy/scipy/ticket/767#comment:5>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list