📄 plot_gpd.m
字号:
function out=plot_gpd(resgpd),
%Menu driven plotting facility for GPD fit
%
% USAGE: out=plot_gpd(gpdres)
%
%resgpd: Structure obtained from a former GPD fit i.e. resgpd=gpd(...)
data=resgpd.data;
threshold=resgpd.threshold;
xi=resgpd.par_ests(1);
beta=resgpd.par_ests(2);
r=1;
while r~=0,
clc
r=input('\n\n\n\n\n\n\n\n Enter your choice for plotting !!! \n\n Enter (1) for exceedance distribution \n Enter (2) for tail of underlying distrbution \n Enter (3) for scatterplot of residuals \n Enter (4) for QQ plot of residuals \n Enter (0) to exit \n >');
while (r~=1) & (r~=2) &(r~=3) & (r~=4) & (r~=0),
r=input('!!!Enter either 0,1,2,3,4 >');
end
if r>=3,
excess=data-threshold;
res=log(1+(xi*excess)/beta)/xi;
end
if r==3,
plot(res,'.')
out=res;
sm=csaps(1:length(res),res(1:end),0.00005,1:length(res));
hold on
plot(1:length(res),sm,'k');
xlabel('Ordering');
ylabel('Residuals');
hold off
end
if r==4
out=qplot(res,0);
end
if (r==1)|(r==2),
x=qgpd(linspace(0,1,1000),xi,threshold,beta);
ypoints=ppoints(sort(data));
y=pgpd(x,xi,threshold,beta);
if r==1,
semilogx(sort(data),ypoints,'.');
out=[sort(data) ypoints'];
hold on
plot(x,y,'k');
hold off
xlabel('x (on log scale)');
ylabel('Fu(x-u)');
end
if r==2,
prob = resgpd.p_less_thresh;
ypoints = (1 - prob) * (1 - ypoints);
y = (1 - prob) * (1 - y);
loglog(sort(data),ypoints,'.');
hold on
plot(x(y>0),y(y>0),'k');
xlabel('x (on log scale)');
ylabel('1-F(x) (on log scale)');
set(gca,'yticklabel',get(gca,'ytick'));
set(gca,'ytickmode','manual');
hold off
out=[sort(data) ypoints'];
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -