-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!--Please ensure the PR fulfills the following requirements! --> <!-- If this is your first PR, make sure to add your details to the AUTHORS.rst! --> ### Pull Request Checklist: - [x] This PR addresses an already opened issue (for bug fixes / features) - This PR fixes #xyz - [x] Tests for the changes have been added (for bug fixes / features) - [ ] (If applicable) Documentation has been added / updated (for bug fixes / features) - [x] CHANGES.rst has been updated (with summary of main changes) - [x] Link to issue (:issue:`number`) and pull request (:pull:`number`) has been added ### What kind of change does this PR introduce? * Spei used to rely on an offset to ensure that distribution of values are positive when using distributions such as `gamma, fisk`. Now, instead, we properly use the `loc` parameter in those distributions that generalize the distributions and allow negative values. For instance, the `gamma` disitribution is a 2-parameter function, but in ``scipy`` it's generalized to 3 parameters, with a `loc` parameter. This extends the support of `gamma` from $x \in [0,\infty]$ to $x \in [\text{loc}, \infty]$. The code was already compatible with this idea, just had to change ``_fit_start`` so it can compute estimates of the parameters in the cases with negatives values. ### Does this PR introduce a breaking change? * Removing the offset from SPEI. Also, the `_fit_start` can now compute an estimate of `loc` which can affect what value we obtain when optimizing 3-parameters distributions. Even when the `loc` is fixed to 0 with `floc=0` in `fitkwargs`, the estimate of `fisk` was modified. The previous formulation was obtained by applying more or less the idea in the method of moments, but now I obtained an approximation that's more rigorous. * The case of zero inflated distribution has been changed: Now, it is the calibration data that determines the probability of zero, as it should. * Method `APP` can now only be used if `fitkwargs['floc']` is given as input by the user. ### Other information:
- Loading branch information
Showing
9 changed files
with
427 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.