Ouranosinc/xclim

Explore alternative fitting procedure for SPEI

Closed this issue · 2 comments

coxipi commented

Generic Issue

Currently, SPEI relies on an offset to shift the water budget to positive values for zero-bounded statistical distributions. The offset was currently hardcoded as in the monocongo/climate_indices library : 1mm/d.

This can be insufficient, as seen in #1474 where a greater shift was needed.

There was already some plan to let this offset parameter available to user as an argument in SPEI function #1311.

scipy has a parameter loc that could be used to remove the arbitrariness of the offset used. However, if a certain loc is computed, I'm not sure how things will go (there might be NaNs in the final output SPEI) for a dataset with smaller (negative) values of the water budget outside of the calibration period.

The R library has a SPEI function, as far as I can tell, there is not an offset parameter in this case. I will explore alternative ways to get SPEI values

Code of Conduct

  • I agree to follow this project's Code of Conduct

Just to confirm: loc is indeed used to generalize the support of the distribution from [0,∞] to [loc, ∞]

https://stackoverflow.com/questions/68948202/negative-observations-for-scipy-stats-gamma-fit

The paper introducing SPEI uses the three-parameter distribution of log-logistic (the two-parameter version only has support on positive values, where loc is the third parameter ). I think we should just go with this way of proceeding unless I find important issues (only one I can think of is: what happens when min(all data) < loc < min(calibration data) , I should check this.

closing, this has been dealt with in #1720