skextremes.models.classic

Module containing classical generalistic models

Gumbel:

To be used applying the Block Maxima approach

Generalised extreme value distribution (GEV):

To be used applying the Block Maxima approach

Generalised Pareto Distribution (GPD):

To be used applying the Peak-Over-Threshold approach TODO

class skextremes.models.classic.GEV(data, fit_method='mle', ci=0, ci_method=None, return_periods=None, frec=1)[source]

Class to fit data to a Generalised extreme value (GEV) distribution.

Parameters

dataarray_like

1D array_like with the extreme values to be considered

fit_methodstr

String indicating the method used to fit the distribution. Availalable values are ‘mle’ (default value), ‘mom’ and ‘lmoments’.

cifloat (optional)

Float indicating the value to be used for the calculation of the confidence interval. The returned values are (ci/2, 1-ci/2) percentile confidence intervals. E.g., a value of 0.05 will return confidence intervals at 0.025 and 0.975 percentiles.

ci_methodstr (optional)

String indicating the method to be used to calculate the confidence intervals. If ci is not supplied this parameter will be ignored. Possible values depend of the fit method chosen. If the fit method is ‘mle’ possible values for ci_method are ‘delta’ and ‘bootstrap’, if the fit method is ‘mom’ or ‘lmoments’ possible value for ci_method is ‘bootstrap’.

‘delta’ is for delta method. ‘bootstrap’ is for parametric bootstrap.

return_periodarray_like (optional)

1D array_like of values for the return period. Values indicate years.

frecint or float

Value indicating the frecuency of events per year. If frec is not provided the data will be treated as yearly data (1 value per year).

Attributes and Methods

paramsOrderedDict

Ordered dictionary with the values of the shape, location and scale parameters of the distribution.

cflt

Float value for the shape parameter of the distribution.

locflt

Float value for the location parameter of the distribution.

scaleflt

Float value for the scale parameter of the distribution.

distrobject

Frozen RV object with the same methods of a continuous scipy distribution but holding the given shape, location, and scale fixed. See http://docs.scipy.org/doc/scipy/reference/stats.html for more info.

dataarray_like

Input data used for the fit

fit_methodstr

String indicating the method used to fit the distribution, values can be ‘mle’, ‘mom’ or ‘lmoments’.

cdf(quantiles)

Cumulative distribution function of the given frozen RV.

Parameters

xarray_like

quantiles

Returns

cdfndarray

Cumulative distribution function evaluated at x

pdf(quantiles)

Probability density function at x of the given frozen RV.

Parameters

xarray_like

quantiles

Returns

pdfndarray

Probability density function evaluated at x

plot_density()

Histogram of the empirical pdf data and the pdf plot of the fitted distribution. All parameters are predefined from the frozen fitted model and empirical data available.

Returns

Density plot.

plot_pp()

PP (probability) plot between empirical and fitted data. All parameters are predefined from the frozen fitted model and empirical data available.

Returns

PP plot.

plot_qq()

QQ (Quantile-Quantile) plot between empirical and fitted data. All parameters are predefined from the frozen fitted model and empirical data available.

Returns

QQ plot.

plot_return_values()

Return values and return periods of data. If confidence interval information has been provided it will show the confidence interval values.

Returns

Return values and return periods plot.

plot_summary()

Summary plot including PP plot, QQ plot, empirical and fitted pdf and return values and periods.

Returns

4-panel plot including PP, QQ, pdf and return level plots

ppf(q)

Percent point function (inverse of cdf) at q of the given frozen RV.

Parameters

qarray_like

lower tail probability

Returns

xarray_like

quantile corresponding to the lower tail probability q.

stats(moments)

Some statistics of the given RV.

Parameters

momentsstr, optional

composed of letters [‘mvsk’] defining which moments to compute: ‘m’ = mean, ‘v’ = variance, ‘s’ = (Fisher’s) skew, ‘k’ = (Fisher’s) kurtosis. (default=’mv’)

