Creating an efficient frontier

2 views (last 30 days)
Aaron Fitzgerald
Aaron Fitzgerald on 10 Feb 2021
Answered: Namnendra on 27 Apr 2023
I am tryng to create an efficient frontier for a portfolio of 17 stocks. Using the step function below I am trying to create a 1,000 different portfolios to form the efficient frontier using the step function. When I use the step function, instead of creating 1,000 portfolios it only returns 4 points each 0.001 above from the up and low points. I was hoping someone could help with using the step or introduce another way of completing the problem.
for i = 2:n
ret(i,:) = (prices(i,:)-prices(i-1,:))./prices(i-1,:);
end
% Expected returns
retMeans = mean(Industry_returns);
% Variance-covariance matrix
mvarcov = cov(Industry_returns);
%%
%%
% Portfolio expected returns (preparing for MV optimizations)
low = min(retMeans);
up = max(retMeans);
step = .001;
retMeansTarget = (low:step:up)';

Answers (1)

Namnendra
Namnendra on 27 Apr 2023
Hey Aaron,
The step function is designed to generate a vector of values with a constant step size between two given limits. In your code, you are using it to generate a vector of expected return targets for your portfolios.
However, as you noted, this will only generate a small number of return targets, rather than the 1000 targets you were expecting. This is because the step size is quite large relative to the range of expected returns. For example, if the minimum and maximum expected returns are -0.05 and 0.10 respectively, a step size of 0.001 will generate only 161 return targets.
To generate a larger number of return targets, you could try reducing the step size to something smaller, such as 0.0001. Alternatively, you could use a different method to generate your return targets. One such method is to use the mean-variance efficient frontier, which is a curve that represents the set of portfolios that achieve the highest expected return for a given level of risk (variance). This curve can be generated by solving a quadratic optimization problem, such as the Markowitz portfolio optimization problem. By varying the level of risk, you can generate a set of return targets that span the entire efficient frontier.

Categories

Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!