Integration extreme value theory
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
the cyclist
il 14 Lug 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?
Risposte (2)
the cyclist
il 14 Lug 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
0 Commenti
dpb
il 14 Lug 2013
Modificato: dpb
il 15 Lug 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.
0 Commenti
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!