https://doi.org/10.29013/EJEMS-21-2-76-81

Xu Jonathan, Dover-Sherborn High School, MA E-mail: skyjxu@gmail.com; xxjnicole@hotmail.com

MEAN VARIANCE PORTFOLIO OPTIMIZATION

Abstract. Mean-Variance Model (Modern portfolio theory) maybe the most famous model in financial field. It assesses a portfolio which's the expected return (mean) is maximized under a given risk (variance). It comes from assumption that investor want as high as return while as low as risk as he could when he invested a couple of assets (a portfolio is the collection of many assets). This model could give us the many optimal portfolio (efficient portfolio frontier) when we know every asset's expect return and their covariance matrix. The accuracy estimating the covariance matrix is the most essential part implementing portfolio optimization.

Thus, in this project, we will perform the mean variance portfolio of the targeted portfolio with Ledoit-Wolf shrinkage methodology which can give us robust estimation of covariance matrix. Then we will use the optimal portfolio to visualize the efficient frontier and compare the optimal portfolio with index or other randomly chosen portfolio.

Keywords: Mean-variance model, financial, portfolio, optimal, Ledoit-Wolf shrinkage methodology.

I. Introduction returns of each asset in the portfolio, often

This project provides an introduction to mean- used with a log returns and simple rates of

variance analysis and the capital asset pricing model return. Since the return of financial assets are

(CAPM). We begin with the mean-variance analysis of mostly in the distribution pattern of peaks

Markowitz (1952) when there is no risk-free asset also and thick tails, the quantitative models most-

discuss the difficulties ofimplementing mean-variance ly use the log return.

analysis in practice and outline some approaches for • Volatility: Volatility is used to measure the

resolving these difficulties. Because optimal asset al- risk of an asset, the standard deviation of the

locations are typically very sensitive to estimates of return sequence. For portfolios, volatility is

expected returns and covariances, these approaches the standard deviation of the return on the

typically involve superior or more robust parameter whole portfolio.

estimation methods. Mean-variance analysis leads • Assets Correlation: If there is a positive

directly to the capital asset pricing model or CAPM. correlation between the two assets (cor-

The CAPM is a one-period equilibrium model that relation coefficient p>0), the price and

provides many important insights to the problem of rate of return between the two assets will

asset pricing. The language / jargon associated with change in the same direction, and if there

the CAPM has become ubiquitous in finance. is a negative correlation (correlation factor

1 Financial Concepts p < 0), the price and rate of return between

• Expected Return: The expected return on the two assets will change in reverse." As a

portfolio assets is a weighted average of the result, negative-related assets tend to hedge

some of the risk, reducing the overall risk to the portfolio.

• Sharpe Ratio: That is, the profitability of the asset, calculated as:

• Sharpe= (expected return - risk-free interest rate) / volatility

• The higher the Sharp ratio, the greater the benefit of a unit of risk.

2. About Investors

• Utility Function: The utility function is a function on R ^ R, and if the wealth is w, U(w) represents the utility (satisfaction) that the investor obtains from w; Typically, the utility function U (w) should meet the following criteria:

(1) The more wealth you have, the more utility you have, i.e. U'(w) > 0;

(2) Increased wealth and decreasing marginal utility, i.e. U''(w) < 0;

(eg: Wealth increases from $1 to $2 and the utility is greater than wealth increases from $100 to $101)

Generally, the utility function will look like as this type of shape:

Figure 1.

Utility function normal shape • Risk Aversion: Starting from utility function, we can define an investor's risk aversion coefficient. Risk aversion coefficient is an extremely important parameter in asset allocation, which reflects the investor's personalized tolerance to

risk. The use of 'a' to represent the risk aversion factor represents an increase in the minimum expected rate of return required by investors for each more unit of risk assumed.

eg: Let risk and expected return be used as the minimum unit of 1%, then a = 5 means that investors require a return increase of at least 5% to be willing to take an additional 1% risk.

The greater the risk aversion factor, the more conservative the investor is. In general, the risk aversion factor should be greater than zero.

II Methodology Overview

1. Objective Function

