Retire: The ideal pre-retirement allocation mix

Web AdminLatest, Retire

Herman CarstensI’ve been wrestling with the question of how I should allocate my savings between retirement annuities, tax-free savings accounts, and other savings products. Each one has different tax implications, and the right combination will yield more money after retirement. Being a data scientist, I wrote a computer program to determine optimal investment allocations in the South African tax environment.

After many months of coding and fine-tuning, the answer surprised me. Fiddling your savings contributions can make a 3-5% difference in your post-retirement income after tax, when compared to a common-sense rule-of-thumb approach. Reducing your expenses by 10% and saving that money can make a 40-50% difference.

When I started working I had to choose how much money I would allocate to my pension fund. There were all sorts of tax implications. I wondered if I should allocate the maximum amount into a pension fund/retirement annuity (RA) now and take advantage of the 27.5% income tax deduction. Those savings grow tax-free, but result in a tax liability upon retirement.

The other option was to pay the tax now and use my after-tax income for discretionary investments. I’ll only be liable for capital gains tax once I retire, but I start with a lot less since SARS eats into my investable income with taxes. How should my Tax-Free Savings Account (TFSA) feature in all of this? What if my RA helps me fall in a lower tax bracket now?

I’ve posed this question to numerous tax experts and financial advisors and no-one could give me a definitive answer. Then I realised that I could do something about this. I’m the co-founder of Invoke Analytics, a machine learning and data science start-up where we create solutions using software algorithms and statistics. And so PyFin was born.

With the help of Kristia from The Fat Wallet Show and other tax-savvy friends, I coded up the SARS tax rules for individuals – those that pertain to savings and retirement, anyway. The nitty gritties are contained in this white paper.

PyFin starts out with some common-sense savings plans, and tries to improve them by intelligently guessing different savings combinations for every year between now and your retirement. It then calculates the post-retirement income after tax implication for each plan, until it finds a very good savings plan that maximises your income after tax, post-retirement.

Although there are probably still errors in the code, the results haven’t changed all the much in the last few months of tinkering. They did surprise me, though. No matter how much I tinkered and tuned the algorithm, it couldn’t improve on the common-sense TFSA-priority plan more than a few percentage points.

The TFSA-priority plan is the following:

  1. First, put R33,000 in your TFSA. If your saveable income for the year is less than R33,000, put whatever you can into your TFSA.
  2. Put whatever is left into your RA or pension fund.
  3. If you’re one of those lucky few who can put 27.5% of their gross income (or R350,000) into an RA and still have investable income, put that into ETFs or unit trusts.

Of course, this calculation makes a lot of assumptions. How these things will perform, what their fees are, that the tax laws will track inflation, etc.

PyFin then uses inputs such as:

  • your date of birth
  • expected retirement age
  • life expectancy
  • investment growth rate
  • current investment size(s)
  • the inflation rate.

It also uses a spreadsheet where you project – in today’s money –  your future:

  • income
  • expenses
  • and medical expenses.

You can also select whether you want to withdraw a maximum amount of savings every year, so that you end up with zero savings after retirement, or whether you want to withdraw a safe amount (4%) every year, to ensure that your capital is preserved.

Given all of this, for young-ish people starting out, PyFin’s conclusion seems to be that the TFSA-priority plan is pretty good. You can do 3-4% better if you stop your RA contributions after a decade or two and direct that money into ETFs. This is because if your RA grows too much, you start paying a lot of income tax after retirement, and that tax implication begins to outweigh the tax exemption. This, however, assumes that all else is equal. RAs are useful because they enforce some discipline: that debit order goes off every month, so you can’t spend the money on other things.

But here’s the kicker: using fancy algorithms to allocate your investments optimally has a small payoff. PyFin is still useful because every bit helps. But politics, fees, or some corporate scandal may have a larger effect on my savings than the fancy footwork of optimal allocations.

The MASSIVE payoff comes from reducing your expenses. PyFin is set up to give me “the answer” for a given input, but then also to tell me what difference it would make if I reduced my expenses by 10%, and saved that money. It is usually a 40-50% difference in post-retirement income after tax. Think about that:

  • Saving on a Starbucks muffin now buys you a restaurant meal later.
  • Saving on a restaurant bill now buys you a weekend getaway later.
  • Saving a weekend getaway now buys you flight tickets to Europe later.

After spending months of evenings and weekends to get PyFin running, this was not exactly the answer that I was looking for. I was hoping for some highly profitable, counter-intuitive result no human could foresee. Nevertheless, although PyFin is useful, the quick and dirty answer seems to be what the good financial journalists have been saying all along: First max out that TFSA. Rather than spending hours worrying about how to split your money between different savings vehicles, use that time to figure out how to reduce your expenses. It is the best investment you could make. 

PyFin is an open-source project located here. Anyone may download and review the Python code, and use it for non-commercial purposes. Commercial ventures can contact Invoke Analytics for further information. We’re working on a website so that non-programmers may also have access the functionality. PyFin was written by engineers, not CFAs, and does not constitute financial advice. No claim about the validity of the answers are made; use at your own risk.

– Herman Carstens is the co-founder of Invoke Analytics, a machine learning and data science business. 


Saving for retirement is the biggest investment most of us will ever make. Sadly, it can also be very complicated. In this monthly blog, we try to answer some of the retirement questions we hear most often, ranging from which products are best suited to different circumstances to efficient tax treatments. Ordinarily the words are by Carina Jooste, but this week we heard from Herman Carstens, co-founder of Invoke Analytics.



Retire blog

Meet the Just One Lap team at these free live events

Click here to meet the Just One Lap team at one of our live, free events.

Subscribe to Just One Lap


[adrotate banner=”8″]