Portfolio Optimization Kenny Darrell

Yüklə 60,42 Kb.
ölçüsü60,42 Kb.

Portfolio Optimization

Kenny Darrell

A Markowitz portfolio was examined using fifty S&P 500 stocks, with three years of return data. The portfolio minimizes variance for floor returns. This model was compared with two others; one minimized variance subject to a maximum allowable number of assets and one that minimized the number of assets used.

A portfolio is a collection of assets grouped together. An optimal portfolio is one that has characteristics that are no worse and generally better than all other combinations of assets with the exception of alternative optimal solutions. A non-linear Markowitz portfolio will be examined using fifty stocks from the S&P 500, where their returns are ascertained from Yahoo Finance over the past three years. The analysis will use the adjusted close to calculate the return from month to month. A base model, a Non-Linear Program (NLP), Optimized Portfolio Model will calculate an efficient frontier of portfolios. It will take floor values of return and find the percent allocations to each stock that will give the minimum variance, risk, and at least the floor return, for a range of returns. Two other models will be constructed from this data and compared with the base model. A Mixed Integer Non-Linear Programming (MINLP) model that minimizes the variance subject to varying maximum allowable numbers of assets to be included with constraints bounding the return to that of the base model. A second MINLP model that minimizes the number of assets used for varying allowable percent deviations from the base return. Data collected from the base model will be compared with the results from the second two models. All of the optimized models are looped on varying parameters and constraints. These will be plotted in order to see trends. They should only get worse for the first model because additional constraints cannot create a better solution. The second model is a different problem with a linear objective; its goal of minimizing number of stocks in a portfolio is different from minimizing the variance. These could show any number of differences.

The stock data is all collected from Yahoo Finance. A query from the historical prices is used to collect the raw data. The above mentioned query for symbol ANF is http://finance.yahoo.com/q/hp?s=ANF&a=11&b=10&c=2007&d=10&e=10&f=2010&g=m.

This query results with dates and their associated adjusted close monthly from 10-12-2007 to 1-11-2010. All other output is parsed out. The exact dates and stock used can be seen in the appendix. The adjusted close is subtracted from its prior months adjusted close to obtain a return over that month. This is done over all months and stocks and then used to calculate their average returns over the three year period. This average is then subtracted from every return giving a deviation matrix. You then take the dot product of every column with every column in the matrix, and take the sample average to obtain the Covariance Matrix. This is the covariance of every stock with every stock, the key to the applicability of the model. This allows for a higher average return while hedging against risk utilizing less than perfect correlation amongst assets to reduce its overall variance.

There are assumptions that come with the Markowitz Portfolio Model and the Optimization model. Those like will the past returns be a good indicator of the future that are only associated with the Markowitz model only effect its applicability to real situations. The assumptions made in the optimization model will affect the output and its validity. One major assumption of this is that we cannot guarantee a global optimal solution. This is due to the non-linearity of the problem. This problem is large enough to make it infeasible to exhaust all possibilities and obtain a global maximum. The local optimal value, if feasible, will be used in further analysis knowing that is better than any other non-exhaustive method would provide. Another assumption stemming from non-linearity in the objective functions and constraints is that we don’t have stationary points. The solver could get stuck here and state the objective and constraint are infeasible. Some solutions discussed later were deemed infeasible and could be locations of stationary points, multiple starting points were used and they are heavily constrained so I believe they are infeasible. There are also assumptions stemming from the models containing binary variables. We are assuming that an optimal solution can be found, given its feasible. Having integer variables the process to reach the solution could take an unrealistic amount of time, so there is an optimum we just can’t attain it.

