wscott / fplan

Early retirement financial calculator
GNU General Public License v3.0
26 stars 6 forks source link

Add a secondary optimization goal of maximizing the money spent #18

Closed wscott closed 5 months ago

wscott commented 5 months ago

can be spend.

wscott commented 5 months ago

@hubcity I suggest making this change to your local tree and seeing how it changes your results. It made a huge difference here greatly reducing the total taxes spent.

hubcity commented 5 months ago

I don't like this change for two reasons.

First, I don't think it calculates what you say it calculates. (Please excuse the following. I'm absolutely sure you already know all of it, but I need to write it down so that I'll remember it the next time I think about this.) The scipy linear programming solver tries to minimize things so when we want to maximize something we have to multiply by -1. That's why we have

    c[0] = -1

when we try to maximize the spending floor.

You have added

    for year in range(S.numyr):
        c[n1+year*vper+0] = 1.0 / S.numyr / 10
        c[n1+year*vper+1] = 1.0 / S.numyr / 10
        c[n1+year*vper+2] = 1.0 / S.numyr / 10

so the scipy solver is going to try to minimize these. This is going to give you a solution that minimizes total withdrawals (and as a side effect minimizes taxes), but it doesn't actually give you any more spending money. At the end of the day you have still spent the same amount every year, you have just structured your withdrawals so that the government gets paid less. I don't think this gains you anything. So instead of focusing on "total tax", we should be focusing on "total spending". I've tried a few things, but I haven't found anything that reliably made a difference. I'll keep thinking about it.

Second, you have not included inflation in this calculation which makes me suspect it may favor taking actions in later years because that is when the numbers are bigger.

wscott commented 5 months ago

Thanks!

I understand the confusing sign of those terms. My first version had -1.0 for all of these, but I didn't like the results and the reverse seemed better. I incorrectly convinced myself the 'spending' variables were negative. Regardless the default optimization already reduces taxes for the most part, so this change doesn't do much and I reverted it.

If you really want to see it acting badly try someone retiring at 30 with a $4M 401k. If you use the -1.0 version to maximize spending it decides they should be homeless for 70 years and then have $200M in a Roth.