楼主: forforfor
5068 2

[学科前沿] 【求助】hill图 平均超额图 用matlab怎么做啊 [推广有奖]

  • 0关注
  • 0粉丝

初中生

57%

还不是VIP/贵宾

-

威望
0
论坛币
437 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
126 点
帖子
6
精华
0
在线时间
22 小时
注册时间
2009-9-24
最后登录
2025-12-7

楼主
forforfor 学生认证  发表于 2013-5-24 21:17:03 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请问 matlab 里 mean excess 和hill图怎么画呢  哪位高手指点一下我这只菜鸟吧~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:MATLAB atlab matla Hill Hil matlab

回帖推荐

sheepyang1992 发表于3楼  查看完整内容

两个子函数

本帖被以下文库推荐

沙发
sheepyang1992 学生认证  发表于 2016-7-14 17:49:38
  1. function [c,uband,lband]=hillplot(data,param,opt,ci,plotlen)
  2. %Plots the Hill estimate of the tail index of heavy-tailed data
  3. %
  4. %  USAGE: [out,uband,lband]=hillplot(data,param,opt,ci,plotlen)
  5. %
  6. %   data: Data vector
  7. %  param: whether 'alpha' or 'xi' (1/alpha) should be plotted
  8. %    opt: Option for plotting with respect to threshold ('t') or number of exceedances  
  9. %         ('n').
  10. %     ci: Confidence interval
  11. %plotlen: Optional argument that determines plotting range of hill estimate starting from
  12. %         first order statistics. It can be entered as an integer (no quotes) or as a  
  13. %         percentage as '%5' including the quotes.
  14. %
  15. %    out: Parameter plotted
  16. %  uband: Upper confidence interval
  17. %  lband: Lower confidence interval
  18.          

  19. data=surecol(data);
  20. ordered=flipud(sort(data));
  21. ordered=ordered(ordered>0);
  22. n=length(ordered);
  23. loggs=log(ordered);
  24. avesumlog=cumsum(loggs)./(1:n)';
  25. diffi=avesumlog-loggs;
  26. diffs=[NaN; diffi(2:n)];
  27. if strcmp(param,'alpha'),
  28.     diffs=1./diffs;
  29. elseif strcmp(param,'xi'),
  30.     diffs=diffs;
  31. else disp('Parameter should be one of ''xi'' or ''alpha'' ');
  32.     return
  33. end
  34.   
  35. ses=diffs./sqrt(1:n)';
  36. x=1:n;
  37. y=diffs;
  38. last=n;
  39. if nargin==5,
  40.    if isstr(plotlen)==1,
  41.                 perc=str2num(plotlen(2:end))/100;
  42.                 last=floor(perc*n);
  43.    else
  44.       last=plotlen;
  45.    end
  46. end
  47. if strcmp(opt,'n')  
  48. plot(x(1:last),y(1:last))
  49. c=y;
  50. qq=norminv(1-(1-ci)/2);
  51. uband=y+ses(x)*qq;
  52. lband=y-ses(x)*qq;
  53. hold on
  54. plot(x(1:last),uband(1:last),'r:');
  55. plot(x(1:last),lband(1:last),'r:');
  56. xlabel('Order Statistics')
  57. ul=[uband;lband];
  58. scx=range(x(1:last))/20;
  59. scy=range(ul(1:last,:))/20;
  60. axis([min(x(1:last))-scx max(x(1:last))+scx min(ul)-scy max(ul(1:last,:))+scy]);


  61. elseif strcmp(opt,'t'),
  62.    
  63.    threshs=findthresh(data,1:n);
  64.    plot(threshs(1:last),y(1:last));
  65.         c=y;
  66.         qq=norminv(1-(1-ci)/2);
  67.         uband=y+ses(x)*qq;
  68.         lband=y-ses(x)*qq;
  69.         hold on
  70.         plot(threshs(1:last),uband(1:last),'r:');
  71.         plot(threshs(1:last),lband(1:last),'r:');

  72.         xlabel('Thresholds')
  73.    ul=[uband;lband];
  74.    scx=range(threshs(1:last))/20;
  75.    scy=range(ul(1:last,:))/20;
  76.         axis([min(threshs(1:last))-scx max(threshs(1:last))+scx min(ul)-scy max(ul(1:last,:))+scy]);
  77.    set(gca,'XDir','Reverse');
  78. else  
  79.    error('Last argument should be ''n'' or ''t''')
  80. end

  81. if strcmp(param,'alpha'),
  82.     ylabel('alpha');
  83. end
  84. if strcmp(param,'xi'),
  85.     ylabel('xi');
  86. end
  87. title('Hillplot')
  88. hold off
复制代码


已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
admin_kefu + 30 + 2 + 2 + 2 热心帮助其他会员

总评分: 论坛币 + 30  学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

藤椅
sheepyang1992 学生认证  发表于 2016-7-15 09:35:20
两个子函数
  1. function c=surecol(data)
  2. %Assures that data is column vector
  3. [m,n]=size(data);
  4. if n>m,
  5.    c=data';
  6. else
  7.    c=data;
  8. end

  9. function out=findthresh(data,ne)
  10. %Finds a threshold so that a given number of extremes lie above  
  11. %
  12. %USAGE: out=findthresh(data,ne)
  13. %
  14. % data: Data vector
  15. %   ne: Number of extremes to lie above.
  16. %       It can be supplied as an integer or as a percentage. If as a percentage it should
  17. %       be entered between quotes i.e. '%5' (5% of the data lie above the threshold found).  
  18. %
  19. %  out: threshold calculated
  20. data=surecol(data);
  21. if isstr(ne)==1,
  22.         len=length(data);
  23.         perc=str2num(ne(2:end))/100;
  24.         ne=floor(perc*len);
  25. end
  26. data=flipud(sort(data));
  27. thresholds=flipud(unique(data));
  28. lne=length(ne);
  29. for i=1:lne,
  30. index=data(ne(i))==thresholds;
  31. index=find(index);
  32. ind(i)=min(index+1,length(thresholds));
  33. end
  34. out=thresholds(ind);
复制代码

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-23 17:28