Finding the optimal withdrawal strategy in retirement to minimize taxes and to maximize your financial legacy.

Financial planning is an optimization problem. You want to maximize the money that you have for yourself and to leave to your heirs, in part by minimizing taxes paid to the government. You want to do that over your lifespan, as the optimum strategy for minimizing taxes only for a given year may have a negative impact on your (or your heirs’) future finances.

There are different optimizations that one can envisage. For example, you can ask how much can you spend and die broke, or how long you can spend according to your needs, or how to maximize your financial legacy given your spending needs. If there were no taxes on your investments, and depositing and withdrawing to an account had no tax consequences, then these problems would be trivial to solve. However, in reality, it becomes very difficult due to the complexity of the types of accounts available to you to invest in and the complexities of the Canadian tax and pension codes. Advisors generally rely on rules of thumb, which can vary but generally amount to withdrawing from non-registered accounts first to allow for longer tax-free growth of registered accounts and to delay taxes. However, it is difficult to determine if rules of thumb will be optimal in any one particular case.

The MoneyReadyApp

The MoneyReady App is a fully tax-aware financial calculator that allows you to input your scenarios and determine the optimum strategy for you. However, you must try different scenarios and get to your optimal solution by trial and error. Given that the MoneyReadyApp has all the information necessary, could it not be smart and automatically determine the optimal strategy for you the first time? This is a very hard problem.

Consider the simplest case where you have at least two of the following 3 types of accounts:

  1. A Tax-Deferred Account (TDA) such as an RRSP (or DCPP, RRIF, LIRA, LIF, or their equivalents). For this type of account, the deposits are tax-deductible, growth is not taxed, but withdrawals are fully taxable as income.
  2. A Tax-Free Savings Account (TFSA). Deposits are not deductible, growth is not taxed and neither are withdrawals.
  3. A non-registered account. Deposits are not deductible. Interest and dividends are taxable in the year they are earned; capital gains are taxable only when an investment is sold.
Say you have determined how much money you will need to spend in retirement after you’ve paid any taxes, and these accounts are available to you to withdraw from in order to supplement any income from annuities, private pensions, and public pensions (OAS and CPP) that you may have. If you need money, from where do you take it?

First I’ll describe how the MoneyReadyApp TIME MACHINE works. It’s quite intuitive as it works like most people think of their money coming in with their incomes and out with their expenses. I use all-caps when referring to MoneyReadyApp tabs or sections where users enter their data and scenarios. The MoneyReadyApp TIME MACHINE works by creating a notional account that we call the “wallet”. To this wallet every year is added all your INCOMES, and it is reduced by all your EXPENSES. You can add AUTOMATIC SAVINGS to accounts that will also deplete your wallet, and add AUTOMATIC WITHDRAWALS which will increase it. Taxes are then calculated, which also deplete your wallet. At that point, if your wallet has a positive balance, it will deposit the amount to your accounts in order and up to the limit of your set DEPOSIT PRIORITIES. If the wallet account is negative, it will withdraw from accounts, in the same way, using your WITHDRAWAL PRIORITIES. The TIME MACHINE thus attempts to zero your wallet every year. If it can’t, it will warn you so that you can adjust your planned spending or income in deficit years, (if you have surplus years it will suggest adding a non-registered account to allow deposits.)

So to optimize your withdrawal strategy after retirement, the first approach that you can take is the MoneyReadyApp’s trial and error one: you can simply try re-ordering your accounts' WITHDRAWAL PRIORITIES to see what works best. But we also allow you to set limits on the priority, so you don’t have to withdraw all of your spending needs from the first priority account before you go to the next one. Additionally you can change the PRIORITIES and their limits in any future year. And you can play with setting AUTOMATIC WITHDRAWALS from your accounts. You can see that the possible combinations of things that you can try become almost infinite.

But this is a computer, could it not try all the combinations for you? Well it could, and a tax-aware numerical algorithm to optimize the search could be implemented (which would hopefully not get stuck in local optima that are far off from the global optima that we want). The search could potentially also be sped up by distributing the work to multiple computers. So with enough time and money (computer time is not free), an optimal solution could potentially be found. It seems like brute force.

An Algorithm

