Challenges of portfolio optimization
1. Challenges of portfolio optimization
Portfolio optimization is a hard problem.2. Challenges
One challenge is knowing what solver to use and the capabilities and limits of the chosen solver. A solver is an algorithm designed to find the optimal solution to a given problem. You can chose a solver based on the objective or formulate the objective to fit the chosen solver. Ideally, you want the flexibility of effortlessly switching between solvers depending on the problem. In many cases, there is more than one solver that can solve the problem and you should evaluate both. An example of a closed-form solver is a quadratic programming solver. The main advantage of closed-form solvers is that they solve a given problem very fast and efficiently and return an exact solution. The main drawback is that the problem must be formulated in a very specific way that is typically unique to the solver. An example of a global solver is differential evolution optimization. Global solvers have the advantage of being able to solve more general types of problems and find the approximate solution of the global minimum or maximum of the objective function with local minima or maxima. However, the algorithms used in global solvers are relatively more complex and more compute intensive. In this course, you will use both closed form and global solvers and learn how PortfolioAnalytics overcomes these challenges of portfolio optimization.3. Quadratic utility
For this next example, you will consider a portfolio optimization problem where the objective is to maximize quadratic utility, subject to the constraints such that the weight of each asset must be greater than or equal to zero and the weights must sum to 1. The intuition behind this formulation, is that you maximize portfolio return, with a penalty term for portfolio variance. The first term is the portfolio expected return, the transpose of the weights vector multiplied by the expected return vector. The second term is lambda multiplied by the portfolio variance, the transpose of the weights vector multiplied by the variance-covariance matrix of the asset returns multiplied by the weight vector. The lambda term is often referred to as the risk aversion parameter, a higher value for lambda means a higher penalty for portfolio variance.4. Quadratic programming solver
You can use the solve-dot-QP() function from the quadprog package to solve the quadratic utility maximization problem-dot-solve-dot-QP solves quadratic programming problems of the form as shown in the slide to minimize the negative of the transpose of the d vector times the b vector plus one half times the transpose of the b vector times the D matrix times the b vector. Note the similarities between the form shown here and the quadratic utility on the previous slide. You can substitute the weights with the b vector, the expected returns with the d vector, and the variance-covariance matrix with the D matrix. Also notice that the signs are different. This is ok because minimizing the negative of an objective is equivalent to maximizing the objective.5. Quadratic utility optimization
The code on this slide solves the quadratic utility optimization problem with solve.QP from the quadprog package. Do not worry about understanding everything on this slide. The main point is to demonstrate what it takes to set up and solve a problem directly with a quadratic programming solver in R. This is a lot of work for a simple problem and prone to mistakes. What if we want to use a different solver? Add, remove, or change constraints? We have to do this all over to fit the other solver. This can be challenging even for trivial problems. There is little support for visualization when using solvers directly, and it is often the case that visualizations are specific to the solver. Throughout the exercises and videos in this course, you will learn how to easily edit constraints and objectives view intuitive visualizations relevant to the portfolio optimization problem with the PortfolioAnalytics package.6. Let's practice!
Let's move on to some more exercises.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.