georgebv / pyextremes

Extreme Value Analysis (EVA) in Python
https://georgebv.github.io/pyextremes/
MIT License
239 stars 47 forks source link

Extracting confidence intervals on fit parameters 'c', 'loc', and 'scale' #64

Closed arfogg closed 1 year ago

arfogg commented 1 year ago

Hi,

Thanks for creating this super helpful python package, it's really easy to use and the documentation are really helpful. I use this package for space science research.

I'm interested in returning the confidence intervals or some other measure of error on the fit parameters 'c', 'loc', and 'scale'.

Currently I access the fit parameters by doing: EVA.model.fit_parameters . Having confidence intervals (or any other measure of error) on these parameters would be a great addition to the package. Apologies if this feature has already been implemented - if it has please could you guide me on how to extract the confidence intervals / errors?

Thanks, Alexandra Fogg

georgebv commented 1 year ago

There are no confidence intervals available right away for the parameters, but you can calculate those yourself from the data.

For the Emcee model you can use the _trace attribute of shape number of free parameters x number of samples.

For the MLE model you can use the fit_parameter_cache attribute which is a list of samples of free parameters. Before it's available, however, you would need to call get_return_value with alpha argument and n_samples set to number you need (100 by default).