Author Topic: Wrote a retirement calculator because i-orp.com didn't do what I want  (Read 17000 times)

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
So recently it appears I retired when the company I work for dissolved.  Initially startling but after consideration I realized I didn't need any more money.

So the question was how to spend the money in savings, my IRA and my previous Roth contributions. I played with http://www.i-orp.com but it didn't really handle early retirement issues like a Roth pipeline or early non-qualified withdraws from IRA.  I also wanted to avoid a 72(t) distribution because that locks me in for many years.

Anyway, after watching a couple MIT classes on Linear Programming from youtube I wrote a little Python script to do what I want.

The result is here: https://github.com/wscott/fplan

As an example of what it does consider a case where someone retires at 48 with $400k in savings and $800k in an IRA and just did a $100k Roth rollover.

At the moment this calculator just assumes a fixed 6% gain for investments and no inflation. The first part of the calculator determines that you can spend $78k per year.  The next part is to say how. The Roth rollover cannot be accessed for 5 years and the IRA includes a 10% penalty for distributions. So we need do a series of Roth conversions and then start living off the Roth pipeline.

The output looks like this:

Code: [Select]
Yearly spending <=  78500

 age saving  spend    IRA   fIRA   Roth  fRoth  IRA2R   rate    tax  spend
 48:    400     53    800     39    100      0      0     10     14     79
 49:    367     95    807      5    106      0     67     15     22     79
 50:    289    102    779      0    183      0     80     15     23     79
 51:    198    102    740      0    280      0     80     15     23     79
 52:    102    102    700      0    382      0     80     15     23     79
 53:      0      0    656      0    490     87     80     15      8     79
 54:      0      0    611      0    512     80     39     10      2     79
 55:      0      0    606      0    499     80     39     10      2     79
 56:      0      0    601      0    485     80     39     10      2     79
 57:      0      0    596      0    470     80     39     10      2     79
 58:      0      0    590      0    455     80     39     10      2     79
 59:      0      0    585     39    438     41      0     10      2     79
 60:      0      0    578     39    420     41      0     10      2     79
...
The columns are explained on the github page, but basically it gets the running balances and how much is spent each year.

We spend all of the savings in the first 5 years, plus a little bit from the IRA to fill in the gaps. Taxes are high because I assumed all the worse case than savings had a 0 basis and pays full capital gains when being sold. (this is controllable) Then start spending previous contributions from the Roth account.  The users stays in the Roth pipeline for a couple years until at age 59 it becomes OK to start spending from the IRA directly.  On that year we spend some from the IRA and the rest from the Roth in order to stay in the 10% tax bracket.  It continues like this.

This is just a tool and clearly not a predictor of the future. I will add inflation and more controls on investment returns, but the correct way to use something like this is to rerun in each year and to adjust your spending to account for current realities.

Feedback is welcome, either here or on github. Also suggestions on what I should be modeling. For example, I don't currently model "required minimal distributions" from the IRA because it transitions to mostly Roth by that time, but that is pretty straightforward and I should do that in the future.


robartsd

  • Magnum Stache
  • ******
  • Posts: 3342
  • Location: Sacramento, CA
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #1 on: February 16, 2017, 11:33:19 AM »
I'd work on a model for inflation (at least a simple assumed inflation rate). Inflation is important in Roth pipeline calculations because the real value of the money you put in to start a Roth pipeline is less than the real value you get out at the end of the pipeline (contributions/conversions are available after 5 years, but are not adjusted for inflation - both real and inflation returns are stuck in the Roth until 59.5 if you want to avoid the penalty).


wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #2 on: February 16, 2017, 02:30:15 PM »
Yeah.  Just added inflation support. You are right that it matters for the roth pipeline.

Here is the same data with 8% returns and 2% inflation.

Code: [Select]
Yearly spending <=  78000

 age saving  spend    IRA   fIRA   Roth  fRoth  IRA2R   rate    tax  spend
 48:    400     60    800     32    100      0      7     10     14     78
 49:    368     99    822      0    115      0     56     15     19     80
 50:    290    102    827      0    185      0     68     15     21     81
 51:    203    104    820      0    273      0     69     15     22     83
 52:    106    106    810      0    370      0     71     15     22     84
 53:     -0      0    799      0    476     96     95     15     10     86
 54:     -0      0    760     23    514     67      0      0      2     88
 55:     -0      0    795     24    483     68      0      0      2     90
 56:     -0      0    833     24    448     69      0      0      2     91
 57:     -0      0    874     25    408     71      0      0      2     93
 58:     -0      0    917      0    364     95     25      0      0     95
 59:     -0      0    963     65    318     36      0     15      5     96
 60:     -0      0    969     68    305     35      0     15      5     98
Interstingly, the model opted to make non-quailified IRA distributions in this case instead of increasing the size of the roth pipeline.  10% penalty is better than adding money in a 25% tax bracket.

MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #3 on: February 16, 2017, 05:42:04 PM »
I played with http://www.i-orp.com but it didn't really handle early retirement issues like a Roth pipeline or early non-qualified withdraws from IRA.
Don't know how it would work out, but have you considered a collaboration with the i-orp creator?

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #4 on: February 16, 2017, 06:25:22 PM »
I played with http://www.i-orp.com but it didn't really handle early retirement issues like a Roth pipeline or early non-qualified withdraws from IRA.
Don't know how it would work out, but have you considered a collaboration with the i-orp creator?

I should have mentioned that.  James, who wrote i-orp, is a great guy and we have emailed back and forth several times about this. His main interest in my script is that is a very small compared to his monster. So he gave me a number of areas to investigate to see which would be useful to incorporate into his tool. I figured I would be in better shape to know what is valuable after getting some more feedback.

I added the early non-qualified IRA withdraws, Roth pipeline, and the Roth 5yr limit.  Also, I have hooks to model needing to payoff your house at the beginning.

Also, software is so much more fun with users. And I am retired and have time to play.

MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #5 on: February 16, 2017, 06:44:42 PM »
I should have mentioned that.  James, who wrote i-orp, is a great guy and we have emailed back and forth several times about this. His main interest in my script is that is a very small compared to his monster. So he gave me a number of areas to investigate to see which would be useful to incorporate into his tool. I figured I would be in better shape to know what is valuable after getting some more feedback.
Excellent!

There were some comments/suggestions on best software for financial planning - Page 2 (e.g., dealing with unrealized capital gains) that looked interesting.  Don't know what the nuts and bolts details of incorporating those would be....

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #6 on: February 18, 2017, 10:33:45 AM »
I added capital gains calculations using an average basis kind of approach.  You declare the basis of your after-tax money and it assumes every distribution from that account used a proportional amount. As the basis percent goes down over time.

This doesn't fix the problem of a single very old stock. There is a limit amount that you can model with this approach, but it should be straightforward to add support for multiple after-tax accounts that are modeled separately and each have their own average basis. Then it would tell you which to sell first to minimize taxes.

Let me know if someone has this problem.

MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #7 on: February 18, 2017, 12:47:33 PM »
I added capital gains calculations using an average basis kind of approach.  You declare the basis of your after-tax money and it assumes every distribution from that account used a proportional amount. As the basis percent goes down over time.

This doesn't fix the problem of a single very old stock. There is a limit amount that you can model with this approach, but it should be straightforward to add support for multiple after-tax accounts that are modeled separately and each have their own average basis. Then it would tell you which to sell first to minimize taxes.

Let me know if someone has this problem.
If I understand correctly what you are saying, this would address the situation of a person who has accumulated a large amount of one stock over the years, e.g., someone who used Employee Stock Purchase Plans (ESPPs) regularly and never sold the stock.  There have been at least several instances of that in various threads here and bogleheads. 

To check my understanding, below is what I think you already said, just rearranged slightly. 
 
In that case, are you saying a person could partition that single stock into multiple sub-accounts, each with a single, average basis?  The program would then increase each sub-account's value annually and assume every distribution from that account used a proportional amount of basis and gains appropriate for that year.  Over time, the basis percent in each sub-account would decrease due to added gains.

If so that appears a reasonable and worthwhile approach!

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #8 on: February 19, 2017, 04:52:24 AM »
The average basis in math form:

tax = <payout> * 15% * (1 - <original basis>/(<starting balance> * <rate> ^ <nyears>))

And yes the linear model can't keep track of individual stocks in one account but would allow you to split the account up into pieces with similar starting basis ratios.  Then the output would tell when to spend from each pile.

I saw requests for this feature in ORP, but since capital gains are so low anyway I am not sure it matters that much. Might be interesting to look at some cases where it matters.

boarder42

  • Walrus Stache
  • *******
  • Posts: 9332
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #9 on: February 19, 2017, 05:34:08 AM »
*

Rylito

  • Stubble
  • **
  • Posts: 102
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #10 on: March 04, 2017, 08:49:54 AM »
Replying to follow.  Thanks for this!

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #11 on: March 04, 2017, 09:26:13 AM »
Cool.  I have been adding new features daily, but I am not sure what other people need. Thinking of starting a blog and reporting on my progress.

If someone wants to be a testcase, I am happy to run your numbers and let you know what it says. The code now models the working years and can recommend how money should be invested.  (401k vs roth vs after-tax)
Need to teach it some of the roth backdoor tricks.

After I teach myself web stuff, I will try making an app to make this thing more accessible to non-geeks.

I now find myself with a lot of time to play...

MustacheAndaHalf

  • Walrus Stache
  • *******
  • Posts: 6611
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #12 on: March 04, 2017, 10:51:59 AM »
IRS publication 505 shows makes the following statement in section "Special Rules for Mutual Funds":
"You can figure your gain or loss using a cost basis only if you did not previously use an average basis for a sale, exchange, or redemption of other shares in the same mutual fund."
https://www.irs.gov/publications/p550/ch04.html#en_US_2015_publink1000250005

I don't see any reference to average cost basis elsewhere - it appears to apply solely to mutual funds.

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #13 on: March 04, 2017, 11:29:23 AM »
Capital gains for this type of optimizer is necessarily an estimate. The total amount of taxes collected will be pretty close, but it will be more uniform than reality.

I have a way to handle very non-uniform accounts but haven't implemented that yet.


MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #14 on: March 04, 2017, 11:38:51 AM »
The average basis in math form:

tax = <payout> * 15% * (1 - <original basis>/(<starting balance> * <rate> ^ <nyears>))

And yes the linear model can't keep track of individual stocks in one account but would allow you to split the account up into pieces with similar starting basis ratios.  Then the output would tell when to spend from each pile.

I saw requests for this feature in ORP, but since capital gains are so low anyway I am not sure it matters that much. Might be interesting to look at some cases where it matters.

And <payout> can be any amount from 0 to <starting balance> * <rate> ^ <nyears> in any given year - is that correct?

Rubic

  • Handlebar Stache
  • *****
  • Posts: 1130
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #15 on: March 04, 2017, 11:53:31 AM »
Very nice.  I've added your repo to my github watch list.

Torbua12

  • 5 O'Clock Shadow
  • *
  • Posts: 4
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #16 on: March 05, 2017, 12:38:35 AM »
The average basis in math form:

tax = <payout> * 15% * (1 - <original basis>/(<starting balance> * <rate> ^ <nyears>))

And yes the linear model can't keep track of individual stocks in one account but would allow you to split the account up into pieces with similar starting basis ratios.  Then the output would tell when to spend from each pile.

I saw requests for this feature in ORP, but since capital gains are so low anyway I am not sure it matters that much. Might be interesting to look at some cases where it matters.

Would it handle the situation below?
Desired program outputs include
- when to start the pension
- when to start SS for each person
- when to sell individual stocks
- when and how much to convert tIRA to Roth

If you need other information let us know.  We understand that longevity and rates of return will affect the answers.  Don't know how doable this is, but it might fit the "interesting to look at some cases where it matters" category.

Current balances
401k+tIRA   $1.7MM
HSA             $30K
Roth IRA      $15K
Taxable funds   $650K w/ basis of $620K
Single stock A   $200K w/ basis of $90K
Single stock B   $200K w/ basis of $75K
Single stock C   $200K w/ basis of $50K

NQDC income   $115K/yr from now through 2028

Soc. Sec. situation:
PIA_1 = $2,691  Born 1959
PIA_2 = $1,159  Born 1956

Pension income, $K/yr based on start year:
2017   $83.6
2018   $89.5
2019   $96.7
2020   $104.6
2021   $112.0
2022   $121.2
2023   $131.2
2024   $142.1
2025   $150.6

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #17 on: March 05, 2017, 04:59:26 AM »
Would it handle the situation below?
Desired program outputs include
- when to start the pension
- when to start SS for each person
- when to sell individual stocks
- when and how much to convert tIRA to Roth

Well, that is a significant challenge. I am going to need to ponder it for a couple days.

The individual stocks are easy enough to model, just have N after-tax accounts instead of just a single one.
The result will be fairly straightforward, but output will be messier and people are already complaining that they
can't read my table. In your case, stocks A/B/C are so similar that modeling them as a single account with a basis
of 215K will give around the same answer.

I think there is a straightforward way to handle WHEN to start SS, but I haven't seen it yet. James, from i-orp.com,
has been annoyingly silent when I asked him how he did that. ;-)  But everything else was simple once I thought about
it for a while. I was thinking I could run the simulation N times for the different options, but you have too many variations.

That said here is a quick pass with the current tool as-is using your data:
https://gist.github.com/wscott/dba822ada41a2932c265431000845be4

  • I assumed SS would be best at age 70 and I think I remember it is 30% than the quoted number at that age.
  • I just put all the after-tax money together and didn't consider the individual stocks. You will notice they are all sold in the next 5 years so it does matter a lot.
  • I tried the pension both now and at 65 and it appeared that waiting gave the better answer, but both results were similar.
  • this is assuming a 6% investment return with no inflation. Probably too aggressive for someone who is older.

It recommends heavy Roth conversions for the next several years and then you still end up paying a lot of money to uncle sam.  But you have a healthy income to play with.

My tool also allows you to answer questions like, "How would I buy a house for $500K with cash in 2 years and where should I get the money for that?" "What would that do to my spendable income?"

Please look over the data and see if you agree with it. Totally possible it isn't modeling something important.  And let me know if the output is totally confusing. The meanings of the columns can be found at the bottom of this page: https://github.com/wscott/fplan

Torbua12

  • 5 O'Clock Shadow
  • *
  • Posts: 4
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #18 on: March 05, 2017, 12:21:17 PM »
Well, that is a significant challenge. I am going to need to ponder it for a couple days.
If you can do it in only a couple of days, that would be amazing!  Doing it at all would be fabulous.

Thanks for what you have so far.  Some thoughts below.

* There is plenty of blank screen space remaining as we look at the output.  More columns would not be too messy, in our opinion. ;)
* We have been thinking of never selling stock C, instead leaving that to our children so they get the basis step-up.  Wondering if we put the desired end-of-life estate at $200K*(1+growth)^(years remaining) if the program would never sell C?
* The actual output has two "spend" columns.  From your documentation it appears the first should be labeled "send"
* The SS question is complex enough on its own, particularly for a 2-earner couple, let alone within this larger framework.  Limiting the choices to ages 62, Full Retirement Age, and 70 for each person would require "only" 9 runs.  Using the heuristic that the higher earner should delay the longest could reduce that number.
* We have used the case study spreadsheet from this forum and it matches the SS anypia tool well for us.  You might be able to get some equations there.
* A linear equation for the annual pension amount as a function of starting year would be a good approximation to reality, so if that would fit well in your program....
* Splitting the "extra" column into its various components would, in our opinion, be well worth any added messiness.
* Does the tax calculation account for QD&LTCG, the AMT, and the NIIT?

Again - thank you!

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #19 on: March 05, 2017, 01:25:15 PM »
First, the program is somewhat aggressive. It doesn't ask, "How much do you need to live on?".  Instead, it says, assuming you will spend the same amount every year, what is the most that can be spent without running out.

Let me explain the output a tad.
The first year we have this:
Code: [Select]
age  save spend   IRA  fIRA  SEPP  Roth fRoth IRA2R  rate   tax spend extra
 57:  1250   310  1700     0     0    15     0   319    33   127   299  -115

(Yes I have two 'spend' columns which isn't that helpful. I never noticed.)

The first 2 columns are for the after-tax savings (which includes the 3 stocks) and spending from that. It has you withdrawing $310k from that money to live on.

Next is the $1.7M IRA and spending from that IRA (fIRA).  It is zero because you are less than 59.

SEPP is an experimental feature that is not enabled by default. It is income from setting up a 72(t) withdrawal from a portion of your IRA. The program rarely thinks that is a good idea and I am skeptical of that so I have it disabled.

Next, we have your Roth balance, money withdrawn from the Roth (fRoth) and money added to the Roth from the IRA via a Roth conversion (IRA2R). This is recommending $319k be converted the first year.

The 'extra' column is for extra expenses you will have this year.  I originally added this for paying off my mortgage and weddings for my daughters, places that are exceptions to the "all years are the same" idea. In this case, it is negative because you have outside income.

Now you will be taxed for $434k income (319+115) which puts you at the very top of the 33% tax bracket. That is basically what it is doing, it is managing your taxable income to keep you in the same tax bracket every year to avoid 40% years. So to answer your other questions, it has no idea about AMT. It assumes all investments are held over a year before selling and it knows nothing about qualified dividends. No NIIT either. ;-)


So the 'tax' column shows the expected tax paid for this year. $127k This is basically the simplistic CG model + income tax assuming the straight tax table after standard deductions.

The second 'spend' column is the amount of money available to spend after taxes. The idea is that it should be constant, but that isn't always true.


If you have spent more time calculating the other tax considerations,  I would be very interested in knowing which ones move things around the most and should be completed.

I also should write up a description of how this model works. It is very cool but has some serious limitations about what types of things I can model.

The solver takes N independent variables X(i) and can minimize the function sum(C(i)*X(i)) for some constants C(i), and I can add a pile of constraints that are linear functions using those variables.  In this case, the withdrawal from each account every year is a variable to be solved. For example, I have an equation that says the starting balance of each account, minus all withdrawals must be positive.  Or Roth withdrawals must come from deposits that happened at least 5 years previously.

In the case of the tax table, I have a separate inequality for each tax bracket and when you satisfy all of those inequalities, then you get the piecewise linear tax table.

So I can't model CG tax by looking at which money I am spending, but I could make them separate accounts.

On having an estate for your children my understanding is that a Roth account is what you really want because there all the taxes have been paid.  Notice that the capital gains taxes for those stocks are really much smaller than the income taxes for money out of your IRA. What the tool is doing is spending your after-tax money up front and using that to 'shield' your Roth conversions so you are not spending too much on taxes.  I could try to add a feature to add an estate at the end, but I would be surprised if that would select saving your stock to the end.  Note, adding a couple years to the simulation would be very similar to modeling an estate...


MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #20 on: March 05, 2017, 04:06:30 PM »
The first year we have this:
Code: [Select]
age  save spend   IRA  fIRA  SEPP  Roth fRoth IRA2R  rate   tax spend extra
 57:  1250   310  1700     0     0    15     0   319    33   127   299  -115
...
Now you will be taxed for $434k income (319+115) which puts you at the very top of the 33% tax bracket. That is basically what it is doing, it is managing your taxable income to keep you in the same tax bracket every year to avoid 40% years. So to answer your other questions, it has no idea about AMT. It assumes all investments are held over a year before selling and it knows nothing about qualified dividends. No NIIT either. ;-)
So the 'tax' column shows the expected tax paid for this year. $127k This is basically the simplistic CG model + income tax assuming the straight tax table after standard deductions.
Pretty cool!

Torbua12 might want to comment on specific details. 

From what I could glean:
a) The tax calculation looks pretty good.  I tried putting that first year into the case study spreadsheet and got the table below.  Don't get as much practice on this end of the tax code as on the saver's, earned income, etc., credits, but I think it's correct.  Combination of the Personal Exemption Phaseout, AMT, and NIIT makes the tax (at 2016 rates) $139K.
Filing Status21=S, 2=MFJ, 3=HOH
# Exemptions2
Adult #1Adult #2
Age5760
Total Income$534,440
Std. Deduct.$12,600
Act. Deduct.$12,600
Exemption$0
AGI$534,440
MAGI$534,440
Taxable$521,840
1040 Tax$132,447
AMT adder$3,158
Saver's credit$0
Tax after n-r credit$135,605
NIIT$3,817
EIC$0
Child Tax Cred.$0
Net Tax$139,421
Monthly$11,618
Item. Deduct.$0
VersionV8.13


Quote
On having an estate for your children my understanding is that a Roth account is what you really want because there all the taxes have been paid.  Notice that the capital gains taxes for those stocks are really much smaller than the income taxes for money out of your IRA. What the tool is doing is spending your after-tax money up front and using that to 'shield' your Roth conversions so you are not spending too much on taxes.
This is probably a tough one, because it seems one would need to know the heirs' tax rates to determine the cost of leaving money in a tIRA (on which the heirs would pay tax when distributed) vs. a taxable equity (on which there would be no tax if immediately withdrawn).

Quote
I could try to add a feature to add an estate at the end, but I would be surprised if that would select saving your stock to the end.  Note, adding a couple years to the simulation would be very similar to modeling an estate...
Torbua12 might provide a different perspective, but I can't imagine spending $299K/yr.  Determining the optimal strategy given a lower spending target (or a non-zero estate target) might be a more practical result.

In any case, thanks to you wscott for your work on this.  At the very least it can help people think things through when illuminated by light of the model.

Torbua12

  • 5 O'Clock Shadow
  • *
  • Posts: 4
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #21 on: March 05, 2017, 06:23:32 PM »
Thanks for the comments.  We do find ourselves looking at potential spending amounts far greater than we have ever done, and are so used to frugality that we can't imagine coming anywhere near those amounts.  Being able to specify a "spending target (or a non-zero estate target)" does seem useful.

Good for the kids and whatever charities we suppose, but then again "it ain't over 'til it's over" so we just don't want to do something stupid in the next 5-15 years.

Definitely something to think about regarding selling the stocks instead of retaining them. 

From what spreadsheet work we have done, it appears to be a relatively flat optimum, but "when to take the pension" is one question in which we are particularly interested.  E.g., that choice probably has a bigger impact than "when to take SS" due to the dollar amounts involved.  For SS, we'll probably go with "higher earner delays until age 70, while lower earner begins at FRA and switches to spousal benefit when higher earner starts taking."

Does the linear "pension amount vs. start date" relationship appear implementable?


wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #22 on: March 05, 2017, 08:04:22 PM »
From what spreadsheet work we have done, it appears to be a relatively flat optimum, but "when to take the pension" is one question in which we are particularly interested.  E.g., that choice probably has a bigger impact than "when to take SS" due to the dollar amounts involved.  For SS, we'll probably go with "higher earner delays until age 70, while lower earner begins at FRA and switches to spousal benefit when higher earner starts taking."

Having the pension amount be linear by year doesn't really change the problem so much. But in your case for the way I am phrasing the problem the answer is pretty obvious.  Having the pension start at age 65 at the maximum amount leads to the highest returns. I tried it manually and the results increase steadily.

BTW I also tried changing the assumed returns on investments.  If I assume only an average of 4% gain on investments with no inflation, it still has you having the ability to spend $270k/yr.


James Welch, the author of i-orp.com, is working on a paper on a retirement method using a program like this. It is basically re-running this program every year and recomputing your plan for the next year. This way spending is variable and potentially might go down after bad market years, but if you adjust your spending as you go then you will never "run out".  He simulated this approach over several historic periods from the last 100 years to see how it performs.  One interesting takeaway was that you want your spending to be flexible and keep your absolute barebones living requirements below 50% of the current projection. So in your case, if you can cut your spending back to $150k/yr then you can handle another great depression no problem.  And that 50% case was very unlikely.  It's a good paper, I will mention it when it gets published.

Torbua12

  • 5 O'Clock Shadow
  • *
  • Posts: 4
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #23 on: March 05, 2017, 09:35:45 PM »
Having the pension amount be linear by year doesn't really change the problem so much. But in your case for the way I am phrasing the problem the answer is pretty obvious.  Having the pension start at age 65 at the maximum amount leads to the highest returns. I tried it manually and the results increase steadily.
Thanks, that matches what we found also for the same longevity and investment return.  Increase investment returns and/or decrease longevity enough and taking it earlier becomes best.

Quote
...4% gain on investments with no inflation
Speaking of which: how do you distinguish between the flat pension vs. the COLA for SS?

Quote
...if you can cut your spending back to $150k/yr...
Fortunately, that's very funny.  It's more like "how/why would we ever spend even half that much?"

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #24 on: March 06, 2017, 05:27:42 AM »
Quote
Speaking of which: how do you distinguish between the flat pension vs. the COLA for SS?

If you look in the config file for your data the social security income is marked with 'inflation = true' to indicate that the amount goes up with inflation. For the pension, I didn't add that. However, since I never included inflation when I ran your results that didn't make a difference.

Here I reran your simulation with 6% returns and 2% inflation: https://gist.github.com/wscott/dba822ada41a2932c265431000845be4
Things look a bit different.  I find it hard to know exactly what should be used for those two, but this is more conservative.
People retiring at 40 can assume higher returns overall.  I want to run some studies over historic data using this tool and some sample situations and see if I can generate some reasonable rules of thumb.

One interesting point is that your pension was slightly better if you started at 64, and 63 was the same as 65.

Quote
Quote
...if you can cut your spending back to $150k/yr...
Fortunately, that's very funny.  It's more like "how/why would we ever spend even half that much?"

Cool, clearly you can live a bit more than you have been. The point was not that you should live on 50% (just in case), but that the future is uncertain and you should retain the ability to live on less in case it turns out to be needed. And projections like this will give a more reasonable feedback so you don't over-react to another financial crisis.

BTW, James' study also assumed a 100% stock portfolio so the 50% level is probably pessimistic.  This thread has provided me many possibly studies I can run in the future and content for a number of interesting blog posts in I want to go that direction.


Another possible direction is that it wouldn't be too hard to rearrange the tool to set a desired spending level and then give the predicted tax bracket of your children and have to tool maximize the net money they would receive at the end of the simulation.  This would be the same solver, with a new constraint (spending > X) and a different goal function.

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #25 on: March 06, 2017, 05:48:19 AM »
Quote
James Welch, the author of i-orp.com, is working on a paper on a retirement method using a program like this. It is basically re-running this program every year and recomputing your plan for the next year.

Seems he published this and I didn't notice.
He explains the idea and links to the paper here.
https://www.i-orp.com/help/ORPHelpQ.html#VWSyear

MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #26 on: March 10, 2017, 09:34:18 PM »
The first year we have this:
Code: [Select]
age  save spend   IRA  fIRA  SEPP  Roth fRoth IRA2R  rate   tax spend extra
 57:  1250   310  1700     0     0    15     0   319    33   127   299  -115
...
Now you will be taxed for $434k income (319+115) which puts you at the very top of the 33% tax bracket. That is basically what it is doing, it is managing your taxable income to keep you in the same tax bracket every year to avoid 40% years. So to answer your other questions, it has no idea about AMT. It assumes all investments are held over a year before selling and it knows nothing about qualified dividends. No NIIT either. ;-)
So the 'tax' column shows the expected tax paid for this year. $127k This is basically the simplistic CG model + income tax assuming the straight tax table after standard deductions.
Combination of the Personal Exemption Phaseout, AMT, and NIIT makes the tax (at 2016 rates) $139K.
Perhaps omitting the PEP, AMT, NIIT, and any other acronym tax effect that increases marginal rates is materially incorrect.

Ignoring those effects may be why i-orp and wscott's program don't mind front-loading Roth conversions so much: they may underestimate the tax bite from those high incomes.

The first chart below shows marginal rates when ignoring the PEP, AMT, and NIIT, and assuming all capital gains are taxed at 15%.

The second chart includes the PEP, AMT, and NIIT, and includes the 20% capital gains rate at higher incomes.

Doesn't reassure me that front-loading Roth conversions is correct....



« Last Edit: July 20, 2019, 08:17:39 AM by MDM »

wscott

  • 5 O'Clock Shadow
  • *
  • Posts: 20
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #27 on: March 11, 2017, 05:25:27 PM »
Quote
Ignoring those effects may be why i-orp and wscott's program don't mind front-loading Roth conversions so much: they may underestimate the tax bite from those high incomes.

The first chart below shows marginal rates when ignoring the PEP, AMT, and NIIT, and assuming all capital gains are taxed at 15%.

The second chart includes the PEP, AMT, and NIIT, and includes the 20% capital gains rate at higher incomes.

Doesn't reassure me that front-loading Roth conversions is correct....

