MATLAB绘制copula图形
发布:tulipsliu | 分类:Matlab软件培训
关于本站
人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!
经管之家新媒体交易平台
提供"微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯"等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】
TOP热门关键词
图片: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
程序代码:
- % Code to generate iso-probability contour plots of bivariate
- % distributions, all with N(0,1) marginal distributions and connected via various copulas
- %
- %Andrew Patton
- %
- %21 august 2006
- % Written for the following paper:
- %
- % Patton, A.J., 2006, Copula-Based Models for Financial Time Series.
- % To be published in T.G. Andersen, R.A. Davis, J.-P. Kreiss and T. Mikosch (eds.),
- % "Handbook of Financial Time Series", Springer Verlag.
- %
- % http://fmg.lse.ac.uk/~patton
- T = 100;% takes only around 15 seconds when T=100 on a single-processor 2.6GHz machine
- % i cannot see a difference in the printed graph based on T=100 vs T=500,
- % though it is a lot smaller and faster to load. so just use T=100;
- tic;
- xx = (-2:4/(T-1):2)';
- uu = normcdf(xx);
- v = (0.02:0.03:0.2);
- % 1. Normal copula
- rho = 0.5;
- zz = nines(T,T);% this the the part of the pdf from the X variable
- tic;
- for ii=1:T;
- zz(:,ii) = bivnormpdf(xx,xx(ii),[0,0],theta2rho(rho));
- end
- toc
- figure(101);subplot(3,2,1),contour(xx,xx,zz,v,'r-'),...
- title('Normal copula, \rho = 0.5');
- figure(102);subplot(3,2,1),contour(xx,xx,zz,v,'k-'),...
- title('Normal copula, \rho = 0.5');
- hold on;subplot(3,2,1),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
- % 2. Student's t copula
- rho = 0.5;
- nu = 3;
- zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
- tic;
- for ii=1:T;
- zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*tcopula_pdf(uu,uu(ii),rho,nu);
- end
- toc
- figure(101);subplot(3,2,2),contour(xx,xx,zz,v,'m-'),...
- title('Student''s t copula, \rho = 0.5, \nu = 3'),...
- figure(102);subplot(3,2,2),contour(xx,xx,zz,v,'k-'),...
- title('Student''s t copula, \rho = 0.5, \nu = 3'),...
- hold on;subplot(3,2,2),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
- % 3. Clayton copula
- kappa = 1;
- zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
- tic;
- for ii=1:T;
- zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*clayton_pdf(uu,uu(ii),kappa);
- end
- toc
- figure(101);subplot(3,2,3),contour(xx,xx,zz,v,'Color',[0 0.7 0]),...
- title('Clayton copula, \kappa = 1');
- figure(102);subplot(3,2,3),contour(xx,xx,zz,v,'k-'),...
- title('Clayton copula, \kappa = 1');
- hold on;subplot(3,2,3),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
- % 4. Gumbel copula
- kappa = 1.5;
- zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
- tic;
- for ii=1:T;
- zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*gumbel_pdf(uu,uu(ii),kappa);
- end
- toc
- figure(101);subplot(3,2,4),contour(xx,xx,zz,v,'Color',[1 0.4 0]),...
- title('Gumbel copula, \kappa = 1.5');
- figure(102);subplot(3,2,4),contour(xx,xx,zz,v,'k-'),...
- title('Gumbel copula, \kappa = 1.5');
- hold on;subplot(3,2,4),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
- % 5. SJC copula
- tauU = 0.45;
- tauL = 0.2;
- zz = normpdf(xx)*ones(1,T);% this the the part of the pdf from the X variable
- tic;
- for ii=1:T;
- zz(:,ii) = zz(:,ii).*normpdf(xx(ii)).*sym_jc_pdf(uu,uu(ii),tauU,tauL);
- end
- toc
- figure(101);subplot(3,2,5),contour(xx,xx,zz,v,'Color',[0.5 0.5 0.5 ]),...
- title('SJC copula, \tau^U = 0.45, \tau^L = 0.2');
- figure(102);subplot(3,2,5),contour(xx,xx,zz,v,'k-'),...
- title('SJC copula, \tau^U = 0.45, \tau^L = 0.2');
- hold on;subplot(3,2,5),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
- % 6. Mixture of normals copula
- rho1 = 0.95;
- rho2 = 0.05;
- zz = nines(T,T);% this the the part of the pdf from the X variable
- tic;
- for ii=1:T;
- zz(:,ii) = 0.5*bivnormpdf(xx,xx(ii),[0,0],theta2rho(rho1)) + 0.5*bivnormpdf(xx,xx(ii),[0,0],theta2rho(rho2));
- end
- toc
- figure(101);subplot(3,2,6),contour(xx,xx,zz,v,'Color',[0 0 1 ]),...
- title('Mixed normal copula, \rho_1 = 0.95, \rho_2 = 0.05');
- figure(102);subplot(3,2,6),contour(xx,xx,zz,v,'k-'),...
- title('Mixed normal copula, \rho_1 = 0.95, \rho_2 = 0.05');
- hold on;subplot(3,2,6),plot([-2,2],[0,0],'k--',[0,0],[-2,2],'k--');hold off;
工具箱压缩包下载:
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
您可能感兴趣的文章
人气文章
本文标题:MATLAB绘制copula图形
本文链接网址:https://bbs.pinggu.org/jg/ruanjianpeixun_matlabruanjianpeixun_2268110_1.html
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。