Skip to content

A local-first personal finance app

:chart_with_upwards_trend: Monte carlo - withdrawal rule breakdown (#8863)

Michael Clarkdb1b0ea97541
diff --git a/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarlo.tsx b/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarlo.tsx
index 814ded4da1..452a8b9f8d 100644
--- a/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarlo.tsx
+++ b/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarlo.tsx
@@ -484,6 +484,7 @@ export function MonteCarlo() {
simulationCount={result.simulationCount}
startAge={config.currentAge}
hasContributions={config.contributions.length > 0}
+ withdrawalRule={resolvedConfig.withdrawalRule}
onBack={() => setSelectedRun(null)}
/>
) : (
diff --git a/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarloRunDetailTable.tsx b/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarloRunDetailTable.tsx
index 0d309a323f..f787c91cea 100644
--- a/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarloRunDetailTable.tsx
+++ b/packages/desktop-client/src/components/reports/reports/monte-carlo/MonteCarloRunDetailTable.tsx
@@ -16,7 +16,9 @@ import { PrivacyFilter } from '#components/PrivacyFilter';
import { MonteCarloHelpTooltip } from '#components/reports/reports/monte-carlo/MonteCarloHelpTooltip';
import type {
MonteCarloPot,
+ MonteCarloRuleExplanation,
MonteCarloRunDetailRow,
+ MonteCarloWithdrawalRuleConfig,
} from '#components/reports/reports/monte-carlo/monteCarloSimulation';
import { GROUP_HEADING_STYLE } from '#components/reports/reports/monte-carlo/monteCarloStyles';
import { useFormat } from '#hooks/useFormat';
@@ -36,6 +38,13 @@ const POT_CELL_STYLE = {
textAlign: 'right',
} as const;
+// Enough precision that multiplying the displayed rate by the balance
+// reproduces the displayed amounts; trailing zeros trimmed so simple
+// rates still read cleanly (4% rather than 4.0000%)
+function formatRuleRate(rate: number) {
+ return `${Number((rate * 100).toFixed(4))}%`;
+}
+
type MonteCarloRunDetailTableProps = {
rows: MonteCarloRunDetailRow[];
pots: MonteCarloPot[];
@@ -44,6 +53,8 @@ type MonteCarloRunDetailTableProps = {
startAge: number;
/** Show the Contributions columns (the plan has contributions set up) */
hasContributions: boolean;
+ /** The configured rule, quoted in the per-year explanations */
+ withdrawalRule: MonteCarloWithdrawalRuleConfig;
onBack: () => void;
};
@@ -54,6 +65,7 @@ export function MonteCarloRunDetailTable({
simulationCount,
startAge,
hasContributions,
+ withdrawalRule,
onBack,
}: MonteCarloRunDetailTableProps) {
const { t } = useTranslation();
@@ -116,6 +128,154 @@ export function MonteCarloRunDetailTable({
return t('Total withdrawn over this run: {{total}}.', { total });
}
+ // One sentence per rule outcome, phrased with the numbers the user
+ // configured so each year's working reads like the setup sentence
+ function getRuleExplanationSentence(explanation: MonteCarloRuleExplanation) {
+ if (explanation.kind === 'anchor') {
+ return t(
+ "Floor & ceiling: the first spending year takes the planned amount and sets the rule's rate at {{rate}} of the accessible balance; future years stay within {{floorPct}} below and {{ceilingPct}} above the planned amount.",
+ {
+ rate: formatRuleRate(explanation.rate),
+ floorPct: formatRuleRate(withdrawalRule.floorPct),
+ ceilingPct: formatRuleRate(withdrawalRule.ceilingPct),
+ },
+ );
+ }
+ if (explanation.kind === 'floor-ceiling') {
+ const values = {
+ rate: formatRuleRate(explanation.rate),
+ amount: format(explanation.unclamped, 'financial'),
+ floor: format(explanation.floor, 'financial'),
+ ceiling: format(explanation.ceiling, 'financial'),
+ floorPct: formatRuleRate(withdrawalRule.floorPct),
+ ceilingPct: formatRuleRate(withdrawalRule.ceilingPct),
+ };
+ if (explanation.applied === 'floor') {
+ return t(
+ 'Floor & ceiling: {{rate}} of the accessible balance = {{amount}}, below the floor ({{floorPct}} under the planned amount: {{floor}}) - the floor applied.',
+ values,
+ );
+ }
+ if (explanation.applied === 'ceiling') {
+ return t(
+ 'Floor & ceiling: {{rate}} of the accessible balance = {{amount}}, above the ceiling ({{ceilingPct}} over the planned amount: {{ceiling}}) - the ceiling applied.',
+ values,
+ );
+ }
+ return t(
+ 'Floor & ceiling: {{rate}} of the accessible balance = {{amount}}, within {{floorPct}} below ({{floor}}) and {{ceilingPct}} above ({{ceiling}}) the planned amount.',
+ values,
+ );
+ }
+ // Concrete money beats abstractions: every outcome shows the rule's
+ // result next to the planned amount (any minimum floor is reported
+ // by its own line)
+ const planned = format(explanation.planned, 'financial');
+ const adjusted = format(explanation.adjusted, 'financial');
+ const hasEarlierAdjustments = explanation.factor !== 1;
+ if (explanation.rule === 'guardrails') {
+ const values = {
+ currentRate: formatRuleRate(explanation.currentRate ?? 0),
+ referenceRate: formatRuleRate(explanation.referenceRate ?? 0),
+ trigger: formatRuleRate(withdrawalRule.preservationTriggerPct),
+ prosperityTrigger: formatRuleRate(withdrawalRule.prosperityTriggerPct),
+ cut: formatRuleRate(withdrawalRule.preservationCutPct),
+ raise: formatRuleRate(withdrawalRule.prosperityIncreasePct),
+ planned,
+ adjusted,
+ };
+ if (explanation.action === 'cut') {
+ return t(
+ 'Guardrails: the withdrawal rate ({{currentRate}}) rose more than {{trigger}} above the planned rate ({{referenceRate}}), so withdrawals were cut by {{cut}}: {{adjusted}} instead of the planned {{planned}}.',
+ values,
+ );
+ }
+ if (explanation.action === 'raise') {
+ return t(
+ 'Guardrails: the withdrawal rate ({{currentRate}}) fell more than {{prosperityTrigger}} below the planned rate ({{referenceRate}}), so withdrawals were raised by {{raise}}: {{adjusted}} instead of the planned {{planned}}.',
+ values,
+ );
+ }
+ if (hasEarlierAdjustments) {
+ return t(
+ 'Guardrails: the withdrawal rate ({{currentRate}}) stayed close to the planned rate ({{referenceRate}}) - no new change, but earlier adjustments still apply: {{adjusted}} instead of the planned {{planned}}.',
+ values,
+ );
+ }
+ return t(
+ 'Guardrails: the withdrawal rate ({{currentRate}}) stayed close to the planned rate ({{referenceRate}}) - no change, taking the planned {{planned}}.',
+ values,
+ );
+ }
+ if (explanation.rule === 'ratcheting') {
+ const values = {
+ multiple: `${Number(withdrawalRule.balanceThresholdMultiple.toFixed(2))}×`,
+ years: withdrawalRule.consecutiveYears,
+ raise: formatRuleRate(withdrawalRule.ratchetIncreasePct),
+ streak: explanation.ratchetStreak ?? 0,
+ planned,
+ adjusted,
+ };
+ if (explanation.action === 'raise') {
+ return t(
+ 'Ratcheting: the accessible balance stayed above {{multiple}} its starting level for {{years}} years in a row, so withdrawals were raised by {{raise}}: {{adjusted}} instead of the planned {{planned}}.',
+ values,
+ );
+ }
+ if (explanation.ratchetStreak != null && explanation.ratchetStreak > 0) {
+ return hasEarlierAdjustments
+ ? t(
+ 'Ratcheting: balance above {{multiple}} its starting level for {{streak}} of {{years}} years - no raise yet, but earlier raises still apply: {{adjusted}} instead of the planned {{planned}}.',
+ values,
+ )
+ : t(
+ 'Ratcheting: balance above {{multiple}} its starting level for {{streak}} of {{years}} years - no raise yet, taking the planned {{planned}}.',
+ values,
+ );
+ }
+ return hasEarlierAdjustments
+ ? t(
+ 'Ratcheting: balance below {{multiple}} its starting level - the streak reset, but earlier raises still apply: {{adjusted}} instead of the planned {{planned}}.',
+ values,
+ )
+ : t(
+ 'Ratcheting: balance below {{multiple}} its starting level - the streak reset, taking the planned {{planned}}.',
+ values,
+ );
+ }
+ const boundaryValues = {
+ currentRate: formatRuleRate(explanation.currentRate ?? 0),
+ upper: formatRuleRate(withdrawalRule.upperRateThreshold),
+ lower: formatRuleRate(withdrawalRule.lowerRateThreshold),
+ cut: formatRuleRate(withdrawalRule.upperCutPct),
+ raise: formatRuleRate(withdrawalRule.lowerIncreasePct),
+ planned,
+ adjusted,
+ };
+ if (explanation.action === 'cut') {
+ return t(
+ 'Boundaries: the withdrawal rate ({{currentRate}}) rose above {{upper}}, so withdrawals were cut by {{cut}}: {{adjusted}} instead of the planned {{planned}}.',
+ boundaryValues,
+ );
+ }
+ if (explanation.action === 'raise') {
+ return t(
+ 'Boundaries: the withdrawal rate ({{currentRate}}) fell below {{lower}}, so withdrawals were raised by {{raise}}: {{adjusted}} instead of the planned {{planned}}.',
+ boundaryValues,
+ );
+ }
+ if (hasEarlierAdjustments) {
+ return t(
+ 'Boundaries: the withdrawal rate ({{currentRate}}) stayed between {{lower}} and {{upper}} - no new change, but earlier adjustments still apply: {{adjusted}} instead of the planned {{planned}}.',
+ boundaryValues,
+ );
+ }
+ return t(
+ 'Boundaries: the withdrawal rate ({{currentRate}}) stayed between {{lower}} and {{upper}} - no change, taking the planned {{planned}}.',
+ boundaryValues,
+ );
+ }
+
return (
<View>
<View
@@ -369,6 +529,29 @@ export function MonteCarloRunDetailTable({
</FinancialText>
</PrivacyFilter>
</Text>
+ {row.ruleExplanation != null && (
+ <Text style={{ fontSize: 13, color: theme.pageText }}>
+ <PrivacyFilter>
+ <FinancialText as="span">
+ {getRuleExplanationSentence(row.ruleExplanation)}
+ </FinancialText>
+ </PrivacyFilter>
+ </Text>
+ )}
+ {row.minimumApplied && (
+ <Text style={{ fontSize: 13, color: theme.pageText }}>
+ <PrivacyFilter>
+ <FinancialText as="span">
+ {t(
+ 'Raised to the minimum withdrawal: {{amount}}.',
+ {
+ amount: format(row.withdrawal, 'financial'),
+ },
+ )}
+ </FinancialText>
+ </PrivacyFilter>
+ </Text>
+ )}
{row.contributions > 0 && (
<Text style={{ fontSize: 13, color: theme.pageText }}>
<PrivacyFilter>
@@ -418,7 +601,7 @@ export function MonteCarloRunDetailTable({
{pots.length > 0 && (
<View
style={{
- marginTop: 6,
+ marginTop: 14,
maxWidth: hasContributions ? 1150 : 1010,
}}
>
diff --git a/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.test.ts b/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.test.ts
index 2224c72b29..7847db62f9 100644
--- a/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.test.ts
+++ b/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.test.ts
@@ -769,9 +769,33 @@ describe('runMonteCarloSimulation', () => {
}
// The first retirement year withdraws exactly the planned amount
expect(rows[10].withdrawal).toBe(60_000);
+ // ...and explains that it anchored the rule's rate there
+ const anchorRate = 60_000 / (1_000_000 * 1.05 ** 10);
+ const anchorExplanation = rows[10].ruleExplanation;
+ if (anchorExplanation?.kind !== 'anchor') {
+ throw new Error(
+ 'expected an anchor explanation on the first spending year',
+ );
+ }
+ expect(anchorExplanation.rate).toBeCloseTo(anchorRate, 12);
+ // Zero-spend years carry no explanation
+ expect(rows[0].ruleExplanation).toBeUndefined();
// With steady growth the rate rule rises above the plan - it must
// not sit pinned at the 51,000 floor
expect(rows[11].withdrawal).toBeGreaterThan(60_000);
+ // The following year explains the clamp arithmetic
+ const year12Balance = (1_000_000 * 1.05 ** 10 - 60_000) * 1.05;
+ const clampExplanation = rows[11].ruleExplanation;
+ if (clampExplanation?.kind !== 'floor-ceiling') {
+ throw new Error('expected a floor-ceiling explanation');
+ }
+ expect(clampExplanation).toMatchObject({
+ unclamped: Math.round(anchorRate * year12Balance),
+ floor: 51_000,
+ ceiling: 72_000,
+ applied: 'rate',
+ });
+ expect(clampExplanation.rate).toBeCloseTo(anchorRate, 12);
for (const row of rows.slice(11)) {
expect(row.withdrawal).toBeGreaterThanOrEqual(51_000);
expect(row.withdrawal).toBeLessThanOrEqual(72_000);
@@ -808,6 +832,18 @@ describe('runMonteCarloSimulation', () => {
);
expect(result.runDetail![10].withdrawal).toBe(40_000);
+ // The anchor year carries no explanation; the next year evaluates
+ // the rule (rate 40,000/960,000 = 4.17%, inside the 4-6% band)
+ expect(result.runDetail![10].ruleExplanation).toBeUndefined();
+ expect(result.runDetail![11].ruleExplanation).toEqual({
+ kind: 'factor',
+ rule: 'boundaries',
+ factor: 1,
+ planned: 40_000,
+ adjusted: 40_000,
+ action: 'none',
+ currentRate: 40_000 / 960_000,
+ });
});
it('ratcheting does not ratchet before spending starts', () => {
@@ -841,6 +877,25 @@ describe('runMonteCarloSimulation', () => {
);
expect(result.runDetail![5].withdrawal).toBe(10_000);
+ // Streaks start counting once spending does: 1 and 2 above the
+ // threshold, then the third year ratchets
+ expect(result.runDetail![6].ruleExplanation).toEqual({
+ kind: 'factor',
+ rule: 'ratcheting',
+ factor: 1,
+ planned: 10_000,
+ adjusted: 10_000,
+ action: 'none',
+ ratchetStreak: 1,
+ });
+ expect(result.runDetail![8].ruleExplanation).toEqual({
+ kind: 'factor',
+ rule: 'ratcheting',
+ factor: 1.05,
+ planned: 10_000,
+ adjusted: 10_500,
+ action: 'raise',
+ });
});
it('floor-ceiling scales withdrawals with the pot within limits', () => {
@@ -967,6 +1022,20 @@ describe('runMonteCarloSimulation', () => {
expect(rows[0].withdrawal).toBe(10_000);
// Year 2's 50% cut lands well below the floor, so the floor binds
expect(rows[1].withdrawal).toBe(8_000);
+ expect(rows[1].ruleExplanation).toEqual({
+ kind: 'factor',
+ rule: 'guardrails',
+ factor: 0.5,
+ planned: 10_000,
+ adjusted: 5_000,
+ action: 'cut',
+ currentRate: (10_000 * 1.05) / 90_000,
+ referenceRate: 10_000 / 100_000,
+ });
+ expect(rows[1].minimumApplied).toBe(true);
+ // The anchor year has neither
+ expect(rows[0].ruleExplanation).toBeUndefined();
+ expect(rows[0].minimumApplied).toBeUndefined();
for (const row of rows.slice(1)) {
expect(row.withdrawal).toBeGreaterThanOrEqual(8_000);
}
@@ -2039,6 +2108,8 @@ describe('runMonteCarloSimulation', () => {
);
const rows = result.runDetail!;
+ // No withdrawal rule configured - rows carry no rule explanation
+ expect(rows[0].ruleExplanation).toBeUndefined();
expect(rows.map(row => row.startBalance)).toEqual([
100_000, 110_000, 120_000,
]);
diff --git a/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.ts b/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.ts
index b4f278924c..b883a51389 100644
--- a/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.ts
+++ b/packages/desktop-client/src/components/reports/reports/monte-carlo/monteCarloSimulation.ts
@@ -521,6 +521,47 @@ export type MonteCarloParams = Omit<MonteCarloConfig, 'targetAge'> & {
deflateToTodaysMoney?: boolean;
};
+/** How the active withdrawal rule arrived at a captured year's amount */
+export type MonteCarloRuleExplanation =
+ | {
+ /** Floor & ceiling's first spending year: planned amount taken
+ * as-is, and the rule's rate is set here */
+ kind: 'anchor';
+ /** planned / accessible wealth, as a decimal fraction */
+ rate: number;
+ }
+ | {
+ kind: 'floor-ceiling';
+ /** The anchored withdrawal rate, as a decimal fraction */
+ rate: number;
+ /** rate x accessible balance before clamping, in minor units */
+ unclamped: number;
+ /** The floor bound for the year, in minor units */
+ floor: number;
+ /** The ceiling bound for the year, in minor units */
+ ceiling: number;
+ /** Which bound won the clamp */
+ applied: 'floor' | 'ceiling' | 'rate';
+ }
+ | {
+ kind: 'factor';
+ rule: 'guardrails' | 'ratcheting' | 'boundaries';
+ /** The running adjustment factor after this year's decision */
+ factor: number;
+ /** The year's planned spending, in minor units (display-deflated) */
+ planned: number;
+ /** planned x factor - the rule's result before any minimum floor */
+ adjusted: number;
+ /** What this year's evaluation did to the factor */
+ action: 'cut' | 'raise' | 'none';
+ /** This year's withdrawal rate (guardrails and boundaries) */
+ currentRate?: number;
+ /** The planned-path reference rate (guardrails) */
+ referenceRate?: number;
+ /** Ratcheting only: consecutive above-threshold years so far */
+ ratchetStreak?: number;
+ };
+
/** One simulated year of a single captured run, values in minor units */
export type MonteCarloRunDetailRow = {
year: number;
@@ -567,6 +608,14 @@ export type MonteCarloRunDetailRow = {
* fraction; null when the pot had no balance or the plan failed
*/
potReturns: Array<number | null>;
+ /**
+ * How the active withdrawal rule set this year's amount; absent when
+ * no rule ran (no rule configured, a zero-spend year, or before the
+ * first spending year). Amounts are deflated like the row's totals.
+ */
+ ruleExplanation?: MonteCarloRuleExplanation;
+ /** True when the minimum withdrawal raised the final amount */
+ minimumApplied?: boolean;
/**
* Set on a failure year when money remained in pots that hadn't reached
* their access age - the plan failed despite this locked balance
@@ -1232,21 +1281,50 @@ export function runMonteCarloSimulation(
// drift them. Rules evaluate accessible wealth only: locked pots
// can't fund spending, so they must not drive cuts or raises
// until they unlock
+ // The drill-in shows how the rule arrived at each year's amount;
+ // captured only for the inspected run
+ const isCapturedRun =
+ runDetail != null && simulationIndex === captureIndex;
+ let capturedRuleExplanation: MonteCarloRuleExplanation | null = null;
+ let capturedMinimumApplied = false;
if (rule.type === 'floor-ceiling') {
if (year === firstSpendingYear) {
floorCeilingAnchorRate =
accessibleTotal > 0 ? planned / accessibleTotal : 0;
+ if (isCapturedRun) {
+ capturedRuleExplanation = {
+ kind: 'anchor',
+ rate: floorCeilingAnchorRate,
+ };
+ }
+ }
+ if (planned > 0 && year > firstSpendingYear) {
+ // A fixed share of the accessible balance, kept within
+ // limits around the planned spending
+ const unclamped = floorCeilingAnchorRate * accessibleTotal;
+ const floorAmount = planned * (1 - rule.floorPct);
+ const ceilingAmount = planned * (1 + rule.ceilingPct);
+ withdrawal = clamp(unclamped, floorAmount, ceilingAmount);
+ if (isCapturedRun) {
+ capturedRuleExplanation = {
+ kind: 'floor-ceiling',
+ rate: floorCeilingAnchorRate,
+ unclamped: toSafeAmount(Math.round(unclamped * startDeflator)),
+ floor: toSafeAmount(Math.round(floorAmount * startDeflator)),
+ ceiling: toSafeAmount(
+ Math.round(ceilingAmount * startDeflator),
+ ),
+ applied:
+ unclamped < floorAmount
+ ? 'floor'
+ : unclamped > ceilingAmount
+ ? 'ceiling'
+ : 'rate',
+ };
+ }
+ } else {
+ withdrawal = planned;
}
- withdrawal =
- planned > 0 && year > firstSpendingYear
- ? // A fixed share of the accessible balance, kept within
- // limits around the planned spending
- clamp(
- floorCeilingAnchorRate * accessibleTotal,
- planned * (1 - rule.floorPct),
- planned * (1 + rule.ceilingPct),
- )
- : planned;
} else {
if (
planned > 0 &&
@@ -1256,6 +1334,7 @@ export function runMonteCarloSimulation(
accessibleStartByYear[year] > 0
) {
const currentRate = (planned * adjustmentFactor) / accessibleTotal;
+ let ruleAction: 'cut' | 'raise' | 'none' = 'none';
if (rule.type === 'guardrails') {
// Drift is measured against the planned spending path, not
// the year-1 rate, so a deliberate phase change doesn't
@@ -1268,11 +1347,13 @@ export function runMonteCarloSimulation(
referenceRate * (1 + rule.preservationTriggerPct)
) {
adjustmentFactor *= 1 - rule.preservationCutPct;
+ ruleAction = 'cut';
} else if (
currentRate <
referenceRate * (1 - rule.prosperityTriggerPct)
) {
adjustmentFactor *= 1 + rule.prosperityIncreasePct;
+ ruleAction = 'raise';
}
} else if (rule.type === 'ratcheting') {
if (
@@ -1283,6 +1364,7 @@ export function runMonteCarloSimulation(
if (ratchetStreak >= rule.consecutiveYears) {
adjustmentFactor *= 1 + rule.ratchetIncreasePct;
ratchetStreak = 0;
+ ruleAction = 'raise';
}
} else {
ratchetStreak = 0;
@@ -1290,10 +1372,37 @@ export function runMonteCarloSimulation(
} else if (rule.type === 'boundaries') {
if (currentRate > rule.upperRateThreshold) {
adjustmentFactor *= 1 - rule.upperCutPct;
+ ruleAction = 'cut';
} else if (currentRate < rule.lowerRateThreshold) {
adjustmentFactor *= 1 + rule.lowerIncreasePct;
+ ruleAction = 'raise';
}
}
+ if (
+ isCapturedRun &&
+ (rule.type === 'guardrails' ||
+ rule.type === 'ratcheting' ||
+ rule.type === 'boundaries')
+ ) {
+ capturedRuleExplanation = {
+ kind: 'factor',
+ rule: rule.type,
+ factor: adjustmentFactor,
+ planned: toSafeAmount(Math.round(planned * startDeflator)),
+ adjusted: toSafeAmount(
+ Math.round(planned * adjustmentFactor * startDeflator),
+ ),
+ action: ruleAction,
+ ...((rule.type === 'guardrails' ||
+ rule.type === 'boundaries') && { currentRate }),
+ ...(rule.type === 'guardrails' && {
+ referenceRate:
+ plannedTodayByYear[year] / accessibleStartByYear[year],
+ }),
+ ...(rule.type === 'ratcheting' &&
+ ruleAction === 'none' && { ratchetStreak }),
+ };
+ }
}
withdrawal = planned * adjustmentFactor;
}
@@ -1311,6 +1420,9 @@ export function runMonteCarloSimulation(
withdrawal < minimumThisYear
) {
withdrawal = minimumThisYear;
+ if (isCapturedRun) {
+ capturedMinimumApplied = true;
+ }
}
const yearStartTotal = total;
@@ -1595,6 +1707,10 @@ export function runMonteCarloSimulation(
const base = {
year,
startBalance,
+ ...(capturedRuleExplanation != null && {
+ ruleExplanation: capturedRuleExplanation,
+ }),
+ ...(capturedMinimumApplied && { minimumApplied: true }),
// A rate, not an amount - passed through undeflated
inflation: yearInflationRate,
contributions,
diff --git a/packages/docs/docs/experimental/monte-carlo-analysis.md b/packages/docs/docs/experimental/monte-carlo-analysis.md
index 199907757b..2d90fadafb 100644
--- a/packages/docs/docs/experimental/monte-carlo-analysis.md
+++ b/packages/docs/docs/experimental/monte-carlo-analysis.md
@@ -190,7 +190,7 @@ This bar chart only counts the replays that failed, showing at which age they ra
![The simulation runs table](/img/experimental/monte-carlo-analysis/monte-carlo-runs.png)
-Switch the results view from **Chart** to **Runs** to see every replay listed from worst outcome to best. Rather than paging through thousands of runs, use the **Jump to** dropdown to go straight to the worst, median or best run - or the 25th/75th percentile for a typically-bad or typically-good outcome - with the run highlighted so you can click into it. Click any run to walk through it year by year: the balance at the start of each year, the contributions paid in (when your plan has any), the withdrawal taken, the investment growth in that year (as money and as a percentage), the year's inflation rate (when inflation is enabled), and the balance at the end. Expand a year with the arrow at the start of its row (or use **Expand all years**) for the fully labeled breakdown: the withdrawal split into gross, tax and money to spend; the contributions added; the fees paid; and a small table showing each pot's balance at the start of the year, what was contributed into it, what it contributed to the withdrawal, how much of that counted as taxable income, the tax paid on its share, the fee it was charged that year, its return that year, and its ending balance - so you can watch, for example, the cash pot covering spending after a crash while the stock pots are left alone. With the tax-bands model, the per-pot tax is the year's tax bill shared out in proportion to each pot's taxable income.
+Switch the results view from **Chart** to **Runs** to see every replay listed from worst outcome to best. Rather than paging through thousands of runs, use the **Jump to** dropdown to go straight to the worst, median or best run - or the 25th/75th percentile for a typically-bad or typically-good outcome - with the run highlighted so you can click into it. Click any run to walk through it year by year: the balance at the start of each year, the contributions paid in (when your plan has any), the withdrawal taken, the investment growth in that year (as money and as a percentage), the year's inflation rate (when inflation is enabled), and the balance at the end. Expand a year with the arrow at the start of its row (or use **Expand all years**) for the fully labeled breakdown: the withdrawal split into gross, tax and money to spend; when a withdrawal rule is active, a sentence showing how the rule arrived at that year's amount (and whether the minimum withdrawal stepped in); the contributions added; the fees paid; and a small table showing each pot's balance at the start of the year, what was contributed into it, what it contributed to the withdrawal, how much of that counted as taxable income, the tax paid on its share, the fee it was charged that year, its return that year, and its ending balance - so you can watch, for example, the cash pot covering spending after a crash while the stock pots are left alone. With the tax-bands model, the per-pot tax is the year's tax bill shared out in proportion to each pot's taxable income.
![The simulation run table](/img/experimental/monte-carlo-analysis/monte-carlo-run.png)
diff --git a/upcoming-release-notes/monte-carlo-rule-explanations.md b/upcoming-release-notes/monte-carlo-rule-explanations.md
new file mode 100644
index 0000000000..d983a8adae
--- /dev/null
+++ b/upcoming-release-notes/monte-carlo-rule-explanations.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [MikesGlitch]
+---
+
+Explain how each year's withdrawal was calculated in the Monte Carlo run breakdown