## TOC

### Abstract

In this project, I implement the

*Markowitz Portfolio theory*with real world data. As a beginning of my analysis, I propose some assumptions related to the market and investors. As for the data, I use 11 industry ETFs in the S&P 500 index as my analysis objects to reflect the market more comprehensively and compare differences among industries. I firstly do the exploratory data analysis including ETFs’ prices, returns and risks from both individual perspective and interacting perspective. Besides, I am especially focused on the distribution of returns. Although returns are not normally distributed as desired, it does not affect the following mean-variance analysis when using quadratic utility function. In section 3, I carry out the mean-variance analysis following the*Markowitz Portfolio theory*in three steps.### 1. **Assumptions**

#### 1.1 Assumptions about market

- Financial markets are frictionless.

- No short. Investors can borrow money at the risk free rate to long risky assets but cannot short risky assets.

- There are no restrictions on the distributions of returns. Returns calculated from the data I collected actually are not normally distributed as desired (2.2.2). But it’s okay because we are not using fancy utility functions, expected values of which are calculated depending on more assumptions and restrictions on the distributions of returns.

#### 1.2 Assumptions about investors

- In making investment decisions today, investors care only about the means and variances of the returns of their portfolios over a particular period.

- All investors hold the same belief and use the same method to analyze and allocate assets.

- Investors’ utility functions are all quadratic form. Investors prefer higher means and lower variances (risk averse). In other words, they will modify their portfolio to maximize their expected utility.

### 2. Exploratory Data Analysis

#### 2.1 Data Source and Description

data source: https://www.investing.com/

As for risk-free asset, I select the one year treasury bill rate of which is 1.81%.

As for risky assets, I select 11 industry ETFs in the S&P 500 index as my analysis objects. On the one hand, I think ETFs can cover more companies and thus reflect market information more comprehensively. On the other hand, I also want to compare the differences among different industries.

Industry | Code | Including |

Technology | QQQ | Companies offering software and services, technical hardware and equipment, semiconductors and semiconductor equipment. |

Real Estate | VNQ | Real estate management and development companies, and real estate investment trusts (REITs), but not mortgage REITs. |

Communication Services | VOX | Advertising, entertainment, social media and telecom companies. |

Materials | XLB | Companies in the chemical, construction, materials, packaging, mining and paper industries. |

Energy | XLE | Oil, gas, energy equipment and service industry companies. |

Finance | XLF | A range of financial services companies, including banks, insurance, asset managers, brokerage firms and real estate investment trusts (REITs). |

Industrial | XLI | Companies in aerospace, defense, construction, engineering, electrical equipment, transportation infrastructure and industrial machinery. |

Consumer Staples | XLP | Food and beverage, personal hygiene, health products companies. |

Utilities | XLU | Electricity, gas and water companies, and independent power producers and energy traders. |

Health Care | XLV | Biopharmaceutical, life sciences, companies providing healthcare equipment and supplies. |

Consumer Discretionary | XLY | Companies producing automobiles, household durable goods, textiles and leisure equipment; Hotels, restaurants, cinemas; retailers of consumer goods, etc. |

I have collected price data of these ETFs dating from 2010-01 to 2020-12. In the

*Mean-Variance Analysis part (Section 3)*, I use the data of 2017 as an example. Analysis of other years can also be carried out by directly changing the year number in source code.#### 2.2 Risk and Return

**2.2.1 ETFs’ Price**

Plotting ETFs’ prices in 2017, we can observe that prices of ETFs in different industries have some fluctuations, but they are basically stable within a certain range.

Ploting ETFs’ prices from 2010 to 2020, we can take a broader view. It can be observed that in a longer period of time, ETF prices in various industries still fluctuate within a certain range (semi-transparent shaded area). Notably, QQQ showed the highest growth rate. It is reasonable because iterative innovation in technology often leads to huge economic gains. To my surprise, the price of ETF in the financial sector (XLF) has always been low while it shows least volatility. Moreover, the prices of all ETFs’ fell significantly in the first quarter of 2020, which is supposed to be related to COVID-19.