In general, portfolios have two objectives: to maximize returns and minimize risk. The goal of optimization is therefore to find a balance that tends to maximize returns or minimize risk, depending on the investor's risk aversion. Assuming that there are n assets in the portfolio, R is the rate of return for the entire portfolio.

Objective function:

maximize E (R) - awT Sw

^ maximize rTw - awTSw

Where w is the asset weights in the portfolio ( w e [0,l]), a is the risk aversion, £ is the return co-variance matrix.

2. Constraints

The most critical constraint is that the weight of the asset adds up to 1.

n

Iw=1

i=1

You can specify a weight limit for each asset.

3. Define Risk Aversion Value

There are some common utility functions:

• Exponential utility function U(w) = -e~flw; a > 0;

• Logarithm utility function U(w) = ln(w);w > 0;

• Power utility function

U (w ) =

w

1-b

1 - b

;b > 0;w > 0,b * 1.

Utility functions can be used to determine an investor's level of risk aversion - the larger the recess of the utility function (i.e., the more negative U'' (w)) represents the greater the amount of wealth that needs to be added in order to increase a unit of utility. This demonstrates that the investor is more risk averse.

4. Optimization Calculation With above objective function and the introduction of risk aversion, we can transform the objective function into following from:

• • 1 r^ It minimize—w Zw — r w 2 a

subject toeTw = 1 where e is a vector contains all elements as 1. Let's denote A = 1/a, A > 0

Y =

Now the KKT condition is:

0 = Zw-Àw-ye eTw = 1

With above two equations, we can have:

1 -ZwT Z-le

eT z-ie

Denote w1 = ——— and w2 =

eT S"1e

eT

Then the optimal solution of the whole system should be:

Wopt = (1_ k )w1 + kw2

Where k = XwW

III Model Construction

We first provide a procedure overview of the model construction:

Data Preparation

• Log return calculation

• Preprocess missing values and outliers

• Estimate covariance matrix

Model Construction

• Define objective function and constraints •Write Python codes to find the results

Testing

• Randomly generate some portfolios

• Shape the efficient frontier

• Compare the random portfolios with optimal portfolio

Improvements

• Improve data quality

• Robust covariance estimation •Add risk-free asset

Figure 1.

1. Data Source

The monthly return data for six stocks was extracted from Google Finance with the stock tickers: HSY, AAPL, DIS, GOOG, WMT, KO

The necessary data is the daily adjusted closing price of the asset, if the unadjusted closing price is used, the yield needs to be adjusted according to the stock dividend, stock split and other events, so as to avoid causing abnormal return

2. Data Preprocessing

• The log return is calculated from the current price and the previous month's adjusted closing price.

*i*Не можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

• The missing value of return can be replaced by the historical average rate of return (Note: it is not recommended to replace the missing price data directly with the average price)

• Return values which are outside than 3 standard deviations are removed directly as outlier values (This can be adjustable for known return distributions)

• The return co-variance matrix estimation:

Highly related assets can have a significant impact on optimization results. Here we give two ways to adjust the yield co-variance matrix calculated using historical data.

(1) Diagonal adjustment - A very small number (e.g. 0.001, 0.005) is added uniformly to the main diagonal of the yield co-variance matrix, thus ensuring that the result error is not magnified when we inverse the matrix.

(2) Ledoit-Wolf shrinkage - Using Ledoit-Wolf shrinkage method to acquire robust covariance matrix estimation.

3. Optimizer Construction We are using python and package scipy which provides a convenient API to build all kinds of minimization problem structure. Then the constraints are introduced by adding inequality or equality.

Here we restricted every asset has upper bound allocation percentage of 30% and has lower bound allocation percentage of 0%, which means no short sells are allowed. IV Model Results 1. Optimal Portfolio

Here is the information about the optimizer results: Optimization terminated successfully. (Exit mode 0)

Current function value:

-0.0058981090972642005 Iterations: 9

Function evaluations: 72 Gradient evaluations: 9

Table 1. - And the optimal portfolio allocation is:

Optimal Weights

Stock Ticker Risk Aversion = 2 Risk Aversion = 5 Risk Aversion = 8

GOOG 0.001934 0.016806 0.016806

DIS 0.220275 0.168186 0.168186

HSY 0.182630 0.229654 0.229654