Returns

statssequence

of requested moments.

class skextremes.models.classic.Gumbel(data, fit_method='mle', ci=0, ci_method=None, return_periods=None, frec=1)[source]

Class to fit data to a Gumbel distribution. Note that this is a special case of the GEV class where the ‘shape’ is fixed to 0.

Parameters

dataarray_like

1D array_like with the extreme values to be considered

fit_methodstr

String indicating the method used to fit the distribution. Availalable values are ‘mle’ (default value), ‘mom’ and ‘lmoments’.

cifloat (optional)

Float indicating the value to be used for the calculation of the confidence interval. The returned values are (ci/2, 1-ci/2) percentile confidence intervals. E.g., a value of 0.05 will return confidence intervals at 0.025 and 0.975 percentiles.

ci_methodstr (optional)

String indicating the method to be used to calculate the confidence intervals. If ci is not supplied this parameter will be ignored. Possible values depend of the fit method chosen. If the fit method is ‘mle’ possible values for ci_method are ‘delta’ and ‘bootstrap’, if the fit method is ‘mom’ or ‘lmoments’ possible value for ci_method is ‘bootstrap’.

‘delta’ is for delta method. ‘bootstrap’ is for parametric bootstrap.

return_periodarray_like (optional)

1D array_like of values for the return period. Values indicate years.

frecint or float

Value indicating the frecuency of events per year. If frec is not provided the data will be treated as yearly data (1 value per year).

Attributes and Methods

paramsOrderedDict

Ordered dictionary with the values of the shape, location and scale parameters of the distribution.

cflt

Float value for the shape parameter of the distribution.

locflt

Float value for the location parameter of the distribution.

scaleflt

Float value for the scale parameter of the distribution.

distrobject

Frozen RV object with the same methods of a continuous scipy distribution but holding the given shape, location, and scale fixed. See http://docs.scipy.org/doc/scipy/reference/stats.html for more info.

dataarray_like

Input data used for the fit

fit_methodstr

String indicating the method used to fit the distribution, values can be ‘mle’, ‘mom’ or ‘lmoments’.

cdf(quantiles)

Cumulative distribution function of the given frozen RV.

Parameters

xarray_like

quantiles

Returns

cdfndarray

Cumulative distribution function evaluated at x

pdf(quantiles)

Probability density function at x of the given frozen RV.

Parameters

xarray_like

quantiles

Returns

pdfndarray

Probability density function evaluated at x

plot_density()

Histogram of the empirical pdf data and the pdf plot of the fitted distribution. All parameters are predefined from the frozen fitted model and empirical data available.

Returns

Density plot.

plot_pp()

PP (probability) plot between empirical and fitted data. All parameters are predefined from the frozen fitted model and empirical data available.

Returns

PP plot.

plot_qq()

QQ (Quantile-Quantile) plot between empirical and fitted data. All parameters are predefined from the frozen fitted model and empirical data available.

Returns

QQ plot.

plot_return_values()

Return values and return periods of data. If confidence interval information has been provided it will show the confidence interval values.

Returns

Return values and return periods plot.

plot_summary()

Summary plot including PP plot, QQ plot, empirical and fitted pdf and return values and periods.

Returns

4-panel plot including PP, QQ, pdf and return level plots

ppf(q)

Percent point function (inverse of cdf) at q of the given frozen RV.

Parameters

qarray_like

lower tail probability

Returns

xarray_like

quantile corresponding to the lower tail probability q.

stats(moments)

Some statistics of the given RV.

Parameters

momentsstr, optional

composed of letters [‘mvsk’] defining which moments to compute: ‘m’ = mean, ‘v’ = variance, ‘s’ = (Fisher’s) skew, ‘k’ = (Fisher’s) kurtosis. (default=’mv’)

Returns

statssequence

of requested moments.

class skextremes.models.classic.GPD(data, fit_method='mle', ci=0, ci_method=None, return_periods=None, frec=1)[source]