2018-03-09

Retirement Calculator

I made my own little retirement calculator, because I was dissatisfied with how the calculators I checked do the math. And I added a bit more flexibility to play with the numbers.

It's a simple python script: (GitHub link)

    Usage: retirement-calculator [options]
    Optional arguments:
      -h, --help                   Show this help message and exit

      --initial-savings            <USD>
      --working-annual-return-rate <rate>
      --retired-annual-return-rate <rate> 
      --inflation                  <rate> 
      --working                    <years> 
      --retired                    <years>
      --working-annual-savings     <USD> 
      --retired-annual-withdraw    <USD>
      --verbose

The calculation works as follows:

    savings=initial_savings
    for year in range(1, working+1):
        return = savings * working_annual_return_rate

        savings += return
        savings += working_annual_savings
        savings *= (1-inflation)


And in retirement:

    for year in range(1, retired+1):
        savings -= retired_annual_withdraw
        return = savings * retired_annual_return_rate

        savings += return

        savings *= (1-inflation)

To help with picking values for annual return rates and inflation, the calculator provides some historic data.

One consideration I glossed over is taxation. Depending on your account type (brokerage, IRA, Roth IRA, ...) you do or do not pay certain taxes like capital gain tax on your realized gains or income tax on your retirement income. Keep that in mind when looking at the numbers.

The other thing I simplified is that you would normally gradually move your investments towards safer options as you get closer to your retirement date. The calculator assumes a hard switch in annual return rate at the start of retirement.

Note that all numbers are in today's US Dollars. That also means that the calculator assumes you increase your annual savings to match the rate of inflation.

For example, if you work for 35 years, save $6000 a year, assume an annual return rate of 7% during work life and 5% during retirement and 3% annual rate of inflation, you end up with $411020 of today's US Dollars, and an initial annual return of $19351 at the start of retirement. With that you can roughly withdraw $17000 per year for 30 years.

So that's no good.

The difficult part is estimating future returns on your investments.

Playing with the numbers, I'd say if you want to be safe, saving $10000 to $15000 per year seems to be about right. The more the better.

Here is a sample output: (link)

    No comments:

    Post a Comment