@retiregolden/planner-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +181 -0
- package/package.json +77 -0
- package/src/App.tsx +246 -0
- package/src/RouteErrorBoundary.tsx +45 -0
- package/src/assets/hero.png +0 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/vite.svg +1 -0
- package/src/data/fedInvestClient.ts +113 -0
- package/src/data/localStore.ts +42 -0
- package/src/data/planOrigin.ts +24 -0
- package/src/data/planStore.ts +165 -0
- package/src/data/v2Backup.ts +101 -0
- package/src/import/ImportPage.tsx +347 -0
- package/src/import/ReviewChecklistView.tsx +38 -0
- package/src/import/brokerCsv.ts +395 -0
- package/src/import/csv.ts +133 -0
- package/src/import/genericCsv.ts +224 -0
- package/src/import/projectionLab.ts +350 -0
- package/src/import/reviewChecklist.ts +33 -0
- package/src/import/tenForty.ts +275 -0
- package/src/index.css +630 -0
- package/src/index.ts +16 -0
- package/src/learn/ArticleBody.tsx +78 -0
- package/src/learn/ArticlePage.tsx +57 -0
- package/src/learn/GlossaryPage.tsx +33 -0
- package/src/learn/LearnAboutScreen.tsx +41 -0
- package/src/learn/LearnCards.tsx +41 -0
- package/src/learn/LearnLink.tsx +91 -0
- package/src/learn/LearningCenterPage.tsx +114 -0
- package/src/learn/SourcesPage.tsx +98 -0
- package/src/learn/components/ArticleFigure.tsx +34 -0
- package/src/learn/components/ArticleShell.tsx +86 -0
- package/src/learn/components/ComparisonTable.tsx +42 -0
- package/src/learn/components/FormulaBlock.tsx +34 -0
- package/src/learn/components/PurchasingPowerChart.tsx +41 -0
- package/src/learn/components/RelatedArticles.tsx +27 -0
- package/src/learn/components/ScenarioCard.tsx +24 -0
- package/src/learn/components/SourceList.tsx +23 -0
- package/src/learn/components/charts.tsx +21 -0
- package/src/learn/content/about-retiregolden.ts +100 -0
- package/src/learn/content/aca-premium-tax-credits-and-magi.ts +103 -0
- package/src/learn/content/account-types-overview.ts +106 -0
- package/src/learn/content/after-tax-estate.ts +111 -0
- package/src/learn/content/agi-magi-and-taxable-income.ts +112 -0
- package/src/learn/content/appealing-irmaa-ssa-44.ts +95 -0
- package/src/learn/content/assumption-general-inflation.ts +82 -0
- package/src/learn/content/assumption-healthcare-inflation.ts +85 -0
- package/src/learn/content/assumption-heir-tax-rate.ts +79 -0
- package/src/learn/content/assumption-investment-returns.ts +90 -0
- package/src/learn/content/assumption-longevity-planning-age.ts +78 -0
- package/src/learn/content/assumption-recent-magi.ts +83 -0
- package/src/learn/content/assumption-social-security-cola.ts +89 -0
- package/src/learn/content/assumption-social-security-trust-fund.ts +83 -0
- package/src/learn/content/assumption-state-tax-override.ts +79 -0
- package/src/learn/content/beneficiaries-and-account-titling.ts +99 -0
- package/src/learn/content/break-even-useful-lens.ts +94 -0
- package/src/learn/content/building-a-retirement-spending-budget.ts +100 -0
- package/src/learn/content/cola-and-inflation-protection.ts +102 -0
- package/src/learn/content/divorced-spousal-and-survivor-records.ts +104 -0
- package/src/learn/content/dynamic-spending-guardrails.ts +90 -0
- package/src/learn/content/earnings-test-before-fra.ts +100 -0
- package/src/learn/content/employer-match-and-contribution-order.ts +104 -0
- package/src/learn/content/examplePlanArticles.ts +525 -0
- package/src/learn/content/fees-expense-ratios-and-compounding-drag.ts +98 -0
- package/src/learn/content/fi-number-and-four-percent-rule.ts +64 -0
- package/src/learn/content/filling-a-tax-bracket-with-roth-conversions.ts +98 -0
- package/src/learn/content/funded-ratio.ts +70 -0
- package/src/learn/content/healthcare-after-65.ts +103 -0
- package/src/learn/content/healthcare-before-65.ts +104 -0
- package/src/learn/content/historical-vs-random-return-models.ts +101 -0
- package/src/learn/content/how-assumptions-change-the-answer.ts +105 -0
- package/src/learn/content/how-much-can-i-spend.ts +105 -0
- package/src/learn/content/how-social-security-is-taxed.ts +95 -0
- package/src/learn/content/how-the-optimizer-thinks.ts +102 -0
- package/src/learn/content/how-the-optimizer-values-after-tax-estate.ts +97 -0
- package/src/learn/content/how-to-model-accumulation.ts +67 -0
- package/src/learn/content/how-to-read-a-retirement-projection.ts +115 -0
- package/src/learn/content/hsas-and-qualified-medical-expenses.ts +108 -0
- package/src/learn/content/hsas-as-retirement-accounts.ts +101 -0
- package/src/learn/content/inflation-risk.ts +98 -0
- package/src/learn/content/inherited-ira-10-year-rule.ts +105 -0
- package/src/learn/content/insurance-in-your-retirement-plan.ts +103 -0
- package/src/learn/content/irmaa-two-year-lookback.ts +99 -0
- package/src/learn/content/long-term-care-costs-and-insurance.ts +103 -0
- package/src/learn/content/long-term-care-insurance-as-risk-transfer.ts +98 -0
- package/src/learn/content/longevity-risk.ts +99 -0
- package/src/learn/content/marginal-vs-effective-tax-rate.ts +98 -0
- package/src/learn/content/medicare-part-b-vs-part-d-irmaa.ts +102 -0
- package/src/learn/content/mortality-weighted-social-security.ts +113 -0
- package/src/learn/content/moving-to-retiregolden.ts +86 -0
- package/src/learn/content/niit-high-income-investment-tax.ts +98 -0
- package/src/learn/content/ordinary-income-vs-capital-gains.ts +103 -0
- package/src/learn/content/paying-conversion-taxes-taxable-vs-ira.ts +102 -0
- package/src/learn/content/pensions-and-annuities.ts +101 -0
- package/src/learn/content/permanent-life-insurance-in-a-plan.ts +106 -0
- package/src/learn/content/pia-aime-and-bend-points.ts +103 -0
- package/src/learn/content/planner-overview.ts +106 -0
- package/src/learn/content/planning-for-couples-and-survivor-years.ts +108 -0
- package/src/learn/content/privacy-what-stays-in-your-browser.ts +99 -0
- package/src/learn/content/qcds-qualified-charitable-distributions.ts +101 -0
- package/src/learn/content/reading-the-results-page.ts +96 -0
- package/src/learn/content/reading-the-social-security-analysis-page.ts +106 -0
- package/src/learn/content/real-estate-home-equity-and-debt.ts +100 -0
- package/src/learn/content/reports-csv-exports-and-sharing.ts +101 -0
- package/src/learn/content/risk-based-guardrails.ts +100 -0
- package/src/learn/content/rmds-required-minimum-distributions.ts +100 -0
- package/src/learn/content/roth-conversion-basics.ts +104 -0
- package/src/learn/content/rsus-and-espp.ts +101 -0
- package/src/learn/content/rule-of-55-and-72t.ts +107 -0
- package/src/learn/content/savings-rate-biggest-lever.ts +66 -0
- package/src/learn/content/seed-your-plan-from-your-tax-return.ts +93 -0
- package/src/learn/content/sensitivity-testing-what-changes-the-answer.ts +104 -0
- package/src/learn/content/sequence-of-returns-risk.ts +98 -0
- package/src/learn/content/social-security-bridge.ts +67 -0
- package/src/learn/content/social-security-claiming-age-basics.ts +113 -0
- package/src/learn/content/social-security-taxes-vs-benefits.ts +76 -0
- package/src/learn/content/spending-profiles-and-the-retirement-smile.ts +92 -0
- package/src/learn/content/spousal-and-survivor-benefits.ts +120 -0
- package/src/learn/content/ssdi-and-retirement-planning.ts +72 -0
- package/src/learn/content/standard-deduction-senior-deduction-and-itemizing.ts +97 -0
- package/src/learn/content/state-income-taxes-in-retirement.ts +97 -0
- package/src/learn/content/step-up-in-basis.ts +102 -0
- package/src/learn/content/survivor-planning-for-couples.ts +110 -0
- package/src/learn/content/survivor-spending-in-couple-plans.ts +98 -0
- package/src/learn/content/tax-cliffs-and-bracket-edges.ts +105 -0
- package/src/learn/content/tax-loss-and-gain-harvesting.ts +99 -0
- package/src/learn/content/taxable-brokerage-basis-and-capital-gains.ts +99 -0
- package/src/learn/content/three-big-questions-spending-time-risk.ts +103 -0
- package/src/learn/content/tips-ladders.ts +92 -0
- package/src/learn/content/todays-dollars-vs-future-dollars.ts +107 -0
- package/src/learn/content/traditional-vs-roth-contributions.ts +113 -0
- package/src/learn/content/troubleshooting-surprising-results.ts +105 -0
- package/src/learn/content/trust-fund-haircut-scenarios.ts +101 -0
- package/src/learn/content/understanding-monte-carlo-success-rate.ts +118 -0
- package/src/learn/content/understanding-your-plan-assumptions.ts +134 -0
- package/src/learn/content/using-assumptions-and-provenance.ts +98 -0
- package/src/learn/content/using-scenarios-to-compare-choices.ts +99 -0
- package/src/learn/content/what-changes-when-you-move-states.ts +141 -0
- package/src/learn/content/what-is-fire.ts +65 -0
- package/src/learn/content/what-monte-carlo-proves.ts +98 -0
- package/src/learn/content/what-retiregolden-models.ts +103 -0
- package/src/learn/content/what-retirement-healthcare-really-costs.ts +117 -0
- package/src/learn/content/why-95-percent-is-not-a-guarantee.ts +98 -0
- package/src/learn/content/why-roth-conversions-raise-other-costs.ts +106 -0
- package/src/learn/content/why-small-tax-cliffs-can-matter.ts +109 -0
- package/src/learn/content/widows-penalty-and-survivor-brackets.ts +106 -0
- package/src/learn/content/withdrawal-order-basics.ts +105 -0
- package/src/learn/glossary.ts +191 -0
- package/src/learn/inlineMarkdown.tsx +54 -0
- package/src/learn/learn.css +537 -0
- package/src/learn/learningRegistry.ts +502 -0
- package/src/longevity/LongevityResults.tsx +85 -0
- package/src/longevity/LongevityWizard.tsx +305 -0
- package/src/longevity/constants.ts +15 -0
- package/src/longevity/factors.ts +125 -0
- package/src/longevity/model.ts +31 -0
- package/src/longevity/persistedGuard.ts +129 -0
- package/src/longevity/storage.ts +40 -0
- package/src/mc/messages.ts +118 -0
- package/src/mc/monteCarlo.worker.ts +44 -0
- package/src/mc/pool.ts +267 -0
- package/src/mc/runRequest.ts +125 -0
- package/src/optimize/messages.ts +84 -0
- package/src/optimize/optimize.worker.ts +29 -0
- package/src/optimize/runOptimize.ts +92 -0
- package/src/optimize/runSpendingSolve.ts +47 -0
- package/src/optimize/runner.ts +21 -0
- package/src/optimize/spendingMessages.ts +44 -0
- package/src/optimize/spendingRunner.ts +21 -0
- package/src/optimize/spendingSolve.worker.ts +18 -0
- package/src/planner/AssumptionsCardPage.tsx +136 -0
- package/src/planner/BucketLensCard.tsx +114 -0
- package/src/planner/ComparePlansPage.tsx +219 -0
- package/src/planner/DisclaimerPage.tsx +88 -0
- package/src/planner/HowTestedPage.tsx +159 -0
- package/src/planner/LiveStatus.tsx +15 -0
- package/src/planner/LongevityModal.tsx +55 -0
- package/src/planner/Modal.tsx +97 -0
- package/src/planner/MonteCarloPage.tsx +907 -0
- package/src/planner/OptimizePage.tsx +611 -0
- package/src/planner/PlanContext.tsx +198 -0
- package/src/planner/PlanPickerPage.tsx +124 -0
- package/src/planner/PlanWorkspace.tsx +290 -0
- package/src/planner/ProvenancePanel.tsx +45 -0
- package/src/planner/RelocationComparePage.tsx +485 -0
- package/src/planner/ReportPage.tsx +375 -0
- package/src/planner/ResultsPage.tsx +817 -0
- package/src/planner/ScenariosPage.tsx +285 -0
- package/src/planner/SocialSecuritySection.tsx +556 -0
- package/src/planner/SpendingSolverPage.tsx +512 -0
- package/src/planner/SsAnalysisPage.tsx +1134 -0
- package/src/planner/SurvivalPercentileModal.tsx +161 -0
- package/src/planner/SurvivorTransitionPage.tsx +286 -0
- package/src/planner/assumptionsExport.ts +371 -0
- package/src/planner/bucketLens.ts +89 -0
- package/src/planner/chartFrame.ts +8 -0
- package/src/planner/chartStyle.ts +11 -0
- package/src/planner/dialogViews.tsx +184 -0
- package/src/planner/dialogs.tsx +133 -0
- package/src/planner/examples/ExampleLibrary.tsx +189 -0
- package/src/planner/examples/ExamplePreviewBanner.tsx +55 -0
- package/src/planner/examples/ExamplesPage.tsx +25 -0
- package/src/planner/examples/OpenExampleButton.tsx +61 -0
- package/src/planner/examples/buildAggressiveSaver.ts +102 -0
- package/src/planner/examples/buildAnnuityEstate.ts +137 -0
- package/src/planner/examples/buildBaristaFire.ts +115 -0
- package/src/planner/examples/buildBracketFillRoth.ts +65 -0
- package/src/planner/examples/buildBridgeEarlyRetirement.ts +94 -0
- package/src/planner/examples/buildBrokerageNoHsa.ts +109 -0
- package/src/planner/examples/buildCoastFire.ts +88 -0
- package/src/planner/examples/buildContext.ts +20 -0
- package/src/planner/examples/buildEarlyCareerMatch.ts +93 -0
- package/src/planner/examples/buildEarlyRetireeAca.ts +61 -0
- package/src/planner/examples/buildExampleCouple.ts +103 -0
- package/src/planner/examples/buildFixedTargetSpending.ts +74 -0
- package/src/planner/examples/buildGlidepathAllocation.ts +131 -0
- package/src/planner/examples/buildGuardrailsFlex.ts +120 -0
- package/src/planner/examples/buildHsaPropertyDepth.ts +109 -0
- package/src/planner/examples/buildHsaStealthRetirement.ts +97 -0
- package/src/planner/examples/buildLeanFatFire.ts +109 -0
- package/src/planner/examples/buildLtcShock.ts +62 -0
- package/src/planner/examples/buildMovingStateTax.ts +53 -0
- package/src/planner/examples/buildNoAnnuityBrokerage.ts +92 -0
- package/src/planner/examples/buildRmdIrmaa.ts +55 -0
- package/src/planner/examples/buildSalaryGrowthEscalation.ts +96 -0
- package/src/planner/examples/buildStaticAllocationControl.ts +96 -0
- package/src/planner/examples/buildSurvivorYears.ts +62 -0
- package/src/planner/examples/buildUnderSavedSingle.ts +51 -0
- package/src/planner/examples/exampleCopy.ts +23 -0
- package/src/planner/examples/loadExample.ts +90 -0
- package/src/planner/examples/registry.ts +313 -0
- package/src/planner/explainPanels.tsx +233 -0
- package/src/planner/fields.tsx +381 -0
- package/src/planner/format.ts +33 -0
- package/src/planner/home/DataAndPrivacyCard.tsx +56 -0
- package/src/planner/home/GettingStartedPaths.tsx +46 -0
- package/src/planner/home/GettingStartedReopener.tsx +32 -0
- package/src/planner/home/StartHereLinks.tsx +22 -0
- package/src/planner/home/WelcomeHero.tsx +39 -0
- package/src/planner/home/YourPlans.tsx +72 -0
- package/src/planner/home/importErrorMessage.ts +22 -0
- package/src/planner/home/startHereSlugs.ts +7 -0
- package/src/planner/home/useHomeData.ts +190 -0
- package/src/planner/home/useHomeMode.ts +47 -0
- package/src/planner/householdActions.ts +22 -0
- package/src/planner/insights/InsightCardView.tsx +340 -0
- package/src/planner/insights/InsightsPage.tsx +204 -0
- package/src/planner/insights/categoryLabels.ts +11 -0
- package/src/planner/learnLinks.ts +85 -0
- package/src/planner/marketModelPicker.ts +172 -0
- package/src/planner/optimizePageChart.ts +40 -0
- package/src/planner/optimizePageClaim.ts +64 -0
- package/src/planner/planCompleteness.ts +27 -0
- package/src/planner/planContextCore.ts +26 -0
- package/src/planner/planner.css +2304 -0
- package/src/planner/provenanceLinks.ts +25 -0
- package/src/planner/sections/AccountFields.tsx +872 -0
- package/src/planner/sections/AccountsSection.tsx +89 -0
- package/src/planner/sections/AllocationPanel.tsx +261 -0
- package/src/planner/sections/AssumptionsSection.tsx +256 -0
- package/src/planner/sections/HouseholdSection.tsx +243 -0
- package/src/planner/sections/IncomeFloorSection.tsx +418 -0
- package/src/planner/sections/IncomeSection.tsx +170 -0
- package/src/planner/sections/InsuranceSection.tsx +362 -0
- package/src/planner/sections/SpendingSection.tsx +904 -0
- package/src/planner/sections/StrategySection.tsx +349 -0
- package/src/planner/sections/UpdateBalancesPanel.tsx +182 -0
- package/src/planner/sections/sectionHelpers.ts +48 -0
- package/src/planner/sections/shared.tsx +15 -0
- package/src/planner/sections.tsx +15 -0
- package/src/planner/ssAnalysis.ts +325 -0
- package/src/planner/successBand.ts +20 -0
- package/src/planner/survivorAnalysis.ts +277 -0
- package/src/planner/usStates.ts +19 -0
- package/src/planner/useMcSuccessRate.ts +77 -0
- package/src/planner/useProjection.ts +63 -0
- package/src/relocation/messages.ts +21 -0
- package/src/relocation/relocation.worker.ts +18 -0
- package/src/relocation/runRelocation.ts +17 -0
- package/src/relocation/runner.ts +22 -0
- package/src/report/brandingContext.ts +15 -0
- package/src/report/downloadReport.ts +34 -0
- package/src/report/reportHtml.ts +547 -0
- package/src/routes/LearnRoutes.tsx +46 -0
- package/src/routes/PlanRoutes.tsx +55 -0
- package/src/routes/RouteFallback.tsx +9 -0
- package/src/socialSecurity/breakEven.ts +107 -0
- package/src/socialSecurity/expectedPv.ts +164 -0
- package/src/socialSecurity/explain.ts +92 -0
- package/src/socialSecurity/ficaReturn.ts +81 -0
- package/src/socialSecurity/persistedSsGuard.ts +138 -0
- package/src/socialSecurity/ssFormUtils.ts +48 -0
- package/src/socialSecurity/ssaStatementXml.ts +156 -0
- package/src/socialSecurity/storage.ts +69 -0
- package/src/socialSecurity/survivorSwitching.ts +153 -0
- package/src/testSupport/samplePlan.ts +2 -0
- package/src/workers/run.ts +45 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** HSA medical sub-ledger + fixed asset (property) tax depth + nondeductible basis.
|
|
2
|
+
* Positive modeling of qualified medical caps + reimburse-later, §121 primary residence
|
|
3
|
+
* sale with basis/exclusion/recapture, and pro-rata on IRA conversions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
7
|
+
import { EXAMPLE_FIXED_YEAR, exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
8
|
+
|
|
9
|
+
const EXAMPLE_ID = 'hsa-property-depth'
|
|
10
|
+
|
|
11
|
+
export function buildHsaPropertyDepth(): Plan {
|
|
12
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
13
|
+
const plan = createEmptyPlan({ name: 'HSA medical + home sale depth', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
14
|
+
|
|
15
|
+
plan.household = {
|
|
16
|
+
filingStatus: 'single',
|
|
17
|
+
hasQualifyingDependent: false,
|
|
18
|
+
state: 'TX',
|
|
19
|
+
stateMoves: [],
|
|
20
|
+
capitalLossCarryforward: 0,
|
|
21
|
+
people: [
|
|
22
|
+
{ id: p1, name: 'Harper', dob: '1964-02-28', sex: 'female', retirementAge: 61, longevity: { planningAge: 89, source: 'manual' } },
|
|
23
|
+
],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
plan.accounts = [
|
|
27
|
+
{
|
|
28
|
+
type: 'hsa',
|
|
29
|
+
id: exampleEntityId(EXAMPLE_ID, 'hsa'),
|
|
30
|
+
name: 'HSA (cap + reimburse)',
|
|
31
|
+
ownerPersonId: p1,
|
|
32
|
+
annualReturnPct: 5.5,
|
|
33
|
+
balance: 48_000,
|
|
34
|
+
annualContribution: 4150,
|
|
35
|
+
contributionSchedule: [{ annualAmount: 4150, fromAge: 61, toAge: 65, escalationPct: 0 }],
|
|
36
|
+
withdrawalTreatment: 'capByMedicalExpenses',
|
|
37
|
+
reimburseLater: true,
|
|
38
|
+
// estateBeneficiary inherited default ok
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'traditional',
|
|
42
|
+
id: exampleEntityId(EXAMPLE_ID, 'tira'),
|
|
43
|
+
name: 'Traditional IRA (mixed basis)',
|
|
44
|
+
ownerPersonId: p1,
|
|
45
|
+
annualReturnPct: null,
|
|
46
|
+
kind: 'ira',
|
|
47
|
+
balance: 310_000,
|
|
48
|
+
nondeductibleBasis: 68000, // triggers pro-rata
|
|
49
|
+
annualContribution: 0,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'property',
|
|
53
|
+
id: exampleEntityId(EXAMPLE_ID, 'home'),
|
|
54
|
+
name: 'Primary residence',
|
|
55
|
+
ownerPersonId: null,
|
|
56
|
+
annualReturnPct: null,
|
|
57
|
+
value: 385_000,
|
|
58
|
+
plannedSaleYear: EXAMPLE_FIXED_YEAR + 7,
|
|
59
|
+
expectedNetProceeds: null, // using costBasis path for exact tax treatment
|
|
60
|
+
costBasis: 172_000,
|
|
61
|
+
sellingCostPct: 6,
|
|
62
|
+
primaryResidence: true,
|
|
63
|
+
depreciationRecapture: 12000, // small recapture example
|
|
64
|
+
propertyTaxAnnual: 4800,
|
|
65
|
+
insuranceAnnual: 2100,
|
|
66
|
+
},
|
|
67
|
+
{ type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Cash', ownerPersonId: null, annualReturnPct: 1.8, balance: 62_000, annualContribution: 0 },
|
|
68
|
+
{ type: 'roth', id: exampleEntityId(EXAMPLE_ID, 'roth'), name: 'Roth IRA', ownerPersonId: p1, annualReturnPct: null, kind: 'ira', balance: 20_000, annualContribution: 0 },
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
// Care + healthcare drive the medical cap for HSA
|
|
72
|
+
plan.careEvents = [
|
|
73
|
+
{ id: exampleEntityId(EXAMPLE_ID, 'care'), personId: p1, startAge: 82, durationYears: 2, annualCost: 72000 },
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
plan.expenses = {
|
|
77
|
+
baseAnnual: 51_000,
|
|
78
|
+
phases: [],
|
|
79
|
+
oneTimeGoals: [],
|
|
80
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 690, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 165 },
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
plan.incomes = [
|
|
84
|
+
{ type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss'), personId: p1, piaMonthly: 1720, earnings: null, claimAge: { years: 67, months: 0 } },
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
plan.strategies = {
|
|
88
|
+
withdrawalOrder: { mode: 'sequential' },
|
|
89
|
+
rothConversion: { mode: 'fillToTarget', target: 'topOfBracket', targetValue: 24, startYear: EXAMPLE_FIXED_YEAR + 3, endYear: EXAMPLE_FIXED_YEAR + 11 },
|
|
90
|
+
qcdAnnual: 0,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
plan.assumptions = {
|
|
94
|
+
inflationPct: 2.6,
|
|
95
|
+
healthcareExtraInflationPct: 3.4,
|
|
96
|
+
defaultReturnPct: 4.9,
|
|
97
|
+
ssCola: { mode: 'matchInflation' },
|
|
98
|
+
ssHaircut: null,
|
|
99
|
+
stateEffectiveTaxPct: 0,
|
|
100
|
+
localIncomeTaxPct: 0,
|
|
101
|
+
recentAnnualMagi: 42000,
|
|
102
|
+
heirTaxRatePct: 22,
|
|
103
|
+
safeWithdrawalRatePct: 3.6,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const parsed = parsePlan(plan)
|
|
107
|
+
if (!parsed.ok) throw new Error(`hsa-property-depth invalid: ${parsed.issues.join('; ')}`)
|
|
108
|
+
return parsed.plan
|
|
109
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
2
|
+
import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
3
|
+
|
|
4
|
+
const EXAMPLE_ID = 'hsa-stealth-retirement'
|
|
5
|
+
|
|
6
|
+
export function buildHsaStealthRetirement(): Plan {
|
|
7
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
8
|
+
const plan = createEmptyPlan({ name: 'HSA stealth retirement', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
9
|
+
plan.household = {
|
|
10
|
+
filingStatus: 'single',
|
|
11
|
+
hasQualifyingDependent: false,
|
|
12
|
+
state: 'CA',
|
|
13
|
+
stateMoves: [],
|
|
14
|
+
capitalLossCarryforward: 0,
|
|
15
|
+
people: [
|
|
16
|
+
{ id: p1, name: 'Chris', dob: '1986-01-01', sex: 'average', retirementAge: 50, longevity: { planningAge: 90, source: 'manual' } },
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
plan.accounts = [
|
|
20
|
+
{
|
|
21
|
+
type: 'hsa',
|
|
22
|
+
id: exampleEntityId(EXAMPLE_ID, 'hsa'),
|
|
23
|
+
name: 'Stealth HSA',
|
|
24
|
+
ownerPersonId: p1,
|
|
25
|
+
annualReturnPct: 7.5,
|
|
26
|
+
balance: 25_000,
|
|
27
|
+
annualContribution: 4_400,
|
|
28
|
+
contributionSchedule: [
|
|
29
|
+
{
|
|
30
|
+
annualAmount: 4_400,
|
|
31
|
+
fromAge: null,
|
|
32
|
+
toAge: 50,
|
|
33
|
+
escalationPct: 2,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'traditional',
|
|
39
|
+
id: exampleEntityId(EXAMPLE_ID, 'traditional-401k'),
|
|
40
|
+
name: 'Employer 401(k)',
|
|
41
|
+
ownerPersonId: p1,
|
|
42
|
+
annualReturnPct: 7.5,
|
|
43
|
+
kind: 'employer',
|
|
44
|
+
balance: 180_000,
|
|
45
|
+
annualContribution: 23_000,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'taxable',
|
|
49
|
+
id: exampleEntityId(EXAMPLE_ID, 'brokerage'),
|
|
50
|
+
name: 'Taxable Brokerage',
|
|
51
|
+
ownerPersonId: null,
|
|
52
|
+
annualReturnPct: 7,
|
|
53
|
+
balance: 100_000,
|
|
54
|
+
costBasis: 75_000,
|
|
55
|
+
annualContribution: 5_000,
|
|
56
|
+
},
|
|
57
|
+
]
|
|
58
|
+
plan.incomes = [
|
|
59
|
+
{
|
|
60
|
+
type: 'wages',
|
|
61
|
+
id: exampleEntityId(EXAMPLE_ID, 'wages'),
|
|
62
|
+
personId: p1,
|
|
63
|
+
annualGross: 110_000,
|
|
64
|
+
endAge: 50,
|
|
65
|
+
realGrowthPct: 3,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'socialSecurity',
|
|
69
|
+
id: exampleEntityId(EXAMPLE_ID, 'ss'),
|
|
70
|
+
personId: p1,
|
|
71
|
+
piaMonthly: 2_700,
|
|
72
|
+
earnings: null,
|
|
73
|
+
claimAge: { years: 67, months: 0 },
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
plan.expenses = {
|
|
77
|
+
baseAnnual: 50_000,
|
|
78
|
+
phases: [],
|
|
79
|
+
oneTimeGoals: [],
|
|
80
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 450, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 180 },
|
|
81
|
+
}
|
|
82
|
+
plan.assumptions = {
|
|
83
|
+
inflationPct: 2.5,
|
|
84
|
+
healthcareExtraInflationPct: 2,
|
|
85
|
+
defaultReturnPct: 6,
|
|
86
|
+
ssCola: { mode: 'matchInflation' },
|
|
87
|
+
ssHaircut: null,
|
|
88
|
+
stateEffectiveTaxPct: 0,
|
|
89
|
+
localIncomeTaxPct: 0,
|
|
90
|
+
recentAnnualMagi: 110_000,
|
|
91
|
+
heirTaxRatePct: 25,
|
|
92
|
+
safeWithdrawalRatePct: 4,
|
|
93
|
+
}
|
|
94
|
+
const parsed = parsePlan(plan)
|
|
95
|
+
if (!parsed.ok) throw new Error(`hsa-stealth-retirement invalid: ${parsed.issues.join('; ')}`)
|
|
96
|
+
return parsed.plan
|
|
97
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
2
|
+
import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
3
|
+
|
|
4
|
+
const EXAMPLE_ID = 'lean-fat-fire'
|
|
5
|
+
|
|
6
|
+
export function buildLeanFatFire(): Plan {
|
|
7
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
8
|
+
const plan = createEmptyPlan({ name: 'Lean vs Fat FIRE', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
9
|
+
plan.household = {
|
|
10
|
+
filingStatus: 'single',
|
|
11
|
+
hasQualifyingDependent: false,
|
|
12
|
+
state: 'TX',
|
|
13
|
+
stateMoves: [],
|
|
14
|
+
capitalLossCarryforward: 0,
|
|
15
|
+
people: [
|
|
16
|
+
{ id: p1, name: 'Jessie', dob: '1991-01-01', sex: 'average', retirementAge: 45, longevity: { planningAge: 95, source: 'manual' } },
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
plan.accounts = [
|
|
20
|
+
{
|
|
21
|
+
type: 'traditional',
|
|
22
|
+
id: exampleEntityId(EXAMPLE_ID, 'pretax-401k'),
|
|
23
|
+
name: 'Pre-tax 401(k)',
|
|
24
|
+
ownerPersonId: p1,
|
|
25
|
+
annualReturnPct: 7.5,
|
|
26
|
+
kind: 'employer',
|
|
27
|
+
balance: 200_000,
|
|
28
|
+
annualContribution: 23_000,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'roth',
|
|
32
|
+
id: exampleEntityId(EXAMPLE_ID, 'roth-ira'),
|
|
33
|
+
name: 'Roth IRA',
|
|
34
|
+
ownerPersonId: p1,
|
|
35
|
+
annualReturnPct: 7.5,
|
|
36
|
+
kind: 'ira',
|
|
37
|
+
balance: 80_000,
|
|
38
|
+
annualContribution: 7_000,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'taxable',
|
|
42
|
+
id: exampleEntityId(EXAMPLE_ID, 'taxable-brokerage'),
|
|
43
|
+
name: 'Taxable Brokerage',
|
|
44
|
+
ownerPersonId: null,
|
|
45
|
+
annualReturnPct: 7,
|
|
46
|
+
balance: 300_000,
|
|
47
|
+
costBasis: 220_000,
|
|
48
|
+
annualContribution: 20_000,
|
|
49
|
+
contributionSchedule: [
|
|
50
|
+
{
|
|
51
|
+
annualAmount: 20_000,
|
|
52
|
+
fromAge: null,
|
|
53
|
+
toAge: 45,
|
|
54
|
+
escalationPct: 0,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
plan.incomes = [
|
|
60
|
+
{
|
|
61
|
+
type: 'wages',
|
|
62
|
+
id: exampleEntityId(EXAMPLE_ID, 'wages'),
|
|
63
|
+
personId: p1,
|
|
64
|
+
annualGross: 135_000,
|
|
65
|
+
endAge: 45,
|
|
66
|
+
realGrowthPct: 3,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'socialSecurity',
|
|
70
|
+
id: exampleEntityId(EXAMPLE_ID, 'ss'),
|
|
71
|
+
personId: p1,
|
|
72
|
+
piaMonthly: 2_800,
|
|
73
|
+
earnings: null,
|
|
74
|
+
claimAge: { years: 67, months: 0 },
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
plan.expenses = {
|
|
78
|
+
baseAnnual: 45_000,
|
|
79
|
+
phases: [],
|
|
80
|
+
oneTimeGoals: [],
|
|
81
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 500, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 200 },
|
|
82
|
+
}
|
|
83
|
+
plan.assumptions = {
|
|
84
|
+
inflationPct: 2.5,
|
|
85
|
+
healthcareExtraInflationPct: 2,
|
|
86
|
+
defaultReturnPct: 6,
|
|
87
|
+
ssCola: { mode: 'matchInflation' },
|
|
88
|
+
ssHaircut: null,
|
|
89
|
+
stateEffectiveTaxPct: 0,
|
|
90
|
+
localIncomeTaxPct: 0,
|
|
91
|
+
recentAnnualMagi: 135_000,
|
|
92
|
+
heirTaxRatePct: 25,
|
|
93
|
+
safeWithdrawalRatePct: 4,
|
|
94
|
+
}
|
|
95
|
+
plan.scenarios = [
|
|
96
|
+
{
|
|
97
|
+
id: exampleEntityId(EXAMPLE_ID, 'fat-fire'),
|
|
98
|
+
name: 'Fat FIRE ($80,000 spending)',
|
|
99
|
+
patch: {
|
|
100
|
+
expenses: {
|
|
101
|
+
baseAnnual: 80_000,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
]
|
|
106
|
+
const parsed = parsePlan(plan)
|
|
107
|
+
if (!parsed.ok) throw new Error(`lean-fat-fire invalid: ${parsed.issues.join('; ')}`)
|
|
108
|
+
return parsed.plan
|
|
109
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Long-term-care shock — a care episode and how LTC insurance offsets it. */
|
|
2
|
+
|
|
3
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
4
|
+
import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
5
|
+
|
|
6
|
+
const EXAMPLE_ID = 'ltc-shock'
|
|
7
|
+
|
|
8
|
+
export function buildLtcShock(): Plan {
|
|
9
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
10
|
+
const plan = createEmptyPlan({ name: 'Long-term-care shock', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
11
|
+
plan.household = {
|
|
12
|
+
filingStatus: 'single',
|
|
13
|
+
hasQualifyingDependent: false,
|
|
14
|
+
state: 'FL',
|
|
15
|
+
stateMoves: [],
|
|
16
|
+
capitalLossCarryforward: 0,
|
|
17
|
+
people: [
|
|
18
|
+
{ id: p1, name: 'Quinn', dob: '1964-01-01', sex: 'female', retirementAge: 62, longevity: { planningAge: 92, source: 'manual' } },
|
|
19
|
+
],
|
|
20
|
+
}
|
|
21
|
+
plan.accounts = [
|
|
22
|
+
{ type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Cash', ownerPersonId: null, annualReturnPct: 2, balance: 500_000, annualContribution: 0 },
|
|
23
|
+
]
|
|
24
|
+
plan.careEvents = [
|
|
25
|
+
{ id: exampleEntityId(EXAMPLE_ID, 'care'), personId: p1, startAge: 78, durationYears: 3, annualCost: 95_000 },
|
|
26
|
+
]
|
|
27
|
+
plan.insurance = [
|
|
28
|
+
{
|
|
29
|
+
kind: 'ltc',
|
|
30
|
+
id: exampleEntityId(EXAMPLE_ID, 'ltc'),
|
|
31
|
+
name: 'LTC policy',
|
|
32
|
+
owner: p1,
|
|
33
|
+
annualPremium: 2_800,
|
|
34
|
+
premiumMode: 'lifetime',
|
|
35
|
+
benefitMonthly: 5_000,
|
|
36
|
+
benefitPeriodYears: 3,
|
|
37
|
+
eliminationPeriodDays: 90,
|
|
38
|
+
inflationRiderPct: 3,
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
plan.expenses = {
|
|
42
|
+
baseAnnual: 55_000,
|
|
43
|
+
phases: [],
|
|
44
|
+
oneTimeGoals: [],
|
|
45
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 650, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 200 },
|
|
46
|
+
}
|
|
47
|
+
plan.assumptions = {
|
|
48
|
+
inflationPct: 2.5,
|
|
49
|
+
healthcareExtraInflationPct: 3,
|
|
50
|
+
defaultReturnPct: 4.5,
|
|
51
|
+
ssCola: { mode: 'matchInflation' },
|
|
52
|
+
ssHaircut: null,
|
|
53
|
+
stateEffectiveTaxPct: 0,
|
|
54
|
+
localIncomeTaxPct: 0,
|
|
55
|
+
recentAnnualMagi: 0,
|
|
56
|
+
heirTaxRatePct: 22,
|
|
57
|
+
safeWithdrawalRatePct: 4,
|
|
58
|
+
}
|
|
59
|
+
const parsed = parsePlan(plan)
|
|
60
|
+
if (!parsed.ok) throw new Error(`ltc shock invalid: ${parsed.issues.join('; ')}`)
|
|
61
|
+
return parsed.plan
|
|
62
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Moving in retirement — mid-plan relocation changes state tax. */
|
|
2
|
+
|
|
3
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
4
|
+
import { EXAMPLE_FIXED_YEAR, exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
5
|
+
|
|
6
|
+
const EXAMPLE_ID = 'moving-state-tax'
|
|
7
|
+
|
|
8
|
+
export function buildMovingStateTax(): Plan {
|
|
9
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
10
|
+
const plan = createEmptyPlan({ name: 'Moving in retirement (state tax)', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
11
|
+
plan.household = {
|
|
12
|
+
filingStatus: 'single',
|
|
13
|
+
hasQualifyingDependent: false,
|
|
14
|
+
state: 'FL',
|
|
15
|
+
stateMoves: [{ fromYear: EXAMPLE_FIXED_YEAR + 3, fromMonth: 7, state: 'KY' }],
|
|
16
|
+
capitalLossCarryforward: 0,
|
|
17
|
+
people: [
|
|
18
|
+
{ id: p1, name: 'Avery', dob: '1966-01-01', sex: 'average', retirementAge: 62, longevity: { planningAge: 90, source: 'manual' } },
|
|
19
|
+
],
|
|
20
|
+
}
|
|
21
|
+
plan.accounts = [
|
|
22
|
+
{ type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Cash', ownerPersonId: null, annualReturnPct: 2, balance: 150_000, annualContribution: 0 },
|
|
23
|
+
{ type: 'taxable', id: exampleEntityId(EXAMPLE_ID, 'brokerage'), name: 'Brokerage', ownerPersonId: null, annualReturnPct: null, balance: 600_000, costBasis: 400_000, annualContribution: 0 },
|
|
24
|
+
]
|
|
25
|
+
plan.incomes = [
|
|
26
|
+
{ type: 'recurring', id: exampleEntityId(EXAMPLE_ID, 'consulting'), label: 'Consulting', annualAmount: 100_000, startYear: EXAMPLE_FIXED_YEAR, endYear: null, inflationAdjusted: true, taxTreatment: 'ordinary' },
|
|
27
|
+
]
|
|
28
|
+
plan.expenses = {
|
|
29
|
+
baseAnnual: 65_000,
|
|
30
|
+
phases: [],
|
|
31
|
+
oneTimeGoals: [],
|
|
32
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 700, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 0 },
|
|
33
|
+
}
|
|
34
|
+
plan.scenarios = [
|
|
35
|
+
{ id: exampleEntityId(EXAMPLE_ID, 'stay-fl'), name: 'Stay in Florida', patch: { household: { stateMoves: [] } } },
|
|
36
|
+
{ id: exampleEntityId(EXAMPLE_ID, 'move-ky'), name: 'Move to Kentucky sooner', patch: { household: { stateMoves: [{ fromYear: EXAMPLE_FIXED_YEAR + 1, fromMonth: 7, state: 'KY' }] } } },
|
|
37
|
+
]
|
|
38
|
+
plan.assumptions = {
|
|
39
|
+
inflationPct: 2.5,
|
|
40
|
+
healthcareExtraInflationPct: 3,
|
|
41
|
+
defaultReturnPct: 5,
|
|
42
|
+
ssCola: { mode: 'matchInflation' },
|
|
43
|
+
ssHaircut: null,
|
|
44
|
+
stateEffectiveTaxPct: 0,
|
|
45
|
+
localIncomeTaxPct: 0,
|
|
46
|
+
recentAnnualMagi: 95_000,
|
|
47
|
+
heirTaxRatePct: 22,
|
|
48
|
+
safeWithdrawalRatePct: 4,
|
|
49
|
+
}
|
|
50
|
+
const parsed = parsePlan(plan)
|
|
51
|
+
if (!parsed.ok) throw new Error(`moving state tax invalid: ${parsed.issues.join('; ')}`)
|
|
52
|
+
return parsed.plan
|
|
53
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Brokerage / no-annuity control (A-B pair for annuity comparison).
|
|
2
|
+
* Same couple, incomes, expenses, and starting balances *before* any purchase.
|
|
3
|
+
* The premium money stays invested in cash + traditional IRA (taxable growth assumed).
|
|
4
|
+
* Compare to annuity-purchases-estate using Plan Compare to see income security,
|
|
5
|
+
* RMD impact, and estate outcome differences.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
9
|
+
import { EXAMPLE_FIXED_YEAR, exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
10
|
+
|
|
11
|
+
const EXAMPLE_ID = 'no-annuity-brokerage'
|
|
12
|
+
|
|
13
|
+
export function buildNoAnnuityBrokerage(): Plan {
|
|
14
|
+
const me = exampleEntityId(EXAMPLE_ID, 'me')
|
|
15
|
+
const partner = exampleEntityId(EXAMPLE_ID, 'partner')
|
|
16
|
+
const plan = createEmptyPlan({ name: 'Brokerage only (no annuities)', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
17
|
+
|
|
18
|
+
plan.household = {
|
|
19
|
+
filingStatus: 'marriedFilingJointly',
|
|
20
|
+
hasQualifyingDependent: false,
|
|
21
|
+
state: 'FL',
|
|
22
|
+
stateMoves: [],
|
|
23
|
+
capitalLossCarryforward: 0,
|
|
24
|
+
people: [
|
|
25
|
+
{ id: me, name: 'Jordan', dob: '1961-03-10', sex: 'male', retirementAge: 65, longevity: { planningAge: 90, source: 'manual' } },
|
|
26
|
+
{ id: partner, name: 'Taylor', dob: '1963-11-22', sex: 'female', retirementAge: 64, longevity: { planningAge: 93, source: 'manual' } },
|
|
27
|
+
],
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Same starting point, but keep the money that would have bought annuities
|
|
31
|
+
// (220k in cash + 135k in tira instead of spent on purchases)
|
|
32
|
+
plan.accounts = [
|
|
33
|
+
{ type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Emergency cash (includes would-be premium)', ownerPersonId: null, annualReturnPct: 2, balance: 95_000 + 220_000, annualContribution: 0 },
|
|
34
|
+
{ type: 'traditional', id: exampleEntityId(EXAMPLE_ID, 'tira'), name: 'Jordan traditional IRA (includes would-be premium)', ownerPersonId: me, annualReturnPct: null, kind: 'ira', balance: 780_000 + 135_000, annualContribution: 0, estateBeneficiary: { destination: 'spouse' } },
|
|
35
|
+
{ type: 'traditional', id: exampleEntityId(EXAMPLE_ID, '401k'), name: 'Jordan 401k', ownerPersonId: me, annualReturnPct: null, kind: 'employer', balance: 310_000, annualContribution: 0, estateBeneficiary: { destination: 'nonSpouse' } },
|
|
36
|
+
{ type: 'roth', id: exampleEntityId(EXAMPLE_ID, 'roth'), name: 'Roth IRA', ownerPersonId: me, annualReturnPct: null, kind: 'ira', balance: 50_000, annualContribution: 0 },
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
// Simpler beneficiaries set inline above (flat)
|
|
40
|
+
|
|
41
|
+
plan.incomes = [
|
|
42
|
+
{ type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss-j'), personId: me, piaMonthly: 2650, earnings: null, claimAge: { years: 70, months: 0 } },
|
|
43
|
+
{ type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss-t'), personId: partner, piaMonthly: 1720, earnings: null, claimAge: { years: 67, months: 0 } },
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
// Pension as account
|
|
47
|
+
type PensionAccount = Extract<Plan['accounts'][number], { type: 'pension' }>
|
|
48
|
+
const pension: PensionAccount = {
|
|
49
|
+
type: 'pension',
|
|
50
|
+
id: exampleEntityId(EXAMPLE_ID, 'pension'),
|
|
51
|
+
name: 'Pension (Jordan)',
|
|
52
|
+
ownerPersonId: me,
|
|
53
|
+
annualReturnPct: null,
|
|
54
|
+
startAge: 65,
|
|
55
|
+
monthlyAmount: 1500,
|
|
56
|
+
colaPct: 2.0,
|
|
57
|
+
survivorPct: 50,
|
|
58
|
+
}
|
|
59
|
+
plan.accounts.push(pension)
|
|
60
|
+
|
|
61
|
+
plan.expenses = {
|
|
62
|
+
baseAnnual: 78_000,
|
|
63
|
+
phases: [
|
|
64
|
+
{ fromAge: 75, multiplier: 0.88 },
|
|
65
|
+
],
|
|
66
|
+
oneTimeGoals: [],
|
|
67
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 880, applyAcaCredit: false, medicareExtrasMonthlyPerPerson: 210 },
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
plan.strategies = {
|
|
71
|
+
withdrawalOrder: { mode: 'sequential' },
|
|
72
|
+
rothConversion: { mode: 'fillToTarget', target: 'topOfBracket', targetValue: 24, startYear: EXAMPLE_FIXED_YEAR + 1, endYear: EXAMPLE_FIXED_YEAR + 7 },
|
|
73
|
+
qcdAnnual: 5000,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
plan.assumptions = {
|
|
77
|
+
inflationPct: 2.3,
|
|
78
|
+
healthcareExtraInflationPct: 3,
|
|
79
|
+
defaultReturnPct: 5.2,
|
|
80
|
+
ssCola: { mode: 'matchInflation' },
|
|
81
|
+
ssHaircut: null,
|
|
82
|
+
stateEffectiveTaxPct: 0,
|
|
83
|
+
localIncomeTaxPct: 0,
|
|
84
|
+
recentAnnualMagi: 120_000,
|
|
85
|
+
heirTaxRatePct: 28,
|
|
86
|
+
safeWithdrawalRatePct: 3.5,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const parsed = parsePlan(plan)
|
|
90
|
+
if (!parsed.ok) throw new Error(`no-annuity-brokerage invalid: ${parsed.issues.join('; ')}`)
|
|
91
|
+
return parsed.plan
|
|
92
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** High balances: RMDs and IRMAA — large traditional balances push MAGI into Medicare tiers. */
|
|
2
|
+
|
|
3
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
4
|
+
import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
5
|
+
|
|
6
|
+
const EXAMPLE_ID = 'rmd-irmaa'
|
|
7
|
+
|
|
8
|
+
export function buildRmdIrmaa(): Plan {
|
|
9
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
10
|
+
const plan = createEmptyPlan({ name: 'High balances: RMDs & IRMAA', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
11
|
+
plan.household = {
|
|
12
|
+
filingStatus: 'single',
|
|
13
|
+
hasQualifyingDependent: false,
|
|
14
|
+
state: 'FL',
|
|
15
|
+
stateMoves: [],
|
|
16
|
+
capitalLossCarryforward: 0,
|
|
17
|
+
people: [
|
|
18
|
+
{ id: p1, name: 'Dana', dob: '1953-01-01', sex: 'female', retirementAge: 65, longevity: { planningAge: 95, source: 'manual' } },
|
|
19
|
+
],
|
|
20
|
+
}
|
|
21
|
+
plan.accounts = [
|
|
22
|
+
{ type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Cash', ownerPersonId: null, annualReturnPct: 2, balance: 50_000, annualContribution: 0 },
|
|
23
|
+
{ type: 'traditional', id: exampleEntityId(EXAMPLE_ID, 'ira'), name: 'Traditional IRA', ownerPersonId: p1, annualReturnPct: null, kind: 'ira', balance: 1_850_000, annualContribution: 0 },
|
|
24
|
+
{ type: 'taxable', id: exampleEntityId(EXAMPLE_ID, 'brokerage'), name: 'Brokerage', ownerPersonId: null, annualReturnPct: null, balance: 400_000, costBasis: 280_000, annualContribution: 0 },
|
|
25
|
+
]
|
|
26
|
+
plan.incomes = [
|
|
27
|
+
{ type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss'), personId: p1, piaMonthly: 3_200, earnings: null, claimAge: { years: 70, months: 0 } },
|
|
28
|
+
]
|
|
29
|
+
plan.expenses = {
|
|
30
|
+
baseAnnual: 110_000,
|
|
31
|
+
phases: [],
|
|
32
|
+
oneTimeGoals: [],
|
|
33
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 0, applyAcaCredit: false, medicareExtrasMonthlyPerPerson: 350 },
|
|
34
|
+
}
|
|
35
|
+
plan.strategies = {
|
|
36
|
+
withdrawalOrder: { mode: 'sequential' },
|
|
37
|
+
rothConversion: { mode: 'none' },
|
|
38
|
+
qcdAnnual: 15_000,
|
|
39
|
+
}
|
|
40
|
+
plan.assumptions = {
|
|
41
|
+
inflationPct: 2.5,
|
|
42
|
+
healthcareExtraInflationPct: 3,
|
|
43
|
+
defaultReturnPct: 5,
|
|
44
|
+
ssCola: { mode: 'matchInflation' },
|
|
45
|
+
ssHaircut: null,
|
|
46
|
+
stateEffectiveTaxPct: 0,
|
|
47
|
+
localIncomeTaxPct: 0,
|
|
48
|
+
recentAnnualMagi: 0,
|
|
49
|
+
heirTaxRatePct: 28,
|
|
50
|
+
safeWithdrawalRatePct: 4,
|
|
51
|
+
}
|
|
52
|
+
const parsed = parsePlan(plan)
|
|
53
|
+
if (!parsed.ok) throw new Error(`rmd irmaa invalid: ${parsed.issues.join('; ')}`)
|
|
54
|
+
return parsed.plan
|
|
55
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
|
|
2
|
+
import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
|
|
3
|
+
|
|
4
|
+
const EXAMPLE_ID = 'salary-growth-escalation'
|
|
5
|
+
|
|
6
|
+
export function buildSalaryGrowthEscalation(): Plan {
|
|
7
|
+
const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
|
|
8
|
+
const plan = createEmptyPlan({ name: 'Salary growth & escalation', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
|
|
9
|
+
plan.household = {
|
|
10
|
+
filingStatus: 'single',
|
|
11
|
+
hasQualifyingDependent: false,
|
|
12
|
+
state: 'TX',
|
|
13
|
+
stateMoves: [],
|
|
14
|
+
capitalLossCarryforward: 0,
|
|
15
|
+
people: [
|
|
16
|
+
{ id: p1, name: 'Dana', dob: '1996-01-01', sex: 'average', retirementAge: 55, longevity: { planningAge: 95, source: 'manual' } },
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
plan.accounts = [
|
|
20
|
+
{
|
|
21
|
+
type: 'traditional',
|
|
22
|
+
id: exampleEntityId(EXAMPLE_ID, 'pretax-401k'),
|
|
23
|
+
name: 'Pre-tax 401(k)',
|
|
24
|
+
ownerPersonId: p1,
|
|
25
|
+
annualReturnPct: 7.5,
|
|
26
|
+
kind: 'employer',
|
|
27
|
+
balance: 40_000,
|
|
28
|
+
annualContribution: 10_000,
|
|
29
|
+
contributionSchedule: [
|
|
30
|
+
{
|
|
31
|
+
annualAmount: 10_000,
|
|
32
|
+
fromAge: null,
|
|
33
|
+
toAge: 55,
|
|
34
|
+
escalationPct: 3,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'taxable',
|
|
40
|
+
id: exampleEntityId(EXAMPLE_ID, 'taxable-brokerage'),
|
|
41
|
+
name: 'Taxable Brokerage',
|
|
42
|
+
ownerPersonId: null,
|
|
43
|
+
annualReturnPct: 7,
|
|
44
|
+
balance: 30_000,
|
|
45
|
+
costBasis: 25_000,
|
|
46
|
+
annualContribution: 5_000,
|
|
47
|
+
contributionSchedule: [
|
|
48
|
+
{
|
|
49
|
+
annualAmount: 5_000,
|
|
50
|
+
fromAge: null,
|
|
51
|
+
toAge: 55,
|
|
52
|
+
escalationPct: 3,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
plan.incomes = [
|
|
58
|
+
{
|
|
59
|
+
type: 'wages',
|
|
60
|
+
id: exampleEntityId(EXAMPLE_ID, 'wages'),
|
|
61
|
+
personId: p1,
|
|
62
|
+
annualGross: 80_000,
|
|
63
|
+
endAge: null,
|
|
64
|
+
realGrowthPct: 3,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'socialSecurity',
|
|
68
|
+
id: exampleEntityId(EXAMPLE_ID, 'ss'),
|
|
69
|
+
personId: p1,
|
|
70
|
+
piaMonthly: 2_400,
|
|
71
|
+
earnings: null,
|
|
72
|
+
claimAge: { years: 67, months: 0 },
|
|
73
|
+
},
|
|
74
|
+
]
|
|
75
|
+
plan.expenses = {
|
|
76
|
+
baseAnnual: 45_000,
|
|
77
|
+
phases: [],
|
|
78
|
+
oneTimeGoals: [],
|
|
79
|
+
healthcare: { pre65MonthlyPremiumPerPerson: 400, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 150 },
|
|
80
|
+
}
|
|
81
|
+
plan.assumptions = {
|
|
82
|
+
inflationPct: 2.5,
|
|
83
|
+
healthcareExtraInflationPct: 2,
|
|
84
|
+
defaultReturnPct: 6,
|
|
85
|
+
ssCola: { mode: 'matchInflation' },
|
|
86
|
+
ssHaircut: null,
|
|
87
|
+
stateEffectiveTaxPct: 0,
|
|
88
|
+
localIncomeTaxPct: 0,
|
|
89
|
+
recentAnnualMagi: 80_000,
|
|
90
|
+
heirTaxRatePct: 25,
|
|
91
|
+
safeWithdrawalRatePct: 4,
|
|
92
|
+
}
|
|
93
|
+
const parsed = parsePlan(plan)
|
|
94
|
+
if (!parsed.ok) throw new Error(`salary-growth-escalation invalid: ${parsed.issues.join('; ')}`)
|
|
95
|
+
return parsed.plan
|
|
96
|
+
}
|