The above problems seemed to be occurring while modeling the NLP in Excel. Output from solver would say infeasible while AMPL would give solutions. Placing the solutions from AMPL into Excel as the starting location would find a nearly identical solution. From experience in Case Study 2 with Excel, having binary or integer decision variables seem to be very slow. For these two reasons the AMPL environment was selected. The Base Model contains two sets, or indexes, one for each stock, 1 to 50, and one for each month period, 1 to 35. These indexes are used for parameters such as the input data; it’s the return of all stocks from the stock set for each month in the month set. The columns of this return data were averaged to get the average return for all stocks. From this, as described above, the covariance matrix is constructed. A decision variable is created that will be the percent allocation to each stock. This is a value that can range from 0 to 1 for every stock. Constraints are placed on each to guarantee they do not exceed these bounds. An additional constraint is used that requires the sum of the percent allocation to be exactly one. From the percent allocations a variable is calculated called the scenario return. This is a value for every month period that is the sum of all returns in that month multiplied by the percent allocation for that stock. The portfolio return is calculated from the scenario return by summing them over all months and taking their average, the return of the portfolio for that given set of allocations. Then the optimization has all parameters and variables needed to optimize the objective function. The objective is to minimize the portfolio variance. The variance is calculated by summing all combinations of the stocks, percent allocation of stock i multiplied by percent allocation of stock j multiplied by the associated covariance of these two stocks, variance if i = j. This objective is nonlinear as it contains the product of two decision variables, the percent allocations. Then an additional constraint is added to force the return to be greater than or equal to a floor value of return.

The model for part 2 is a modification of the base model. The data is all equivalent. A new decision variable, stock allowed, is added, a binary variable that is used to represent if the stock is allowed to be contained in the portfolio or not. A value of 1 means that it can be used and a value of zero means it cannot be included in the optimized portfolio solution. The objective is the same as the base model as well. This results in a model that is non-linear as well and having integer/binary restrictions on the decision variables. A new constraint is added that restricts the sum of all stocks allowed to be less than a value. This value is the maximum number of stock that can be included in the portfolio. Another new constraint is that the percent allocation must be less than or equal to stock allowed for a given stock. This will force it to have zero contribution if it is not allowed. One trial of model 2 ran the same return constraint as the base model. A second trial changed this constraint to not be greater than or equal to the base models return, but to be within .05 from it. This is a much more restrictive constraint.

The model for part 3 had additional input data, an added set and vector parameter. The set was integers for floor returns from the base model, its feasible solutions for floor return values from 0 to 3.6. This leads to the set having integers 1 to 36. A parameter was added that contains the variance from the base model for that floor return, the 17th element is the variance of the base model for a floor return of 1.7. This model moved the variance to be a calculated variable instead of the objective. The objective function was to minimize the sum of stocks allowed, to have as few stocks in the portfolio as possible. This objective function is linear. A constraint was added that required the variance to be less than 1.1 the variance of the base model. This meant that you could have a 10 percent worse variance. The return has a constraint where it must be within a given percent deviation from that of the base model.

The base model, being an NLP, used the MINOS solver’s reduced gradient approach with a quasi-Newton algorithm to obtain its solution. The optimization problem was solved over a range of floor returns until solutions were no longer feasible. This will happen at anything higher than the highest average return. The data set caused this to occur slightly before a return of 3.7, so the efficient frontier uses floor return values from 0 to 3.6.

The solution approach for model 2, being an MINLP, used the BONMIN solver’s B-Hyb, Hybrid outer-approximation/nonlinear programming based branch-and-cut, algorithm. There were required libraries and executables needed for the use of this solver as well; Cbc (Coin-or branch and cut), Ipopt (Interior Point Optimizer), Lapack (Linear Algebra Package), Blas (Basic Linear Algebra Subroutines), and MUMPS (Multifrontal Massively Parallel direct Solver). This model had the same construct of solving an optimal portfolio for a floor return over a range of returns. There is an outer layer to this that will find this efficient frontier for a range of values for the constraint of stock allowed. The solver will find an optimal portfolio over the range of returns for a range of stocks allowed form 1 to 5. This leads to 5 efficient frontiers.

The solution for model 3 had a linear objective function but a nonlinear constraint in the variance, so the same BONMIN solver was used. The approach here was very similar to that of model 2, having multiple for loops. The objective, to minimize stocks used to achieve results similar to the base model, would iterate over values of return from 0 to 3.6 by .2. This set was then iterated over varying the percent deviation variable from 5% to 20% calculating the minimum number of assets used for each case. Values were recorded to log files for all cases for further analysis.

Results from the base model came in two forms; there are minimum variances for each floor return as well as a vector of percent allocations to each stock for all return values. The percent allocations would be the usable output for applications purposes but for this analysis only the return and variances will be used. The efficient frontier can be seen in Figure 1, Minimized Variance for Return Floor. It is very clear from this that as you raise your expected return your variance increases in a polynomial manner.

