Ouranosinc / xclim

Library of derived climate variables, ie climate indicators, based on xarray.
https://xclim.readthedocs.io/en/stable/
Apache License 2.0
326 stars 58 forks source link

Confidence intervals on statistical functions #997

Open huard opened 2 years ago

huard commented 2 years ago

Description

Return confidence intervals (as does R) for statistical estimates.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_continuous.interval.html

aulemahal commented 8 months ago

@huard This looks not so hard to implement, but I'm not sure where it should live.

Would it be :

out, confidence_interval = xc.generic.frequency_analysis(da, confidence=0.95)

where

def frequency_analysis(*args):
    params = fit(da, dist)
    out = parametric_quantile(params, q)
    conf_int = dist.interval(0.95, params)
    return out, conf_int

Like, is it an optional output for every indicator that computes a fit ?

huard commented 7 months ago

So the link to the interval method was a false lead. Sorry for this.

Zeitsperre commented 6 months ago

Discussion suggests that this should be contributed upstream to scipy (or lmoments3?)