Menu

#37 Possible GEV CDF issue

1.0
closed
None
2017-03-30
2017-03-28
Anonymous
No

Dear author,

I found what could be a bug in jdistlib, related to the GEV distribution CDF function.

I am assuming here that jdistlib's function GEV.cumulative() is analogous to extRemes' pevd(type="GEV") function, which gives the GEV CDF.

At the source code of both libraries' most recent version, one can find:

extRemes 2.0-8, at distfuns.R:
if(shape==0 || type=="gumbel") p <- exp(-exp(-q)) else p <- exp(-pmax(1 + shape*q, 0)^(-1/shape))

jdistlib 0.4.5, at GEV.java:
q = (q - loc) / scale; q = shape == 0 ? exp(-exp(-q)) : pow(exp(max(1 + shape * q, 0)), -1.0/shape);

Please note the exp() invocation misplacement in jdistlib version for the shape!=0 case.
I believe the implementation when shape!=0 should instead be as follows:

exp(-pow(max(1 + shape * q, 0), -1.0/shape))

The resulting issue can be reproduced by executing the following command using jdistlib:

System.out.println(GEV.cumulative(20000, 20000, 20, -0.07, true));
Result in jdistlib 0.4.5: 1600320.1896405045

And comparing the result with the following commands in R:

library(extRemes);
pevd(type="GEV", q=20000, loc=20000, scale=20, shape=-0.07, lower.tail=TRUE);
Result in extRemes 2.0-8: 0.3678794

Best regards,

Luís Fernando Arcaro

Discussion

  • Roby Joehanes

    Roby Joehanes - 2017-03-30

    Thank you so much for the bug report, Luís. You are absolutely right. I have committed the fix to the main branch. Will release soon as 0.4.6.

     
  • Roby Joehanes

    Roby Joehanes - 2017-03-30
    • status: open --> closed
    • assigned_to: Roby Joehanes
     

Anonymous
Anonymous

Add attachments
Cancel