Chapter 2. Portfolio Optimization
By now we are familiar with the basics of the R language. We know how to analyze data, call its built-in functions, and apply them to the selected problems in a time series analysis. In this chapter we will use and extend this knowledge to discuss an important practical application: portfolio optimization, or in other words, security selection. This section covers the idea behind portfolio optimization: the mathematical models and theoretical solutions. To improve programming skills, we will implement an algorithm line by line using real data to solve a real-world example. We will also use the pre-written R packages on the same data set.
Imagine that we live in a tropical island and have only USD 100 to invest. Investment possibilities on the island are very limited; we can invest our entire fund into either ice creams or umbrellas. The payoffs that depend on the weather are as follows:
Suppose the probability of the weather being rainy or sunny is the same. If we cannot foresee or change the weather, the two options are clearly equivalent and we have an expected return of 5% [(0.5×120+0.5×90)/100-1=0.05] by investing in any of them.
What if we can split our funds between ice creams and umbrellas? Then we should invest USD 50 in both the options. This portfolio is riskless because whatever happens, we earn USD 45 with one asset and USD 60 with the other one. The expected return is still 5%, but now it is guaranteed since (45+60)/100-1=0.05.
The main concept of portfolio optimization (which won the Nobel Prize for Harry Markowitz in 1990) is captured in this example. Based on the correlation between investment products, we can reduce the risk (which in this case is measured by variance) of the portfolio and still get the desired expected return.
To be mathematically more precise, let X and Y be the random variables with the finite variances and . The variance of their convex or affine combination is shown in the following quadratic function:
For different values of their correlation, this quadratic function looks like the following diagram:
The variance (as a measure of risk) can completely be eliminated if and only if the correlation between X and Y is -1 or +1, and the variance of X and Y are not the same. Otherwise, the variance of the portfolio with optimal weights depends (in an absolutely non-trivial way) on all the three parameters (, , and ), as we will see later in the Theorem (Lagrange) section.