There is another way, which is to come up with an algorithm to solve this problem deterministically, that is, just using math and some guiding principles based on an understanding of how the accounts are taxed. That is using smarts rather than brute force. A pair of American academics James DiLellio and Daniel N Ostrov, recently published the paper: Constructing Tax Efficient Withdrawal Strategies for Retirees with Traditional 401(k)/IRAs, Roth 401(k)/IRAs, and Taxable Accounts (August 8, 2018). Available at SSRN: http://dx.doi.org/10.2139/ssrn.3374590. Although there are many differences between the U.S.A and Canada in terms of account, taxes, and inheritance laws, there are also enough similarities that I decided to try and see if such an approach could work for Canada. Their computer code is proprietary but I was able to program their algorithm and reproduce their results from the published paper exactly. Once that was done, I set out to change it for Canada’s specifics.

As written, the algorithm makes some very strict assumptions. I will briefly describe those assumptions, pointing out issues that can arise when applying it to Canada, and for real Canadians (so that it's not just an academic exercise). I will briefly describe how the algorithm works. I will then explain aspects that were modified, first to deal with Canadian accounts and taxes, and to generalize to more realistic scenarios.

The algorithm optimizes the necessary withdrawals to meet consumption needs in retirement. This presumes that there are consumption needs above the level of income provided by other sources. Retirement is defined as those years beyond which you require income from your investment accounts. We will relax that below.

Taxable and non-taxable income from all income sources outside of your accounts is assumed known in each year of retirement. Such income, after-tax, must not depend on the level of withdrawals from your accounts. This creates a problem for many tax credits, and GIS and OAS public pensions that are income-tested and can be clawed back.

Spending (consumption) needs are also assumed to be known. The difference between consumption and known income must then be filled. Both consumption and income can vary in any year. Since we are talking about your retirement years, your spending needs are usually higher than your income. There can be exceptions to that. The government mandates required withdrawals from RRIFs and LIFs, which can sometimes provide more income than necessary. The algorithm accommodates that and allows for deposits to the non-registered account in such circumstances. For Canadians, we modified that so that the TFSA can be deposited to first, then the non-taxable account in case there is no more TFSA room. The algorithm can therefore also accommodate any year where income is higher than spending in this way, which allows for a more relaxed definition of “retirement”. But the algorithm does not allow for deposits to the TDA, and the algorithm optimizes for withdrawals only, not for deposits.

I started considering the case of a TDA (similar to a traditional 401(k)/IRA in the USA), a TFSA (similar to a Roth 401(k)/IRA), and a non-registered account (taxable account) consisting of only taxable stock as they do in the published paper. A simplified tax-calculation was implemented considering combined federal and provincial tax rates. It’s simplified compared to the MoneyReadyApp TIME MACHINE tax calculation which considers many more credits and deductions. Tax brackets are assumed to grow with inflation. Unlike the TIME MACHINE, that takes taxes from your wallet, in the algorithm the accounts pay their own taxes, that is any tax implication of growth in an account, or a withdrawal from an account, are taken from that account. This is important as it allows us to directly gauge the tax implication of any withdrawal. In the non-registered account, the calculation of capital-gains taxes is much simplified compared to the US counterpart, since Canada uses an averaged cost basis for the calculation of capital gains and losses, rather than keeping track of tax “lots”. However, the Canadian treatment of the tax on capital gains, and the taxes on dividends, become a problem for the assumptions of the algorithm as these are fractionally added to income (50% for capital gains, 138% for Canadian dividends, with a subsequent tax credit, and 100% for foreign dividends and interest). We cannot assume a flat tax rate for capital gains and dividends as is done in the original US algorithm. To deal with this, and the fact that withdrawals from the TDA may have already added to taxable income, we always consider the non-registered account last when updating its balance every year, and use marginal tax rates for capital gains, dividends, and income from the non-registered account.

Details of how the algorithm works for Canadians:

In this section I describe our modified algorithm in more detail, but this section is very technical and can be skipped.

For every year in retirement, the algorithm fills up your spending needs first with taxable and non-taxable income sources outside of your accounts. This brings you to a certain marginal tax rate that year. The algorithm then withdraws from the TDA as much as required for consumption, but only to the level of the heir’s marginal tax rate. The marginal tax rate of the heir depends on who your heir is. If you have a spouse that will inherit, then we assume that all accounts can be rolled over tax-free to the spouse, and if the spouse is in a lower tax bracket after your death than your current tax bracket, then it is best to leave that money to them. If there is no spouse (or they predeceased you) then the marginal tax rate of the heir is the marginal tax rate of your estate. In Canada, the balance of your TDA accounts are added to your final taxable income, while your investments in non-registered accounts are deemed disposed of, such that capital gains (if any) are taxed immediately; only the TFSA is inherited tax-free. This can put you in a much higher tax bracket at death, and in that case, it is better to have consumed the TDA and non-registered account in earlier years, leaving as much TFSA to the heir as possible.

Once the algorithm has partially filled consumption needs with the TDA up to the heir’s tax bracket, it fills the yearly consumption needs from the top, which is considering the highest tax brackets that would be reached should all spending come from taxable sources. Since spending from the TFSA is not taxable, it uses as much of the TFSA as possible like this to fill in those top tax brackets. This gives the amount of spending from the heir tax level, up to this TFSA tax level that remains to be filled with money from the TDA or the taxable account. Because the TDA is expensive to the heir (as it’s entirety taxed at death), it then fills what it can by spending the remaining TDA up to an even tax level over all the retirement years, hopefully reaching the TFSA level before the TDA runs out. If it does not reach that level, then the taxable account is used to fill the amounts between the TDA level reached and the TFSA. However, this may not be optimum, depending on the tax rate of the non-registered spending, which may require selling stocks and incur capital gains taxes which are determined by the adjusted cost base of the taxable account. So the algorithm considers this by considering the “desirability” of spending from the non-registered account versus spending from the TDA or TFSA and switches the amounts to be most beneficial to the heir. This is calculated by determining the cost to the heir, that is comparing the after-tax amount that is inherited from one source vs. another and also taking into account the differential tax rates and the fact that any money spent loses the ability to grow. The algorithm also minimizes taxes on the growth of the taxable account by using dividends for spending rather than reinvesting them. It then checks that withdrawals from the TDA account are enough to cover the minimum required withdrawals required by the government (which is a percentage of the previous year’s account balance according to the retiree’s age at the time). These minimums are high in Canada and often require the algorithm to freeze the results up to the year when minimum withdrawals are not met, make the required withdrawal, and rerun the whole algorithm from scratch from that year on. Because we allow different growth rates in our version of the algorithm, this entire procedure is changed as the desirability of spending from one account or another must be computed even if all spending needs can be met by the TDA and TFSA. For example, spending from the TFSA may be replaced with non-registered spending, even though taxable, depending on the differential growth rates of the accounts as well as considering the taxes.

By considering the tax levels and tax treatment of the withdrawals and spreading them out over the retirement horizon like this, it minimizes the tax and maximizes the inheritance. There are additional optimizations the algorithm tries and that we’ve adapted for Canada, for example, to withdraw more from the TDA than necessary in low tax years to fund the TFSA and then the non-registered account.

Applying it to real Canadians: The TIME MACHINE Withdrawal Optimizer.

The algorithm works well and is very fast, so it has potential for Canadians, but it can be overly, though necessarily restrictive in its assumptions and approach. To make it accessible to all Canadians, by that I mean MoneyReadyApp users, we combined the MoneyReadyApp App TIME MACHINE with the algorithm to try and optimize its retirement withdrawal strategy. The algorithm is applied for the years following the year of the retirement start date (which is entered in PROFILE, and can be different for the 2 spouses) to the ultimate date of death, which is assumed known and also can be different for the spouse.

The first step is to run the TIME MACHINE given the user inputs as is. For each of the spouses' retirement dates, we record the account balances at the end of the year. All along we record the level of INCOME from all sources, including the automatically calculated CPP, and the level of EXPENSES (not including taxes) from all sources in all years, including LOAN payments and INSURANCE premiums.
We also record the results at the death of each spouse, which helps to inform us of the tax rates expected at death.

Accounts and investments.

Most users have multiple accounts of different types, holding a multitude of investment types, in various currencies. To apply the algorithm, at retirement, we consolidate all TDA accounts into one, TFSAs into one, and non-registered accounts into one, all in Canadian dollars. This is done separately for each spouse, with joint accounts split between the two according to how much each spouse contributed to them to avoid violating CRA attribution rules. RDSPs and RESPs are not considered here, even when the account beneficiary is you or your spouse. Although they can be a source of retirement money (RDSPs are meant to be, while RESPs can only fund educational expenses), these types of accounts have deposit and withdrawal rules very distinct from RRSP-type accounts, which the algorithm cannot consider. As you will see, all accounts and their rules are sorted out later, including applying maximum withdrawal limits from LIRAs and LIFs, which are not considered by the algorithm. Combining TDAs also requires us to use a weighted average age (based on user inputs) for conversion to RRIF/LIF when required. We do not consider accounts held by your CCPC if you entered one. Optimizing investments, salary, and dividends from a CCPC is an entirely separate problem, which we don't deal with here, except that any salary and dividends you’ve set to earn from your CCPC will be considered in your income (and taxed appropriately).

The expected growth rates of the accounts are calculated (at retirement) based on a weighted average of the expected returns entered for the investments the accounts hold. The algorithm was extended to allow the three account types to have different growth rates. We also needed to allow cash and fixed-income investments in the non-registered account along with stocks, ETFs and mutual funds. It was also extended such that, as in the TIME MACHINE, the non-registered account is rebalanced every year to keep the same proportion of cash/fixed-income/equities as it has at retirement. Its cost-basis is also recorded at retirement.

Spouses.

At the MoneyReadyApp we consider the finances for the couple if a spouse has been entered. We want to minimize the taxes over the couple, and maximize the after tax-legacy of the couple to the estate on the ultimate death. For now, we only consider the ultimate heir to be your children or other individuals. There could be tax advantages to be had when leaving your estate to a disabled dependent, which is not considered here. There are also tax advantages to leaving an estate or parts thereof to charity. Both of these cases could be approximated by reducing the projected heir’s tax rate in the algorithm but we will leave that option for later improvements.

To apply it to spouses, we run the algorithm up to three times, depending on the dates of retirement and death of each spouse. Generally, we first run it for the first spouse to die from their retirement date to their death, then on the second spouse from their retirement date up to the first spouse’s death. If the second spouse outlives the first, that spouse inherits the accounts (and their cost-basis) and the algorithm is run once more from that date to their death. We also allow spouses to help each other out. If a spouse has unmet consumption in any year their spouse does not, the amount is transferred to the other spouse and the procedure is run again so that hopefully neither spouse has unmet consumption.

Tax breaks and clawbacks.

As I mentioned earlier, some tax credits and benefits are not considered, particularly if they are income tested. This is because tax rates and tax brackets (in real dollars) cannot change over time for the algorithm. We were able to implement OAS and the OAS clawback in the case where the retiree is 65 or over at retirement, as the OAS clawback can be incorporated into the tax structure in that case. The OAS is calculated from when the user starts it (age 70 at the latest) and is included in income. Often the clawback is triggered due to mandated minimal withdrawals from the TDA. As previously mentioned, in that case, the algorithm is often rerun from that year on, and if past age 65, it will use the modified OAS tax structure to consider the clawback. The GIS calculation is too complicated to be included at all in the algorithm, although a simplified approximation of GIS and its clawback could be implemented in a similar way as OAS. We leave that for future improvements. Another important tax consideration for retired Canadian couples is their ability to split pension income. We currently have no way to implement that in the algorithm as the two spouses are considered entirely independently.

Another round of the TIME MACHINE.

Given all of these issues, we nevertheless apply the algorithm and it gives us, for every year in retirement, the amount to spend from each account for each spouse. But we don’t stop there. We apply the algorithm’s suggestions by creating forced withdrawals (and sometimes deposits, as required) to the full MoneyReadyApp TIME MACHINE, essentially using its capability for making AUTOMATIC SAVINGS/WITHDRAWALS. We ignore any user-entered savings/withdrawals involving the accounts considered, but only after retirement.

We can then directly compare the results from the first TIME MACHINE run that used the user’s AUTOMATIC SAVINGS/WITHDRAWALS and their entered WITHDRAWAL PRIORITIES to this new TIME MACHINE run that instead uses the withdrawal schedule suggested by the algorithm. Both TIME MACHINE runs will also consider all of the outside events the user had originally planned for, like future real estate transactions, the buying of annuities, savings to the grandkids’ RESPs and RDSPs etc.

Ideally, the suggestions from the algorithm will lead to the user perfectly matching their consumption needs to the optimal withdrawal strategy, thus improving the results by leading to less taxes paid and a larger financial legacy. However, the algorithm does not always perfectly match the more accurate TIME MACHINE tax calculations due to clawbacks, income splitting, and other income-tested tax credits. These are often not very large but can add up and compound over time. Differences also arise due to the imposition of deposit and withdrawal limits on LIRAs, LIFs, RESPs, and RDSPs that are imposed by the TIME MACHINE according to legislation. A minor difference also occurs because the algorithm pays taxes from the accounts directly, while the TIME MACHINE pays them from your wallet, to be sorted out later.

But the most important differences come from the combining of accounts and differences in growth rates. First, multiple accounts are not combined in the TIME MACHINE and thus rebalanced in not quite the same way due to the merging of accounts in the algorithm. The MoneyReadyApp lets you select which accounts to draw from first, whatever their type. In setting the PRIORITIES in the app, we show you the average expected growth rate of each account because it is best to deposit to accounts that grow more and withdraw from accounts that are expected to grow less. But people know that, and the reason they have and want to keep some accounts that are expected to grow less is that they are not only optimizing growth but they are also managing risk. To apply the algorithm’s suggested withdrawal strategy, we need to unravel the combined accounts when several were combined. We prioritize deposits to the accounts with higher expected growth rates and withdrawals from accounts with lower expected growth rates. Comparison between the two TIME MACHINE runs in such cases is problematic, because results may vary not due to the algorithm per se, but due to differential growth rates that can lead, with compounding over a long retirement, huge differences in the results. Second, for planning purposes, the TIME MACHINE allows for changing the growth rates of investments and of inflation in the future, which when this feature is used, again makes comparisons problematic for the same reasons. Changing growth rates and inflation can however be implemented in the algorithm without violating any of its assumptions. We will leave that for later improvements as that feature of the MoneyReadyApp is rarely used.

In any case, we can compare the results of the two TIME MACHINE runs directly and be sure that both runs are tax-accurate and compliant. The result of the best run is kept.

Application to MoneyReadApp users.

We call the new TIME MACHINE run that uses the algorithm's suggestions the MoneyReadyApp WITHDRAWAL OPTIMIZER. To test this approach we applied it to an anonymised copy of our database of all MoneyReadyApp users that had previously run the TIME MACHINE since those users had already entered enough information to run it. Because the algorithm often needs to make deposits to the TFSA and the non-registered account, we also only selected users that had entered such accounts for themselves and for their spouse (the non-registered account can be held jointly). We also considered only users that had entered at least one EXPENSE for each spouse in retirement, and this can be a single joint expense.

The algorithm does not provide a partial result if there is unmet consumption in any year, so only cases where it was successful is its result kept. In a few cases, the resulting optimized run is successful at leaving a legacy whereas the first run was not (that is there was unmet consumption and a negative wallet in the first run but not the optimized run), so we keep those results. We did not encounter a case where the first run was successful but not the second.

The optimized TIME MACHINE resulted in 75.2% of these users increasing their after-tax legacy. For those, the after-tax estate (excluding REAL ESTATE and any outstanding LOANS), was on average 19.6% higher, ranging from (0.02% to 224.9%) with a median of 7.2% (or $197,000 in today’s dollars). The majority (62.0%) had a lower tax-bill at death despite leaving a larger estate before (and after) tax.

For the other 25% where it did not help, the difference in the two runs was usually less than 4% except for one case that did terribly poorly. I will explain it below. We also noticed those not helped had previously run the TIME MACHINE more often (median 18 runs) versus those that were helped (median 2 runs), which I think reflects that these users had already spent time optimizing their results by trial and error, leaving little room for improvement. Again in most of these cases, although the estate left was slightly lower, so was the final tax bill.

The one case that did very poorly was interesting to study in more detail. The user is a single individual with low income and assets. The algorithm extends the RRIF withdrawals over the whole retirement period, while the original run prioritized spending from that account early. In the original run the TDA account was exhausted early, leading to higher taxes early in retirement, but then to a very low tax rate such that the user was able to collect GIS on top of OAS later in retirement, leaving an after-tax estate in today’s dollars of $56,300 versus $7,700 for the “optimized” run (the algorithm does not yet consider the GIS clawback, we’re working on it). Of course, we only show the best of the two alternatives.

We will continue working on bringing you additional optimizers to making the MoneyReadyApp even smarter, allowing you to plan and make financial decisions based on solid theory applied to your specific situation. For example the WITHDRAWAL OPTIMIZER uses your inputs on your when to start CPP and OAS. You can change those dates and re-optimize, but we are also working on an automatic CPP/OAS optimizer. For the younger crowd not so close to retirement, whose current problems are to determine where best to save, we are working on these problems also. These are all hard problems, when done accurately.

I will continue to monitor and attempt to improve the optimization as more users join the MoneyReadyApp. The app is free to try and you get 3 free runs of the TIME MACHINE. However the MoneyReadyApp WITHDRAWAL OPTIMIZER does require a paid subscription (our only source of support to keep the app running), and we hope you will support our efforts to bring you the most comprehensive, accurate, and now smartest financial planning app for all Canadians.