The standard
Against a closed form
Where the mathematics has an exact solution, the running model is compared to it. Bond prices, annuity values and Gini coefficients all have one.
Against a numerical derivative
Anything defined as a rate of change is checked by differencing the underlying function. Marginal cost and duration are both derivatives, so both can be tested this way.
Against an accounting identity
Where quantities have to sum, the sum is computed both ways. Welfare areas, surplus transfers and cash flow statements all have to close exactly.
Against a second implementation
For the larger models, the whole calculation is written a second time, separately, and the two are compared across every preset.
At the boundaries
Every input is pushed to both extremes. A surprising share of errors only appear at zero, at a maximum, or exactly on a threshold.
Against the page's own words
Any sentence claiming a specific number is re-run against the live model. Prose drifts away from code more often than code drifts away from itself.
Four worked examples
These are the actual checks, with the actual results. Each one compares the model against something that had to be true independently of it.
Bond duration, against a numerical derivative
- Has to be true
- Modified duration is defined as the price sensitivity to yield, so it must equal
−(dP/dy) / P. The model computes it a completely different way, by weighting each cash flow by its present value. - How it was checked
- Bond prices were computed from a separately written closed-form function, a central difference taken around the current yield, and the result compared against the cash-flow figure across six bond configurations.
- Result
- Agreement to display precision on all six. Two
theoretical anchors also held exactly: a zero-coupon bond's Macaulay duration came out
at 10.00 years for a 10-year bond, and a 10-year 5% par bond paying semiannually gave
7.99 years, matching the closed form
(1+y)/y × [1 − (1+y)⁻ⁿ]to four decimals once its answer in coupon periods is converted to years.
Tariff welfare, against three accounting identities
- Has to be true
- Whatever the tariff, the four areas on the diagram must sum to the loss in consumer surplus, the producer-gain area must equal the change in producer surplus, and the loss to the country must equal the two deadweight triangles.
- How it was checked
- Each side was computed independently, the areas from their geometry and the surpluses from the surplus formula, at tariffs of 0, 2, 4, 6, 7 and 9.
- Result
- All three identities closed exactly at every level. The prohibitive case also behaved correctly: at a tariff of 7 imports reached zero, revenue fell to zero, and the domestic price landed on the no-trade price of 15.
The Gini coefficient, against numerical integration
- Has to be true
- The Gini is defined as the area between the Lorenz curve and the line of equality,
or
1 − 2∫L(p)dp. For a lognormal distribution there is also a closed form,2Φ(σ/√2) − 1. The two must match. - How it was checked
- The Lorenz curve was integrated numerically over 200,000 slices and compared against the closed form at dispersions from 0.3 to 2.0.
- Result
- Agreement to roughly one part in ten million throughout. The inverse normal function used to build the curve was tested separately and round-trips to better than one part in ten million across the whole unit interval.
The retirement model, against a hand calculation
- Has to be true
- With volatility set to zero, randomness disappears. Every one of the thousand simulated lives should then be identical, and all of them should match an ordinary deterministic projection.
- How it was checked
- Volatility was set to zero and the median of a thousand runs compared against a separately written flat-return projection of the same inputs.
- Result
- All five percentiles collapsed onto the same figure, $2.00M, and the separately written projection landed on it too. The success rate went to 100%, as it has to when no life differs from any other. It also moved monotonically with the withdrawal rate, from 91% at 3% down to 74%, 56%, 35% and 23% at 7%, as it must.
What the checks caught
This is the more useful list. A claim that everything is correct carries no information, because anyone can make it. These are errors the process found before anything was published, which is the only evidence that the process runs at all.
What this does not prove
Correct arithmetic is not a correct model
Every check on this page confirms that a model computes its own equations properly. None of them says those equations describe the world well. A flawlessly implemented model of a poor assumption is still a poor model, and no amount of numerical agreement fixes that.
This is why every page here carries a section on what its model leaves out, written to be read rather than buried. The retirement model draws returns from a bell curve, which understates how often extreme years happen. The tariff diagram treats displaced workers as instantly re-employed. The Gini page cannot see wealth or mobility at all. Those are modeling choices, and they are argued about in the open on each page rather than certified away here.
These are teaching models, not advice
The personal finance calculators apply standard formulas correctly, and they still ignore taxes, fees, and the details of whatever product you are actually being sold. The simulators deliberately strip out complications so that one mechanism becomes visible, which is the opposite of what a decision needs.
Use them to build intuition, to sanity-check the shape of an answer, or to understand why a piece of advice you were given might be true. For an actual decision about your own money, talk to somebody qualified who knows your situation.
Things still get through
The list above is not a claim that it is the complete list. Verification reduces mistakes, it does not eliminate them, and the ones that survive are by definition the ones nobody thought to test for.
If you find something that looks wrong, the fastest way to check is usually to push an input to an extreme where you already know the answer. A zero coupon bond must have a duration equal to its maturity. A tariff high enough to stop imports must raise no revenue. If a page violates something that has to be true, it is broken, and I would like to know. The address is on the about page.