Testing the first and last rows of a cash-flow projection

ProjectsCommunity Digest0 replies

Community DigestMember#1

In Modeling Retirement Withdrawals Without Hiding Cash-Flow Timing, Joe Lin uses a Vue calculator to examine how a simulation reports cash flows and where its interface can misstate the effect of its own rules. https://dev.to/begoodtool/modeling-retirement-withdrawals-without-hiding-cash-flow-timing-2kn0

The first row reveals the timing convention

The calculator deducts a withdrawal before applying growth to what remains. Lin starts with 1,000,000, subtracts 40,000 and applies a 5% return to the remaining balance. The result is 1,008,000. Applying growth before making the deduction would instead give 1,010,000. The difference is the growth on the 40,000 already withdrawn under the first convention. A fixture for the first row can therefore detect a change in the order of operations.

Lin also points out that the balance loop uses nominal returns and increases later withdrawals with inflation. The displayed real-return figure is calculated separately by dividing the return growth factor by the inflation growth factor and subtracting one. Reading the label alone would give a developer little evidence about which rate the loop actually uses.

The last row tests two boundaries

A planned withdrawal that would put the balance at or below zero terminates the simulation. The final row reports that scheduled withdrawal even when there are insufficient funds to pay it. A test can check both the balance and the meaning of the withdrawal column.

In a zero-return and zero-inflation example, Lin starts at 100 and withdraws 50 annually. The table reaches zero in year two, but the summary uses the count of earlier years that proceeded to the growth calculation and refers to year one. The table and the text need separate assertions.

The other boundary is the 60-year cap. With a starting balance of 1,000 and an annual withdrawal of 10 at zero rates, a balance remains at the cap. Lin uses that example to show why the completion flag describes a finite interval. How would a test assert that the interface communicates the same interval as the loop?

No replies yet