Optimize Roth vs traditional contributions
optimize_retirement_contributionsFind the best yearly split of retirement savings between traditional and Roth 401(k), IRA/backdoor Roth, HSA and brokerage, including employer match, Roth conversions and retirement withdrawals. Returns this year's dollars per account, how the optimal mix compares with always-traditional and always-Roth, Roth share, lifetime totals, the first working years and retirement milestones. Runs in a few seconds (a few more with exact_income_limits). All money in today's dollars. Optimal for the stated assumptions; not tax advice. Call get_contribution_example first if unsure of the shape.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| age | Yes | Your age this year. The plan starts now. | |
| filing | No | Tax filing status. Default 'single'. 'married' = one joint return; fill in the spouse_* fields. | |
| salary | Yes | Your gross pay this year, in dollars. | |
| end_age | No | Plan until this age (default 92; horizon at most 90 years). | |
| accounts | No | Which accounts the user can use. Defaults: 401(k) and Roth 401(k) available, IRA allowed, no HSA, no match. | |
| balances | No | Current household balances, dollars. Omitted = 0. | |
| retire_age | Yes | Age you stop working. Must be above 'age'. | |
| assumptions | No | Modeling assumptions; the defaults are reported back. | |
| spouse_salary | No | Married only: spouse's gross pay this year (0 or omitted = spouse does not work). | |
| real_raise_pct | No | Yearly raise above inflation, whole percent (1 = 1%). Default 1. | |
| social_security | No | Expected Social Security (household). Omitted = none modeled. | |
| spouse_retire_age | No | Married only: the age YOU will be when your spouse stops working (all ages on this server are the primary earner's). Default = retire_age. | |
| children_birth_years | No | Birth years of dependent children (child tax credit, head of household). | |
| spending_in_retirement | Yes | Yearly spending after retiring, today's dollars (before income tax). | |
| spending_while_working | No | Yearly living costs while still working, today's dollars. Default = spending_in_retirement. |