Skip to content

Add generalized Pareto fit to frequency curve tails - #1288

Draft
ValentinGebhart wants to merge 15 commits into
developfrom
features/return_period_fits
Draft

ValentinGebhart wants to merge 15 commits into
developfrom
features/return_period_fits

Conversation

@ValentinGebhart

@ValentinGebhart ValentinGebhart commented May 6, 2026 •

Copy link
Copy Markdown
Collaborator

Changes proposed in this PR:

  • add a function util.interpolate.fit_tail_GPD to fit a generalized Pareto distribution to frequency curve data.
  • call this function when using ImpactFreqCurve.interpolate() using the optional parameter method="fit_GPD"
  • add test
  • add tutorial draft to showcase functionality.

Comments:

  • After several tries, I decided not to include a GEV fit. GEV fit block maxima and it seems that a peak-over-threshold fit (i.e. fitting a generalized Pareto distribution) makes more sense here. In the plots, the GEV fit seemed reasonable (see plot in Add fit options to inter- and extrapolation of exceedance functions #1258), but when I wrote tests using data sampled from a GEV distribution the fit was completely wrong. When I changed the fit function such that the tests ran through, the fits with actual CLIMADA data were completely wrong. So for the moment, this is only GPD, if necessary in the future one could think about implementing GEV as well.
  • Note that I did not use the "standard" method scipy.stats.genpareto.fit() because I had to cumstomize the loss function to make the fit look reasonable given the data. I think this is because in CLIMADA we often have very imbalanced tail distributions with few data points for large return periods and many for smaller ones (e.g. in the first example the data return periods are [450, 225, 150, 112, 90, ...]), so it is necessary to use a cumstom loss function to put more weight of hight return periods.

This PR fixes #1258

PR Author Checklist

PR Reviewer Checklist

@ValentinGebhart ValentinGebhart changed the title Features/return period fits Add generalized Pareto fit to frequency curve tails May 6, 2026
@ValentinGebhart
ValentinGebhart marked this pull request as draft October 19, 2026 17:00
@ValentinGebhart

Copy link
Copy Markdown
Collaborator Author

@chahank: @spjuhel and I discussed that given the limited numerical stability of these fit options in typical CLIMADA applications, and no real user need for these methods but merely interest, we would rather move this to a CLIMADA snippet which we refer to in the tutorial. What do you think?

@chahank

chahank commented Oct 19, 2026

Copy link
Copy Markdown
Member

@chahank: @spjuhel and I discussed that given the limited numerical stability of these fit options in typical CLIMADA applications, and no real user need for these methods but merely interest, we would rather move this to a CLIMADA snippet which we refer to in the tutorial. What do you think?

Yes good for me 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants