⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_diversificationnumassets.m

📁 经济学专业代码
💻 M
字号:
% this script shows the diversification effect of increasing the number of securities in a market
% see "Risk and Asset Allocation" - Springer (2005), by A. Meucci

clear; close all; clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

E_Low=0.05;
E_High=0.10;
S_Low=0.10;
S_High=0.25;
NumAssets=[2 5 10 20 100];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure
for k=1:length(NumAssets)
    StepE=(E_High-E_Low)/(NumAssets(k)-1);
    StepS=(S_High-S_Low)/(NumAssets(k)-1);
    E=[E_Low:StepE:E_High]';
    s=[S_Low:StepS:S_High];
    S=diag(s.^2);
    NumPortf=20;
    [ExpectedReturn,Volatility, Composition]=EfficientFrontier(NumPortf, S, E);
    plot(Volatility, ExpectedReturn,'color','k');
    axis([0 S_High*1.1 E_Low E_High*1.1]);
    hold on
end
grid on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -