gfit error message in generalized Pareto (GP) distribution

13 ビュー (過去 30 日間)
wave_buoys
wave_buoys 2019 年 1 月 7 日
回答済み: sanidhyak 2025 年 2 月 17 日 11:51
Hello,
I compute return period using gpfit (Generalized Pareto parameter estimates) to calculate the return period, while I calculate the maximum likehood, I got an error message below.
Warning: Maximum likelihood has converged to an estimate of K < -1/2.
Confidence intervals and standard errors can not be computed reliably.> In gpfit (line 124)
I guess this happens with small values in the inputs, but I have no idea how to sort it out. Could you please help????
Thanks

回答 (1 件)

sanidhyak
sanidhyak 2025 年 2 月 17 日 11:51
I understand that you are encountering a warning while using the gpfit function to calculate the return period. The issue arises when the shape parameter K of the Generalized Pareto distribution is estimated to be less than “-1/2”, which can lead to unreliable confidence intervals and standard errors.
The warning typically occurs when the input data contains small values or when the initial parameter estimates are poor. To resolve this, I recommend the following:
  1. Ensure that your input data is positive and adheres to the assumptions of the Generalized Pareto distribution. Negative or zero values can cause the fitting process to fail.
  2. You can manually provide initial estimates for the shape and scale parameters when calling the “gpfit” function, which may help the algorithm converge to a more reliable solution.
Here is a sample code that addresses the issue:
% Example data (replace this with your actual data)
data = randn(1000,1); % Replace with your dataset
% Check and remove non-positive values (if necessary)
data = data(data > 0);
% Fit the Generalized Pareto distribution with manual initial parameters
params = gpfit(data, 0.5, 0.5); % Example initial parameters (scale, shape)
% Check if the shape parameter K is less than -1/2
if params(2) < -0.5
warning('Shape parameter K is less than -1/2, which may lead to unreliable results.');
% Consider adjusting the initial parameters or using a different distribution
end
% Compute the return period based on fitted parameters
K = params(2); % Shape parameter
sigma = params(1); % Scale parameter
% Use the formula for return period calculation
returnPeriod = 1 / (1 - (1 - 1e-3)^(1/K)); % Example for a 1000-year return period
% Display the result
disp(['Return period: ', num2str(returnPeriod)]);
This approach should resolve the warning you are seeing. By filtering out non-positive values and adjusting the initial parameters, you should get more reliable estimates.
For more information on the gpfit function and the Generalized Pareto distribution, please refer to the following documentation:
I hope this helps!

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by