# how plot fitting curve with The Gumbel distribution

130 views (last 30 days)
Commented: Jeff Miller on 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?

Yash Trivedi on 6 Jul 2018
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 on 6 Jul 2018
Edited: Jeff Miller on 6 Jul 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 CommentsShowHide 1 older comment
Jeff Miller on 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