In addition to analyzing the prices of individual ETFs, I'm also interested in the correlation between them. The correlation between QQQ and other industries is high, both in terms of the 2017 data and the overall data of the decade. This has to do with the widespread use of technology in all industries. In the long run, the price of the ETFs (except XLE) generally have strong positive correlation which can be interpreted as they are all positively related to the overall economic situation. However, the price of XLE (energy industry) is negatively correlated with all industries. Therefore, we can use assets in energy industry as a hedge tool when constructing portfolios.

**2.2.2 ETFs’ Returns**

I use daily returns in my analysis which is calculated by , where are the close prices of date and respectively. As for the annualised returns, it is calculated by assuming that each year has 252 trading days. Besides, I use variances and standard errors of daily returns to evaluate assets’s risk.

Daily returns fluctuate a lot as the figure shows. I am interested in the distribution of them.

From the boxplots and violinplots, we can observe that distributions of returns have the nature of a long tail which reflects the noisy nature of financial data. In the long run this feature is especially striking.

In addition, the results of histogram, QQ chart and KS test all imply that returns of these ETFs do not follow normal distribution.

Although returns are not normally distributed, we can still carry out the mean-variance analysis using quadratic utility function (section 3).

I am also interested in the correlation among returns of different industries’ ETF. It can be observed that returns of XLI&XLB, XLI&XLF, XLY&QQQ, XLY&XLI is positively related significantly in both short and long terms.

**2.2.3 ETF’s Risk**

Firstly, I draw the risk-return relationship plot of different industries respectively. It can be observed that the relationships between return and risk in different industries are all messy and there are no obvious differences.

Secondly, I analyze the relationship between all returns and risks. It can be observed that the data does not show an obvious intuitive idea that high risks correspond to high returns, which on the one hand implies that the data is noisy, and on the other hand indirectly proves that the market is not always balanced and effective.

### 3. Mean-Variance Analysis

#### 3.1 Optimal Market Portfolio

Building portfolios with 11 ETFs (i.e. portfolios only include risky assets), the figure below shows the returns and risks of randomly constructed portfolio. We can observe that not all portfolios are efficient.

Applying the dominance policy (that is, given expected return, calculate the minimum volatility), we can plot the efficient frontier and find the maximum possible sharpe ratio portfolio (optimal market pofolio ) as well as the minimum possible volatility portfolio.

#### 3.2 ** **Efficient Frontier

Assume there are one risk-free asset and risky assets. Let’s allocate our wealth among these assets and construct a portfolio. Denote the risk free rate risky assets’ average return by and respectively. Let denotes the covariance matrix of risky assets. Assume the weight of risky assets are , and thus the weight of risk-free asset is . Besides, denote the average return and standard deviation of the portfolio by and .

Deriving the efficient frontier is equivalent to solve the optimization problem:

Use the Lagrange multiplier method, that is, solve the problem:

we can calculate that the optimal is

where .

Since is linear with , so is linear with . Besides,

Therefore, . and the efficient frontier is . The result implies that the efficient frontier is a straight line goning through . What’s more, the line is also tangent to the efficient frontier of

*only-risky-assets-portfolios.*And the tangent point’s weights is which is intuitive and can be proved to be the optimal market portfolio mathematically. The efficient frontier (the line) is called captial market line.#### 3.3 Investors’ Optimal Portfolios

**Utility Function**As we assumed, all investors’ utility functions are quadratic form. The difference is the risk-aversion coefficient.

Quardic utility

since , thus

Therefore, the expected utility of portfolio is

According to the derivation, we know that the expected utility is only related with the expected value and variance of portfolio’s returns. Besides, whether the returns of assets are normally distributed does not affect the result.

**Investors’ Optimal Portfolios**All investors want to maximize its expected utility, that is, the weight of risky assets in the portfolio should satisfy

The analytical solution of is

Therefore, the allocation of assets for a quadratic investor is only correlated with the covariance and expected value of assets’ returns. Additionally, is a linear combination of the risk-free asset the optimal market portfolio, that is

where (no short) and is negatively related with . The smaller the is, the more risk averse the investor is. There are two scenarios

- If , investor will allocate its wealth on both optimal market portfolio and risk-free asset.

- If , investor will borrow money at risk-free rate and allocate the money together with its wealth on optimal portfolio.

Loading Comments...