03 — Portfolio construction
A look-ahead in my own published backtest, found and measured
Macro regimes from 120+ FRED-MD indicators, reduced by PCA and clustered by two-step K-Means, drive an MSCI sector allocation with every macro input lagged by its publication delay. The published backtest fitted the regime detector once on 1959–2023 data, so every month it traded before 2024 carried a label fitted with hindsight. Refitting the detector every January, on only the data available then, takes the headline Ridge book from a Sharpe of 0.65 to 0.35, below equal weight, while the simpler regime-mean forecaster holds up as the best long-short book in both universes: 0.77 in developed markets and 0.73 in emerging.
Position sizing is a convex program with trading costs inside the objective: an L1 turnover penalty, a Cholesky second-order-cone risk term and a quadratic impact term, re-solved monthly over a receding horizon. The impact coefficient is assumed, not fitted, so the useful test is sweeping it. Under walk-forward regimes the multi-period book holds a net Sharpe between 0.50 and 0.70 from 0 to 100 bps of linear cost, while the frictionless book falls to −0.28.
Where it does not hold: in emerging markets the frictionless book still leads at 10 bps, and the cost-aware book wins there only at high cost.
Audit of my own detector: against NBER dating and two alternatives on the same 798-month panel, the K-Means regime model calls a new regime every 3.8 months where NBER changes its mind every 44.7. It wins the cluster-quality scores only because they measure the Euclidean separation it optimizes. It is too jumpy, and that is the next thing to fix.
github.com/tejaspandya9598/macro-regime-allocation ↗