environmentaltools.temporal.fit_gpd_bootstrap
- environmentaltools.temporal.fit_gpd_bootstrap(df_eventos, alpha, umb, param, bca, nyears)[source]
Compute GPD parameters with bootstrap resampling and confidence intervals.
Automatically fits Generalized Pareto Distribution using L-moments with bootstrap resampling for specified thresholds. Also tests if Exponential distribution is appropriate when shape parameter CI includes zero.
- Parameters:
df_eventos (pd.DataFrame or np.ndarray) – Event time series data
alpha (float) – Significance level for confidence intervals
umb (array-like) – Threshold values to test
param ({'parametric', 'non-parametric'}) – Bootstrap resampling method
bca ({'standard', 'bca'}) – Confidence interval computation method
nyears (int) – Number of years in the dataset
- Returns:
boot (list of lists) – Bootstrap results [GPD_results, Exponential_results (if applicable)] Each contains bootstrap parameter matrices for each threshold
orig (list of lists) – Original parameter estimates [GPD_estimates, Exponential_estimates]
ci (list of lists) – Confidence intervals [GPD_CI, Exponential_CI]
tr (np.ndarray) – Return periods evaluated
peaks (np.ndarray) – Peak values used (for last threshold processed)
npeaks (int) – Number of peaks (for last threshold)
eventanu (float) – Average events per year (for last threshold)
Notes
For each threshold:
Extracts peaks exceeding threshold
Fits GPD using L-moments with bootstrap
Computes confidence intervals
If CI for shape includes 0, also fits Exponential distribution
Exponential is a special case of GPD with shape=0.
Examples
>>> umb = np.array([2.0, 2.5]) >>> boot, orig, ci, tr, peaks, npeaks, eventanu = fit_gpd_bootstrap( ... df['Hs'], alpha=0.05, umb=umb, param='parametric', ... bca='standard', nyears=10 ... )