# Guided planner: outcome model and scenario assumptions

Version: circular-moving-block-bootstrap-v1. Implemented in `dist/planner-core.mjs`; UI and model remain separate. This is a new illustrative outcome model, not the five-model one-day VaR study and not a validated investment recommendation.

## Input and scope

Users enter a starting USD amount ($1–$1 billion), nonnegative SPY/TLT/GLD weights totaling one, and a horizon of 5, 21, 63 or 252 trading days. These approximate one week, one month, three months and one year. No contributions, withdrawals, cash, leverage, shorts, taxes, inflation or transaction costs are modeled. Weights reset daily, an assumption that can overstate implementable performance when trading costs matter.

The app first requests the existing `/api/live` completed daily history. It rejects a stale response, and never silently substitutes the frozen dataset. After a failure, the user may explicitly choose the historical example ending 2025-12-31. The result and exported summary label the mode and data cutoff.

## Outcome distribution

Use the last at most 1,260 aligned trading-day return vectors (at least 252 required). Compute the weighted daily return for the user’s allocation. Generate 10,000 horizon-length paths by sampling circular, contiguous 20-day blocks with replacement. Contemporary cross-asset relationships are retained because each weighted observation uses all three assets from the same day. Within-block serial order is retained; relationships across blocks are not. Wrapping the end to the beginning introduces an artificial boundary.

Compound daily portfolio returns. Use a deterministic Mulberry32 generator with seed 20261128 to support reproduction. Report the empirical 5th percentile, arithmetic mean final wealth, median, 95th percentile, and fraction of final values below initial wealth. The UI shows lower, average and higher final values, with the mean highlighted. The middle-90% ribbon consists of separate pointwise quantiles; it is not a 90% simultaneous path envelope, and the mean line is not a predicted trajectory.

The mean embeds the sample's historical drift. We do not estimate a stable future expected return or give a confidence interval for it. The simulation cannot generate unseen types of crash, identify causal effects or certify coverage. Model settings are fixed, not optimized on the output. Further model validation is required before making accuracy claims.

## Optional what-if condition

A user may impose a one-time vector of fund price changes before the simulated daily path begins. With weights w and shock vector s, starting wealth becomes V0 × (1 + sum(w_i s_i)). We subsequently use the same historical block-resampling law as the baseline. The displayed day-zero point is the user's original amount, so the first interval incorporates the imposed shock.

Editable presets are **illustrative assumptions**, not empirical estimates:

| Preset | SPY | TLT | GLD |
|---|---:|---:|---:|
| No added shock | 0% | 0% | 0% |
| Sudden stock-market drop | −10% | 0% | 0% |
| Sharp rise in interest rates | −5% | −10% | 0% |
| Conflict-related market stress | −10% | +3% | +5% |

Preset names do not establish that such events cause these price effects. For example, conflict can have many different outcomes; the app does not model a verified conflict-to-return relationship. Users can edit each assumed change or supply their own.

The model frequency estimates P_model(V_H < V0 | chosen shock vector, weights, historical resampling law). It does not estimate the probability of a war, policy change, the actual market shock conditional on it, or the real-world loss probability conditional on the event. To claim real event-conditional probabilities, future work needs explicit labels and timing, an identification/conditioning design, sufficient observations, uncertainty estimates and prospective validation.

## Reproducibility and tests

The JSON summary contains the amount, weights, horizon, condition label and shock vector, source mode, data cutoff, sample start, sample count, SHA-256 of the exact selected daily-return rows, method version, seed, simulation count, block length, trajectory summaries and limitations. Vendor history may be revised; a fingerprint alone does not reconstruct missing input bytes. The current summary does not contain the full input data. Preserve a permitted source snapshot separately for independent reproduction.

`node tests/check_planner.mjs` checks hand-calculated constant returns, portfolio weighting, compounding, shock scaling, a complete loss, no-change trajectories, deterministic replication, invalid percentages/horizons/price rows and safe public auth configuration. Tests do not establish forecast calibration, predictive edge, causal validity or customer demand.

## Past-date replay mode

The same planner now accepts `replay=1`. The user supplies a pretend date and a horizon. `splitReplayHistory` separates observations on/before the requested cutoff from strictly later observations. For weekends/holidays, the effective cutoff is the last available observation on/before the chosen date. Only the past slice is sent to the simulation worker and used for the SHA-256 fingerprint. The model receives no future return rows. A complete future horizon must exist; the app rejects an incomplete window instead of silently shortening it. In particular, “one year” here is 252 trading days, not an exact calendar year; the bundled 2025 history has only 250 observations after 2024-12-31. Use an earlier origin or a shorter horizon.

Replay mode imposes no synthetic shock. This ensures the historical outcome and estimated distribution describe the same allocation. Hypothetical geopolitical shocks cannot be validated by comparing them to unrelated, actually observed history.

After the estimate is shown, the user clicks Reveal. The app compounds the same fixed weights over the held-out future slice, using the same frictionless daily rebalancing assumption. It reports final wealth, return, interval inclusion, actual minus modeled mean, absolute mean error, and a flat-wealth baseline's absolute error. The export also includes the observed daily path and a proper 90% interval score in dollars: width plus 20 times the amount below/above the range, when exceeded. Before Reveal, the download contains the forecast but not the unrevealed outcomes.

This UI separation is not a blinding/security mechanism: the full historical dataset is already accessible in the browser. It prevents future observations from entering the estimator, but does not prevent a researcher from knowing or inspecting the answer. Source prices are revised vendor-adjusted observations, not a point-in-time archive. Designs, dates and years have already been examined. These results must be labeled retrospective and exploratory. A single in-range result cannot establish calibration, superiority or a profitable strategy. Record a fixed evaluation protocol and use many predefined forecast origins for research claims; maintain a genuinely prospective track record separately.

`node tests/check_replay.mjs` checks the past/future split, invariance of predictions to altered future returns, sensitivity of realized outcomes to those changes, hand-calculated compounding/scoring, and rejection of incomplete windows, invalid dates and synthetic-shock comparisons. The 252-session test from 2024-12-27 ends on 2025-12-31; it is an illustrative retrospective check, not a pristine 2025 holdout.
