Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. W_e = e/length(R); % equal weight of each asset
  2. W_mp = (inv(CoVar)*(R'-rf*e'))/(e*inv(CoVar)*(R'-rf*e')); %Weight of market portfolio
  3. r_mp = R*W_mp; %Return on market portfolio
  4. std_mp = sqrt(W_mp'*CoVar*W_mp); %Risk of market portfolio
  5. alpha_mp = (r_req-rf)/(r_mp-rf); %long position in market portfolio
  6. alpha_nomp = 1-alpha_mp; % Short position in risk free
  7. risk_req = alpha_mp*std_mp; %risk for required return
  8.  
  9. cnt = 1;
  10. for a = linspace(0,5,200)
  11. r_CML(cnt) = (1-a)*rf + a*r_mp; %Return, CML
  12. std_CML(cnt) = a*std_mp; %Risk, CML
  13. cnt = cnt + 1;
  14. end
  15. plot(std_CML,r_CML)
  16. fprintf('---- Ecpected return and Risk of Market portfolio ---- \n %.4f %.4f\n',r_mp,std_mp);
  17. fprintf('---- Ecpected return and Risk of portfolio on the market line ---- \n %.4f %.4f\n',r_req,risk_req);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement