METHODOLOGY
HOW THE NUMBERS ARE MADE

Every source, formula and assumption โ€” including the ones that should make you skeptical.

PortfolioSim is an educational backtesting and simulation tool. This page documents exactly what it computes, where the data comes from, and where the methodology has known limits. If you find an error, tell me โ€” [email protected] โ€” being corrected is the point.

Data sources

Equities, funds & rates โ€” daily adjusted closes from Yahoo Finance (Nasdaq Composite ^IXIC from 1971, S&P 500 ^GSPC from 1927, S&P 500 Utilities ^SP500-55, gold ETF GLD, silver SI=F and platinum PL=F futures, government-bond fund FGOVX), resampled to month-end. The 13-week T-bill yield ^IRX is converted into a cumulative price index from its annualized rate, so cash earns compounding interest rather than sitting flat.

Gold โ€” a spliced series: COMEX futures GC=F supply daily prices from August 2000 onward; monthly London prices from freegoldapi extend the history back to 1968. The two are scale-matched at the join so the splice introduces no artificial jump.

Canadian farmland โ€” Statistics Canada table 32-10-0047-01, farm-land value per acre. Inflation โ€” the US GDP deflator (GDPDEF) from FRED. Economics dashboards โ€” FRED series for the US (Case-Shiller, M2, WALCL, GDP, unemployment, the full Treasury curve) and for Canada (OECD rate and unemployment series), plus Bank of Canada Valet for the Canadian yield curve.

All data is pre-downloaded on a schedule and served from the app's own storage, so results are reproducible within a day's freshness and the app doesn't depend on live third-party calls.

Inflation: why the GDP deflator

Real returns use the GDP deflator rather than CPI. The deflator covers the whole economy's price change rather than a fixed consumption basket, is less sensitive to basket-substitution debates, and has a consistent quarterly history since 1947. Annual inflation is measured Q4-over-Q4; the current, incomplete year is estimated from the trailing four quarters and marked with a โ˜… wherever it appears, so a partial year is never silently presented as final.

The backtest

The historical simulation holds your chosen weights as an annually rebalanced portfolio of month-end total returns: allocations are reset to your target weights each December (and again whenever the optional tactical signal changes regime), and drift with the market in between. The fee drag you set is deducted from each calendar year's return and compounds โ€” a 1% drag reduces every year's growth base, which over 30 years is substantially worse than "minus 1% at the end." Nominal CAGR, real CAGR (after drag and inflation), and maximum drawdown are computed from that adjusted equity curve.

Tactical overlay (optional)

A moving-average regime signal (default 50/200-day) on a signal asset, combined with a statistical filter that flags years whose return falls below the historical mean minus N standard deviations. When triggered, a configurable share of the portfolio shifts into a risk-off asset, with a lockout period preventing rapid re-triggering. Every trigger is logged and displayed โ€” the tool shows you each time the rule fired, so you can judge whether it earned its keep or just missed rebounds.

Monte Carlo: stationary block bootstrap

Forward simulations do not assume normal returns. They resample the portfolio's own historical monthly returns in contiguous blocks with geometrically distributed lengths (mean โ‰ˆ 3 years, capped at the history's length), preserving the autocorrelation, volatility clustering and fat tails that independent draws destroy. Each simulated month keeps a link to its source month, and inflation is drawn from that same source period โ€” so a path that samples the 1970s experiences 1970s inflation alongside 1970s returns, rather than pairing crisis returns with average inflation. Up to 10,000 paths feed the percentile fans.

Retirement simulation

Withdrawal plans are tested two ways. Historically: the plan is run from every historical start year, exposing sequence-of-returns risk directly โ€” the same plan started in 1973 and 1982 are different retirements. Forward: the block-bootstrap engine above. Withdrawals are inflation-adjusted along each path's own realized inflation; pensions join at their start age.

Guyton-Klinger guardrails

The dynamic-spending option implements guardrail rules: when the current withdrawal rate drifts beyond bands around the initial rate, spending is cut or raised by a fixed step, with an optional income floor limiting how far cuts can go. The safe-withdrawal-rate search then finds the highest initial rate whose success across all tested sequences meets your target.

The optimizer

Two stages: a Monte Carlo search over random weight vectors within your per-asset bounds, filtered by your maximum-drawdown constraint, followed by SLSQP refinement of the best candidates. An optional rolling-window mode re-optimizes across shifted historical windows to show how unstable "optimal" weights are through time โ€” which is the honest headline of most optimization exercises.

Limitations โ€” read this part

Index dividends. ^IXIC and ^GSPC are price indices: they exclude dividends and therefore understate equity total returns, materially over long horizons. Fund and ETF tickers (GLD, FGOVX) use adjusted closes and do include distributions. Comparisons between the two kinds are not perfectly apples-to-apples.

Farmland smoothness. Annual, appraisal-based land values are far smoother than a tradable asset would be โ€” farmland's volatility and drawdowns are understated, and it cannot actually be bought in ETF form at these prices.

Splices and proxies. Pre-2000 gold is monthly, not daily; FGOVX proxies "government bonds" only as far back as the fund exists; the utilities index has its own history quirks. Joins are scale-matched but remain joins.

Backtesting itself. Every result here is conditioned on one realized history. Strategies tuned on that history โ€” especially the tactical overlay and the optimizer's weights โ€” carry look-ahead and overfitting risk by construction. The rolling-window view and the trigger log exist precisely to make that fragility visible. Past performance does not indicate future results, and simulated futures are drawn from the past.

PortfolioSim is an educational tool, not investment advice, and its developer is not a registered adviser in any jurisdiction. Decisions about real money deserve a qualified professional who knows your situation.
Launch the App โ†’ FREE ยท NO SIGN-UP
Questions, corrections, ideas โ€” [email protected] โ† portfoliosim.org