Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape parameter negated in genextreme (relative to R, MATLAB, Wikipedia) (Trac #1325) #1851

Closed
scipy-gitbot opened this issue Apr 25, 2013 · 1 comment · Fixed by #3879
Closed
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.stats
Milestone

Comments

@scipy-gitbot
Copy link

Original ticket http://projects.scipy.org/scipy/ticket/1325 on 2010-11-05 by trac user hamishharvey, assigned to unknown.

The scipy implementation of genextreme appears to be defined in such a way that the shape parameter is the negated relative to its use in MATLAB and the R evd package. Compare the cumulative distribution function given in ticket 767:

F(x;c) = exp(-(1-c*x)**(1/c))

with that given in Wikipedia and recent slides[1] by Stuart Coles (author of the book referred to in that ticket):

F(x;c) = exp(-(1+c*x)**-(1/c))

The latter is consistent with the results from R. Scipy is differing from the most readily available documentation on GEV here, and while it may not be wrong it tripped me up and it has taken me a while to work out what is going on. A warning note in the documentation regarding the difference would be invaluable.

.. [1] [http://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0CBwQFjAA&url=http%3A%2F%2Fwww.cces.ethz.ch%2Fprojects%2Fhazri%2FEXTREMES%2Ftalks%2FcolesDavisonDavosJan08.pdf&rct=j&q=%22An%20Introduction%20to%20Statistical%20Modeling%20of%20Extreme%20Values%22%20coles%202000&ei=E0bUTM7vAqeR4gat0aidBA&usg=AFQjCNFaW81AT9W--MTyKsv7Aqpgel1KYw Statistical Modelling of Extreme Values (PDF)]

@scipy-gitbot
Copy link
Author

@josef-pkt wrote on 2010-11-06

The best is to check the extradoc attribute which contains the correct formula for the pdf. In general, it is always advisable to check the parameterization of the distributions because in many cases they differ from other packages and differ across books or articles.

I had looked at the parameterization for the genpareto before which has a similar problem that the sign can be defined either way. I had written a version with changed sign to match some articles, only to discover later, that both sign parameterizations are almost equally common in the literature.

Having different parameterizations directly available would be useful for estimation of parameters, see for example gamlss package for R, but that wouldn't be the case for just changes in sign.

Given that the parameterization is available in the extradoc, I think the most useful would be to add a warning about differences in parameterizations in the notes section of the generic docstring. If or when we add the docstring template to more individual distributions, we can add comments about the parameterization to the distribution-specific docstrings.

patvarilly pushed a commit to patvarilly/scipy that referenced this issue May 1, 2013
In line 323 of slsqp.py, float conversion leads to nan if Nones were initially
present in bounds. Checking for isfinite (instead of isinf) filters both inf
and nan.

Related to ticket scipy#1851.
ev-br added a commit to ev-br/scipy that referenced this issue Aug 16, 2014
@rgommers rgommers added this to the 0.15.0 milestone Aug 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.stats
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants