MATLAB绘制copula图形-经管之家官网!

人大经济论坛-经管之家 收藏本站
您当前的位置> 软件培训>>

Matlab软件培训

>>

MATLAB绘制copula图形

MATLAB绘制copula图形

发布:tulipsliu | 分类:Matlab软件培训

关于本站

人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!

经管之家新媒体交易平台

提供"微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯"等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】

提供微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】

图片:https://pic.bbs.jg.com.cn/album/201303/13/224628toz8izuqg9kko88h.jpg程序代码:%Codetogenerateiso-probabilitycontourplotsofbivariate%distributions,allwithN(0,1)marginaldistributionsandconnectedvia ...
免费学术公开课,扫码加入


图片:
https://pic.bbs.jg.com.cn/album/201303/13/224628toz8izuqg9kko88h.jpg
程序代码:
  1. % Code to generate iso-probability contour plots of bivariate
  2. % distributions, all with N(0,1) marginal distributions and connected via various copulas
  3. %
  4. %Andrew Patton
  5. %
  6. %21 august 2006

  7. % Written for the following paper:
  8. %
  9. % Patton, A.J., 2006, Copula-Based Models for Financial Time Series.
  10. % To be published in T.G. Andersen, R.A. Davis, J.-P. Kreiss and T. Mikosch (eds.),
  11. % "Handbook of Financial Time Series", Springer Verlag.
  12. %
  13. % http://fmg.lse.ac.uk/~patton



  14. T = 100;% takes only around 15 seconds when T=100 on a single-processor 2.6GHz machine

  15. % i cannot see a difference in the printed graph based on T=100 vs T=500,
  16. % though it is a lot smaller and faster to load. so just use T=100;

  17. tic;
  18. xx = (-2:4/(T-1):2)';
  19. uu = normcdf(xx);

  20. v = (0.02:0.03:0.2);

  21. % 1. Normal copula
  22. rho = 0.5;
  23. zz = nines(T,T);% this the the part of the pdf from the X variable
  24. tic;
  25. for ii=1:T;
  26. zz(:,ii) = bivnormpdf(xx,xx(ii),[0,0],theta2rho(rho));
  27. end
  28. toc

  29. figure(101);subplot(3,2,1),contour(xx,xx,zz,v,'r-'),...
  30. title('Normal copula, \rho = 0.5');
  31. figure(102);subplot(3,2,1),contour(xx,xx,zz,v,'k-'),...
  32. title('Normal copula, \rho = 0.5');
  33. hold on;subplot(3,2,1),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;

  34. % 2. Student's t copula
  35. rho = 0.5;
  36. nu = 3;
  37. zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
  38. tic;
  39. for ii=1:T;
  40. zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*tcopula_pdf(uu,uu(ii),rho,nu);
  41. end
  42. toc
  43. figure(101);subplot(3,2,2),contour(xx,xx,zz,v,'m-'),...
  44. title('Student''s t copula, \rho = 0.5, \nu = 3'),...
  45. figure(102);subplot(3,2,2),contour(xx,xx,zz,v,'k-'),...
  46. title('Student''s t copula, \rho = 0.5, \nu = 3'),...
  47. hold on;subplot(3,2,2),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;

  48. % 3. Clayton copula
  49. kappa = 1;
  50. zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
  51. tic;
  52. for ii=1:T;
  53. zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*clayton_pdf(uu,uu(ii),kappa);
  54. end
  55. toc

  56. figure(101);subplot(3,2,3),contour(xx,xx,zz,v,'Color',[0 0.7 0]),...
  57. title('Clayton copula, \kappa = 1');
  58. figure(102);subplot(3,2,3),contour(xx,xx,zz,v,'k-'),...
  59. title('Clayton copula, \kappa = 1');
  60. hold on;subplot(3,2,3),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;


  61. % 4. Gumbel copula
  62. kappa = 1.5;
  63. zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
  64. tic;
  65. for ii=1:T;
  66. zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*gumbel_pdf(uu,uu(ii),kappa);
  67. end
  68. toc

  69. figure(101);subplot(3,2,4),contour(xx,xx,zz,v,'Color',[1 0.4 0]),...
  70. title('Gumbel copula, \kappa = 1.5');
  71. figure(102);subplot(3,2,4),contour(xx,xx,zz,v,'k-'),...
  72. title('Gumbel copula, \kappa = 1.5');
  73. hold on;subplot(3,2,4),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;


  74. % 5. SJC copula
  75. tauU = 0.45;
  76. tauL = 0.2;
  77. zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
  78. tic;
  79. for ii=1:T;
  80. zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*sym_jc_pdf(uu,uu(ii),tauU,tauL);
  81. end
  82. toc
  83. figure(101);subplot(3,2,5),contour(xx,xx,zz,v,'Color',[0.5 0.5 0.5 ]),...
  84. title('SJC copula, \tau^U = 0.45, \tau^L = 0.2');
  85. figure(102);subplot(3,2,5),contour(xx,xx,zz,v,'k-'),...
  86. title('SJC copula, \tau^U = 0.45, \tau^L = 0.2');
  87. hold on;subplot(3,2,5),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;


  88. % 6. Mixture of normals copula
  89. rho1 = 0.95;
  90. rho2 = 0.05;
  91. zz = nines(T,T);% this the the part of the pdf from the X variable
  92. tic;
  93. for ii=1:T;
  94. zz(:,ii) = 0.5*bivnormpdf(xx,xx(ii),[0,0],theta2rho(rho1)) + 0.5*bivnormpdf(xx,xx(ii),[0,0],theta2rho(rho2));
  95. end
  96. toc
  97. figure(101);subplot(3,2,6),contour(xx,xx,zz,v,'Color',[0 0 1 ]),...
  98. title('Mixed normal copula, \rho_1 = 0.95, \rho_2 = 0.05');
  99. figure(102);subplot(3,2,6),contour(xx,xx,zz,v,'k-'),...
  100. title('Mixed normal copula, \rho_1 = 0.95, \rho_2 = 0.05');
  101. hold on;subplot(3,2,6),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
复制代码
工具箱压缩包下载:
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
本文关键词:

本文论坛网址:https://bbs.pinggu.org/thread-2268110-1-1.html

人气文章

1.凡人大经济论坛-经管之家转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
经管之家 人大经济论坛 大学 专业 手机版