Figure 1, Minimized Variance for Floor Return of Base Model

The results from model 2 were of the same form. The results can be seen in Figures 2, 3, 4, 5. Figures 2 and 3 show the efficient frontiers for a constraint on the return that they must that they are simply the same floor return of the base model. The base model frontier is plotted with the frontiers that only allow 1 to 5 stocks to be included. Figure 2 shows the entire range of returns as well as the frontier for 1 stock allowable. Figure 3 removes the 1 stock allowed case and only shows a range of returns from 0 to 1. This allows for easier visualization of the trend, only allowing 1 stock gives rise to much higher variance and above a return of 1.25 all solutions are the same return of 3.6. Without this case you can see a cleaner trend, the variance is converging to the original model as the number of stocks is increased. Figure 4 and 5 are the same as 2 and 3 except for they have tighter restrictions on the return, they must be in the range of .05 from the base model. Figure 4 shows that only allowing one stock gives infeasible solutions to most points, only if there is stock that has an average return in that range. Figure 5 shows the same trend as the previous case, it will converge to the base model frontier as the number of stocks is increased.

Figure 2, Efficient Frontier for Model 2, Constraint 1 Range 0-3.6

Figure 3, Efficient Frontier for Model 2, Constraint 1 Range 0-1

Figure 4, Efficient Frontier for Model 2, Constraint 2 Range 0-3.6

Figure 5, Efficient Frontier for Model 2, Constraint 2 Range 0-1

The results from model 3 are shown in Figures 6 and 7. Figure 6 shows the number of stocks used in each portfolio of the efficient frontier of the base model as well as the minimized number of stocks to fall within a certain percentage of the base models return. You can see that every case used fewer numbers of assets than the base model. This amount also decreases as the percent in deviation is increased because you are placing smaller restrictions on the performance. This shows that it is possible to construct similar portfolios that are much simpler in their contents. This does have its drawbacks as can be seen in Figure 8 as the variance is always higher.

Figure 6, Number of Stocks used for Varying Percent Deviations from the Base Model

Figure 7, Variance and Return for Model 3

From all of this analysis the minimal variances will always increase as more constraints are placed on the solution. The minimal variance obtained with bounds on used stocks showed much worse variance than that of the corresponding base case returns. The solutions were always worse for a greater than base case return. The constraint of being in the range of the base caused most returns to be infeasible with only 1 stock, but converged as they increased. The minimal stock usage was feasible to use fewer stocks and still fall in the range of the percent deviations allowed. There were always fewer stocks used than the base model. For smaller returns fewer stocks used as the percent deviation grew, this leveled off as the returns reached and exceeded one. From all of this it is a clear that any additional restrictions will lead to higher variances and/or lower returns. These results could lead to further study of the outcome effects of additional requirements and improved with changing the size, type, and timeframe of additional assets.

*AMPL source code, raw data, reduced raw data, and output data available upon request in soft format.

Appendix A, Stock and Date info


3M Co


AutoZone Inc


ACE Limited


AvalonBay Communities Inc


Airgas Inc


Ball Corp


Akamai Tech Inc


Baxter International Inc.


Alcoa Inc


BB&T Corporation


Allegheny Energy Inc


Becton Dickinson


Allergan Inc


Bed Bath & Beyond


Allstate Corp


Bemis Company


Altera Corp


Berkshire Hathaway


Altria Group Inc


Best Buy Co. Inc.


Amazon.com Inc


Big Lots Inc.


American Express Co




American Tower Corp A


Block H&R


Ameriprise Financial


Charles Schwab


Amerisource Bergen Corp


Coca-Cola Enterprises


Amgen Inc


Coca Cola Co.


Amphenol Corp A


Costco Co.


Anadarko Petroleum Corp


DIRECTV Group Inc.


Analog Devices Inc


Duke Energy


Aon Corporation


Ford Motor


Apache Corporation


Gap (The)


Apartment Inv & Mgmt


Kellogg Co.


Apple Inc.


McDonald's Corp.


Automatic Data Processing




AutoNation Inc


Oracle Corp.





































Yüklə 60,42 Kb.

Dostları ilə paylaş:

Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2023
rəhbərliyinə müraciət

    Ana səhifə