WMT 0.128743 0.237038 0.237038

KO 0.000000 0.081874 0.081874

AAPL 0.466418 0.266442 0.266442

Table 2. - Optimal Portfolio Information:

Portfolio Return Portfolio Risk

Risk Aversion = 2 1.36% 6.20%

Risk Aversion = 5 1.15% 4.72%

Risk Aversion = 8 1.06% 4.41%

2. Efficient Frontier

The efficient frontier is the set of optimal portfolios that offer the highest expected return for a defined level of risk or the lowest risk for a given level

of expected return. Portfolios that lie below the efficient frontier are sub-optimal because they do not provide enough return for the level of risk. Portfolios that cluster to the right of the efficient frontier are

sub-optimal because they have a higher level of risk same volatility as P but a higher expected return.

for the defined rate of return.

The efficient frontier will possesses following attributes:

(l) Any point on the effective frontier represents an optimal portfolio with a given asset weight, and of course there are some portfolios within the effective frontie, but given a portfolio P within the effective frontier, a portfolio P within the effective frontier can always find a combination with the

Therefore, in order to maximize the benefits, investors will always choose a combination of effective frontier. Ultimately, the best portfolio points move along the effective frontier based on different risk aversion values.

(2) When limiting the maximum weight of an asset or applying other weight constraints, the efficient frontier shape may change accordingly.

The efficient frontier of current portfolio:

Figure 2.

From the plot we see that with our current risk aversion = 2, the optimal portfolio is shown as the red point on the plot. And the global optimal can reach about 6.2% of portfolio volatility and about 1.36% expected return.

V Further Improvement

1. Improve data preprocessing procedure

• Increasing the frequency of data acquisition can effectively improve the accuracy of volatility forecasts (e.g., using daily rather than monthly earnings data);

• Using Ledoit-Wolf's estimated covariance matrix. For Sample covariance S and true co-variance matrix X, this method will find a

coefficient k such that can minimize

E ||z*-z|| ,, where X* = kS + (l -k)I.

2. Model improvement

• Efficient Frontier formulation: When randomly generated and weighted for an asset of 1, a common approach is to divide n randomly generated numbers by their and force them to and limit to 1. This method can be used in generating valid boundaries, but as the number of assets increases, it will be difficult to generate some more extreme weighting situations, resulting in valid boundaries not being fully drawn. This is because the n weights generated by this method are not evenly distributed on the n-dimensional

Add risk-free assets: The Markwitz model is used for the allocation of risk assets in this case, and in practice risk-free assets can be added to find the optimal allocation point

more precisely. After adding risk free asset, the efficient frontier won't change but there should be a tangent point with risk free market line.

VI. Conclusion

Based on the actual financial market, this project has coded the traditional Markowitz asset allocation model. This is an asset optimization method based on risk aversion factors, yields and volatility. This asset allocation model can be used for a variety of

References

Figure 3.

asset types, such as stocks, bonds, or indices. The allocation of asset weights for the next period is optimized based on the previous return and volatility of the asset. Markowitz asset allocation model is a financial gain/risk trade-off, which lays a solid theoretical foundation for CAPM model.

1. Ledoit Olivier and Michael Wolf. "Improved estimation of the covariance matrix of stock returns with an application to portfolio selection." Journal of empirical finance - 10.5 2003. - P. 603-621.

2. Roll Richard. "A mean/variance analysis of tracking error." The Journal of Portfolio Management - 18.4. 1992. - P. 13-22.

3. Mangram Myles E. "A simplified perspective of the Markowitz portfolio theory." Global journal of business research - 7.1. 2013. - P. 59-70.

4. Virtanen Pauli et al. "SciPy 1.0: fundamental algorithms for scientific computing in Python." Nature methods - 17.3. 2020. - P. 261-272.

5. Google Finance: Stock market quotes, news, currency conversions & more. (n.d.). Google. Retrieved October 11, 2020. From: URL: http://www.google.com/finance

6. Erlich Istvan, Ganesh K. Venayagamoorthy, and Nakawiro Worawat. "A mean-variance optimization algorithm." IEEE Congress on Evolutionary Computation. IEEE, 2010.