1. Welcome to the course!
Hi, I am Ross Bennett. I am an analyst on a trading desk at a proprietary trading firm in Chicago. I am the co-author of the PortfolioAnalytics package and contribute to several other R packages used in finance.
2. What you will learn
This course will build on the fundamental concepts from the Introduction to Portfolio Analysis in R course. We will explore more advanced concepts in the portfolio optimization process such as complex constraint and objective sets, methods for estimating moments, optimization with periodic rebalancing (also referred to as backtesting), and visualizations to better understand the optimization problem. The focus of the course is to use the PortfolioAnalytics package to solve portfolio optimization problems that mirror real world applications.
3. Modern Portfolio Theory
Although Modern Portfolio Theory was introduced over 60 years ago, it establishes a framework for defining and evaluating objectives. In the Modern Portfolio Theory framework, the optimal portfolio for an investor to hold is the portfolio that maximizes portfolio expected return for a given level of risk. The academic approach follows the Markowitz approach using mean return as a measure of gain and standard deviation of returns as a measure of risk. However, most real world problems consider different measures of risk as well as multiple objectives and constraints. In this course, you will explore both the standard Markowitz approach and more complex problems similar to what you will encounter in industry.
4. Mean - Standard Deviation Example: Setup
Let's begin with an example to demonstrate how you can use PortfolioAnalytics to solve a portfolio problem using the Modern Portfolio Theory framework to maximize mean return and minimize standard deviation. You start with loading the PortfolioAnalytics library and a sample dataset. In the example in this video, you will use the first 8 columns of the edhec dataset. The edhec dataset contains monthly returns of the EDHEC composite hedge fund style index returns. You can create the portfolio specification object by initializing it with the column names of the dataset as the asset names. Now you add two constraints to the portfolio specification, full investment and long only constraints. The full investment constraint means that the weights must sum to 1. The long only constraint means that all weights must be positive. You have two objectives in the portfolio problem, one to maximize portfolio mean return and one to minimize portfolio standard deviation. For the mean return objective, the objective type is "return" because you want to maximize the objective. The objective name is "mean" for portfolio mean return. For the standard deviation risk objective, the objective type is "risk" because you want to minimize the objective. The objective name is "StdDev" for portfolio standard deviation. Don't worry if this is a lot to take in for now, you will see plenty of other examples in this course!
5. Mean - Standard Deviation Example: Output
Now you can print the portfolio specification object to see a concise representation of the specification. You see the names of the assets in the portfolio, a list of the constraints and a list of the objectives. In this case, you can see the portfolio specification consists of 8 assets, 2 constraints (full investment and long only), and 2 objectives (mean and standard deviation).
6. Mean - Standard Deviation Example: Optimize
In this slide, you can see how to run the optimization and visualize the results of the optimal portfolio. To run the optimization, call the function optimize.portfolio passing in the returns data, portfolio specification object, and optimization method. Note that you specify optimize_method = "random" to use the random portfolios algorithm to solve the problem. Also note that you specify trace = TRUE. This stores the results of each iteration of the optimization. You can chart the optimal portfolio in terms of risk and reward with the chart.RiskReward function, passing in the optimization output, the objective names to use for risk and return, and TRUE or FALSE if you want to chart the assets.
7. Mean - Standard Deviation Example: Optimize
You can see this in the chart in the slide where the gray points are the objective values of a given iteration. Collectively, these portfolios form the feasible space, the set of portfolios that satisfy the specified constraints.
8. Let's practice!
Now, let's get started and have a look at some initial exercises.