how plot fitting curve with The Gumbel distribution

70 vues (au cours des 30 derniers jours)
mohamad khazaeezade
mohamad khazaeezade le 6 Juil 2018
Commenté : Jeff Miller le 28 Sep 2019
hello i have this data:
x=[0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6];
y=[0 3 8 23 18 13 10 7 5 3 2 1 0];
plot(x,y)
how plot fitting curve with The Gumbel distribution?

Réponses (2)

Yash Trivedi
Yash Trivedi le 6 Juil 2018
Hi Mohamad,
The Gumbel distribution is known as the Extreme Value Distribution in MATLAB. You can check out the following documentation and examples which should help you achieve what you want -

Jeff Miller
Jeff Miller le 6 Juil 2018
Modifié(e) : Jeff Miller le 6 Juil 2018
I guess your y values are counts indicating the number of times each x value was observed. So, the full data set of observed x values is:
xobs = repelem(x,y);
You need to estimate the parameters of the best-fitting Gumbel for this set of xobs values. The maximum-likelihood estimates of the two parameters are 1.8237,0.86153, according to Cupid (where the Gumbel distribution is called ExtrVal1). These estimates were obtained and the resulting estimated PDF and CDF (attached) were plotted with the Cupid commands:
gumbel=ExtrVal1(4,.50);
gumbel.EstML(xobs)
gumbel.PlotDens;
Cupid also has a lot of other distributions that you could fit in a similar fashion.
  2 commentaires
Rafael J P Schmitt
Rafael J P Schmitt le 27 Sep 2019
Hi Jeff,
I cam across this answer when looking for a way to fit extreme value distributions to hydrologic data. The Cupid toolbox is really a very useful piece of work.
My first question is how you select the values to initialize the distribution above, i.e., 4 and 0.5 in
gumbel=ExtrVal1(4,.50);
When I work with Gumbel distributions I used evfit in Matlab so far. According ot the help evfit page, evfit should fit a Gumbel distribution, too. However, if we compare results of Cupid and evfit, the estimates for the distribution parameters are quite different.
x=[0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6];
y=[0 3 8 23 18 13 10 7 5 3 2 1 0];
xobs = repelem(x,y);
% Cupid way
gumbel=ExtrVal1(4,.50);
CUPID_MLEs=gumbel.EstML(xobs)
ML_MLEs=evfit(xobs)
It seems as if the evfit possibly uses the generalized extreme value distribution (see here). Do you have any thoughts on how to use cupid to reproduce the results of evfit and vice versa (possibly using ExtrValGen)?
Many thanks,
Rafael
Jeff Miller
Jeff Miller le 28 Sep 2019
Hi Rafael,
  1. The values of 4 and 0.5 were just chosen arbitrarily to have some example. In Cupid, you always have to supply some parameter values to create a distribution initially.
  2. The difference in parameter estimates is because these are different distributions. Unfortunately there is a lot of ambiguity in these distribution names: different authorities use the same names for different distributions, and vice versa. The only way you can tell for sure is to check the formulas for pdfs or cdfs. (And even that can be tough, because often the same mathematical formula is written differently, especially with different parameterizations.) So, your first problem is to figure out exactly which distribution you really want to use. "Gumbel" is really not specific enough.
  3. Note that MATLAB's version of evfit uses a version of the distribution suitable for modeling minima (see note at the end of evfit). You can make a plot with evpdf and see that the parameters returned by evfit produce a distribution that looks nothing like a histogram of your xobs. So, I don't think that is really the distribution you want. Maybe you need to model the mirror image as they suggest (but I don't see exactly how that works).
Hope that helps and that you get some use out of Cupid,
Jeff

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by