See also:
http://code.google.com/p/wafo/source/browse/trunk/wafo25/statistics/extremalidx.m
http://code.google.com/p/wafo/source/browse/trunk/wafo25/statistics/extremalidxrange.m
In order to select a good threshold you may also use:
http://code.google.com/p/wafo/source/browse/trunk/wafo25/statistics/disprsnidx.m
http://code.google.com/p/wafo/source/browse/trunk/wafo25/statistics/disprsnidxrange.m
With WAFO 2.5 you could do something like this:
Nmin=7; % minimum number of extremes
Tmin=5; % minimum distance between extremes
Tb = 15; % block period
xn = load('sea.dat');
timeSpan = (xn(end,1)-xn(1,1))/60; % in minutes
dt = xn(2,1)-xn(1,1); % in seconds
tc = dat2tc(xn);
umin = median(tc(tc(:,2)>0,2));
Ie0 = findpot(tc, 0.9*umin, Tmin);
Ev = sort(tc(Ie0,2));
Ne = numel(Ev)
if Ne>Nmin && Ev(Ne-Nmin)>umin,
umax = Ev(Ne-Nmin);
else
umax = umin;
end
Nu = floor((umax-umin)/0.025)+1;
u = linspace(umin,umax,Nu);
mrl = reslife(Ev, 'u',u);
umin0 = umin;
for io= numel(mrl.data):-1:1,
CI = mrl.dataCI(io:end,:);
if ~(max(CI(:,1))<= mrl.data(io) & mrl.data(io)<=min(CI(:,2))),
umin0 = mrl.args(io);
break;
end
end
[di, threshold, ok_u] = disprsnidx(tc(Ie0,:), 'Tb', Tb, 'alpha',0.05, 'u',u);
figure(1)
plot(di)
vline(threshold) % threshold from dispersion index
vline(umin0,'g') % compared to the one obtained from mean residual life plot.
figure(2)
plot(mrl)
vline(threshold) % threshold from dispersion index
vline(umin0,'g') % compared to the one obtained from mean residual life plot.
% threshold around 1.2 seems appropriate
Ie = findpot(tc, threshold, Tmin);
lambda = numel(Ie)/timeSpan; % # Y> threshold per minute
varLambda = lambda*(1-(dt/60)*lambda)/timeSpan;
stdLambd = sqrt(varLambda)
Ev = tc(Ie,2);
phat = fitgenpar(Ev, 'fixpar',[nan,nan,threshold], method,'mps');
figure(3)
phat.plotfitsumry() % check fit to data
% Return period and return level
Tr = 60 %Return period in minutes
[xr,xrlo,xrup] = invgenpar(1./(lambda*Tr),phat,'lowertail',false,
'alpha', 0.05) % 60 minutes return level + 95%CI
[xr,xrlo5,xrup5] = invgenpar(1./(lambda*Tr),phat,'lowertail',false,
'alpha', 0.5) % 60 minutes return level + 50%CI
Tr = 3*60 %Return period in minutes
[xr,xrlo,xrup] = invgenpar(1./(lambda*Tr),phat,'lowertail',false,
'alpha', 0.05) % 180 minutes return level + 95%CI
[xr,xrlo5,xrup5] = invgenpar(1./(lambda*Tr),phat,'lowertail',false,
'alpha', 0.5) % 180 minutes return level + 50%CI
Best regards Per A.
> --
> Du mottar denne meldingen fordi du abonnerer på Google-gruppen «wafo».
> Hvis du vil legge inn en melding i denne gruppen, kan du sende e-post til wa...@googlegroups.com.
> Hvis du vil avslutte abonnementet på denne gruppen, sender du en e-post til wafo+uns...@googlegroups.com.
> Hvis du vil ha flere alternativer, kan du besøke gruppen på http://groups.google.com/group/wafo?hl=no.
>
>