Integration extreme value theory

6 views (last 30 days)
Aurélie
Aurélie on 14 Jul 2013
Hello,
I have fitted functions from extreme value theory to my set of data Weibull (wbl in matlab), Gumbel (ev), and Fréchet (gev); so I have now respectively parmhatGEV, parmhatWBL and parmhatEV, as estimated parameters at disposal.
Given those fitted functions I would like to integrate them in order to determine if the almost integrate up to 1 in the interval I have to study.
I have tried different integration techniques on matlab but it seems it always miss something as I always get an error message.
If anyone has an idea to help me that would be awesome. Thanks a lot in advance! Best regard,
AuW
  2 Comments
the cyclist
the cyclist on 14 Jul 2013
Can you post a simple version of your code (ideally one we can run ourselves from scratch) and whatever error message you are getting?
Aurélie
Aurélie on 14 Jul 2013
I actually have no idea of the exact function to use.
I tried diff(fnval(fnint(f),[a b])), which told me that X was not defined... I tried every possibilities I found online but seems like until now, nothing solved my problem, actually I do no know how to tell to matlab that I want to use, for example, the GEV function with the estimated parameters I have previously computed.
Basically what I have from Fréchet distribution is: - parmhat(1), parmhat(2), parmhat(3) I obtain with "gevfit" - boundaries 1 to 5 for the integral
I do not know if I should define something else.. I'm sorry I'm kind of lost with this integral problem...
Thank you for your help!

Sign in to comment.

Answers (2)

the cyclist
the cyclist on 14 Jul 2013
Are you trying to do something like this?
% Generate some random pretend data. (You would use your actual data instead.)
N = 100000;
k = 0.05;
sig = 5;
mu = 1;
R = gevrnd(k,sig,mu,N,1);
% Plot the random data
figure
hist(R,-10:50)
xlim([-10.5 50.5])
% Fit the data. (I think you already got this part to work.)
parmhat = gevfit(R);
% Explore a fixed range of x, and see what the value of GEV(x) is. (At least, it seems that this is what you mean.)
dx = 0.01;
x = -5 : dx : 10;
% Calculate the fitted value of GEV(x) over that range
gevx = gevpdf(x,parmhat(1),parmhat(2),parmhat(3));
% There a many better ways to integrate in MATLAB, but this is simple and quick:
integral_fx = sum(dx*gevx)
You should see that this range gives about 80% of the total area

dpb
dpb on 14 Jul 2013
Edited: dpb on 15 Jul 2013
The integral is gevcdf() for the gevfit() parameters...simply plug in the upper limit for integral to whatever upper limit value you choose.
gevEstCumPct=gevcdf(b,parmhat(1),parmhat(2),parmhat(3));
assuming your max val is 'b' from the above.
The area between two points then simply
gevEstCumPct = gevcdf(b,parmhat(1),parmhat(2),parmhat(3))- ...
gevcdf(a,parmhat(1),parmhat(2),parmhat(3));
If you were to want to integrate numerically to check, simply use a range of values between upper and lower and evaluate w/ gevpdf() then use trapz(). Or you can use integral() on the function. Read doc on the above for more details on them, but for standard distributions for which Matlab as the xxx[cdf|pdf] functions, may as well just use them.
See doc on GEV distributions for an examples for gevfit -- from it one can take the estimated parameters they got for the particular case and looking at the graph see the upper range of the input data was roughly 20.
From that one can find
>> parmest=[0.2438 1.1760 5.8045]; % estimated params
>> gevcdf(20,parmest(1),parmest(2),parmest(3)) % upper lim
ans =
0.9964
>> gevcdf(4,parmest(1),parmest(2),parmest(3)) % lower lim
ans =
0.0011
>> gevcdf(20,parmest(1),parmest(2),parmest(3)) - ... gevcdf(4,parmest(1),parmest(2),parmest(3))
ans =
0.9953
>>
Do similar w/ other distributions.

Products

Community Treasure Hunt

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

Start Hunting!