Thanks for the reply and the reference to the case study spreadsheets with more accurate formula. I originally skipped the more detailed model of taxes because ORP claimed it wasn't possible to model those in a linear model. And this approach needs the linear formulas in order to be able to obtain an optimal solution. However looking at your graph makes me realize I should be able to generate a piecewise linearly continuously increasing formula for income->tax by sampling a complete formula at the different transitions. And that is good enough to model this way. So I will add improving the tax formula to my list of things with play with.

However, I suspect if I fix the taxes to be more accurate and charge more you will still not be unhappy with the early Roth conversions. They will go down, but not fundamentally.

The program generates an optimial solution to the question being asked for the situation modeled, but that model is not really how we thing about things.

First it assumes you will live to 95. It counts on the fact that if it sets up to save taxes in 20-30 years you will be around to take advantage of that. It also assumes you will spend the same amount of money in your 90s.  ORP has some other spending models you can try, but my program is still using the flat spending model.

Second, the program assumes it knows perfectly what the stock market will do in the future. Assuming a x% gain over 30 years is fairly reasonable, but for the next 5 years? Well that is anyones guess.

We are very focused on the next 5 years and very concerned about a recession in the short term messing up our plans, so I idea of spending a bunch on taxes up front feels wrong.  But is it?

To be honest, I am not sure. I want to do some studies where I reply time periods in the past and follow the advice of this program for all possible starting years and see if I can quantify the "regression rate". How much does the spending rate drop from the initial prediction for each starting year.  Then use that to generate a recommended predicted investment rate.

I also want to build a web app so other people can play without needing to be a hacker.

MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #28 on: March 11, 2017, 05:49:49 PM »
Thanks for the reply and the reference to the case study spreadsheets with more accurate formula. I originally skipped the more detailed model of taxes because ORP claimed it wasn't possible to model those in a linear model. And this approach needs the linear formulas in order to be able to obtain an optimal solution. However looking at your graph makes me realize I should be able to generate a piecewise linearly continuously increasing formula for income->tax by sampling a complete formula at the different transitions. And that is good enough to model this way. So I will add improving the tax formula to my list of things with play with.
Excellent!

IIRC, tax as a function of income will be continuous and piecewise linear once income is above certain breakpoints for the saver's and earned income credits.  As neither of those credits will occur along with large traditional->Roth conversions, that should not be a problem.

Quote
However, I suspect if I fix the taxes to be more accurate and charge more you will still not be unhappy with the early Roth conversions. They will go down, but not fundamentally.
More accurate is good, whatever the result.  The increased accuracy has a double benefit:
1) It's more accurate - duh.
2) Judging cumulative effects in one's head for 30+ years of income, taxes, etc. is difficult.  But looking at the first year's suggestion and comparing to a quick tax calculation isn't too hard.  If that comparison shows a good match, that helps the "trust factor".  Conversely, if the first year's tax is "significantly" (however one perceives that) off, then confidence in the rest of the model will be reduced.

Quote
The program generates....
All those comments and plans look good too!

MDM

  • Senior Mustachian
  • ********
  • Posts: 11473
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #29 on: March 11, 2017, 08:31:06 PM »

A couple of posts from bogleheads suggesting inaccurate tax calculations are a real problem (or at least perceived as one by others):
I don't think iorp has the logic built in to generate the 30% marginal rate and Anyone using i-orp as a guide for withdrawals? - Bogleheads.org

Cheddar Stacker

  • Magnum Stache
  • ******
  • Posts: 3700
  • Age: 45
  • Location: USA
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #30 on: March 11, 2017, 08:44:39 PM »
Very nice.  I've added your repo to my github watch list.

"I'm not familiar with about half the words in that sentence."

Rubic

  • Handlebar Stache
  • *****
  • Posts: 1130
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #31 on: March 12, 2017, 08:53:01 AM »
Very nice.  I've added your repo to my github watch list.

"I'm not familiar with about half the words in that sentence."

Explanation: wscott has published his code in a repository (repo) on the
github website: https://github.com/wscott/fplan

I've added it to my "watch list", which means I'll receive notifications when wscott
commits new changes to his code.

Simpli-Fi

  • Bristles
  • ***
  • Posts: 323
Re: Wrote a retirement calculator because i-orp.com didn't do what I want
« Reply #32 on: March 12, 2017, 02:55:10 PM »
Following with interest