Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- W_e = e/length(R); % equal weight of each asset
- W_mp = (inv(CoVar)*(R'-rf*e'))/(e*inv(CoVar)*(R'-rf*e')); %Weight of market portfolio
- r_mp = R*W_mp; %Return on market portfolio
- std_mp = sqrt(W_mp'*CoVar*W_mp); %Risk of market portfolio
- alpha_mp = (r_req-rf)/(r_mp-rf); %long position in market portfolio
- alpha_nomp = 1-alpha_mp; % Short position in risk free
- risk_req = alpha_mp*std_mp; %risk for required return
- cnt = 1;
- for a = linspace(0,5,200)
- r_CML(cnt) = (1-a)*rf + a*r_mp; %Return, CML
- std_CML(cnt) = a*std_mp; %Risk, CML
- cnt = cnt + 1;
- end
- plot(std_CML,r_CML)
- fprintf('---- Ecpected return and Risk of Market portfolio ---- \n %.4f %.4f\n',r_mp,std_mp);
- 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