Traditional portfolio optimization (often called modern portfolio theory, or mean-variance optimization) balances expected portfolio return with expected portfolio variance. You input how opposed you are to portfolio variance (your risk tolerance), then you build a portfolio that gives you the best return given your risk tolerance.
Goals-based investing, by contrast, defines “risk” as the probability of not achieving your goal. We assume you want to minimize that risk, so that is the only portfolio objective of a goals-based investor. As you will see, variance and returns are inputs into that equation, but they are not the equation (I rant more about that here).
For the most part, goals-based optimization produces portfolios that are on the mean-variance efficient frontier, but not always. I won’t go into why that is in this post (here is why), but I will demonstrate when the two methods diverge.
Fundamentally, there are three basic steps to optimizing a goal-based portfolio:
- Determine your goal variables: time horizon, amount of wealth dedicated to the goal today, and future required wealth value.
- Develop capital market expectations for your investment universe: correlations, return expectations, and volatility.
- Run a standard optimizer with a goal-based utility function.
This post is all about how to optimize a goal based portfolio in R.
First, we need to understand the goal, what is it you want to do with the money? To keep things simple, let’s say you need $1,000 in 10 years, and you have $750 dedicated to it today. We organize this into a goal vector with the goal’s value, the required funding value ($1,000), and the time horizon (10 years). Note that the goal’s value is only relevant when optimizing your current wealth across your goals, which this post does not cover.
Ok. Step 1 is done.
Second, we need to develop capital market expectations for our investment universe. This topic is so big numerous books have been written on it because it is a very important step. Better forecasts yield better results. Since this post isn’t about building CMEs, let’s just input something simple.
- Stocks: 9% average return with 15% volatility
- Bonds: 4.5% average return with 5% volatility
- Gamble: -1% average return with 80% volatility
- Cash: 0.5% average return with 0.01% volatility
Note the “gamble” asset–we are going to have fun with that in a minute! Step 2 is complete.
Finally, now that we have our human-based inputs, let’s proceed with the algorithm. Load our required libraries.
And build the functions we will use.
Since we input correlations and volatilities, we need to build a covariance table. This uses the
form (covariance of asset i to j equals the correlation of i and j times the volatility of i times the volatility of j).
All that is left is to do the optimization
The solnp function from the Rsolnp package is quite powerful. Plus, when you are running it on complicated problems, the output makes me feel like a hacker, which is always a plus!
And we find that our optimal weights are 31% stocks, 69% bonds.
So What’s Different About Goals-Based Investing?
Now that you’ve got the basics of goals-based portfolio optimization, we may ask what is so different about GBI? Well, let’s find out!
To illustrate, let’s build allocations for various levels of starting wealth.
And empty lists to hold the various allocation results
Then iterate through each starting wealth value and determine the optimal investment allocation (this code assumes you’ve run the code in the previous section).
Since I am using ggplot, I’ll now need to store the results in a long form data frame.
And, finally, visualize the results.
As you can see, goals-based portfolios will lean on high-variance, low return investments when your starting wealth is small enough. Technically speaking, GBI portfolios begin allocating to lottery-like investments whenever the return required to hit the goal is greater than the return offered by the mean-variance efficient frontier. In traditional mean-variance optimization, the optimizer will maintain exposure to the endpoint of the frontier, or 100% stock allocation, in our example.
As a comparison, here is the mean-variance optimizer result. As you can see, the “gamble” asset is eliminated from consideration.
Because of this, goal-based portfolios yield higher probabilities of goal achievement than mean-variance portfolios (mean-variance portfolios are stochastically dominated by goals-based portfolios). This was Exhibit 5 in my recent paper on this subject.
For all of these reasons (and more), if you have goals to achieve then you should be using goals-based portfolio theory. I hope this post helped you understand how to implement the basic framework!
Goals-based portfolio theory is also concerned with how you allocate your wealth across your goals, which I have not covered in this post, but I will cover that in a later discussion.
Keywords: goals-based investing, goal based investing, investing, portfolio theory, portfolio optimization.