▶ Full Post Text
Hi everyone,
Like many here, I’ve spent years following the evidence-based investing literature. Coming from a STEM/Physics background, I eventually found myself wanting to go a step deeper than the conclusions—*to actually see the gears turn*.
Questions like: if I tilt toward small-cap value, how stable is that exposure in the specific ETFs I can actually buy? How much of it survives through time, and how much washes out into noise? Or, when applying a 4% rule, what changes if we stop assuming returns are independent and identically distributed and instead account for the clustering and regime-like behavior that show up in real markets? Or what if the future holds unexpected volatility shocks or real return drops.
To answer such questions in a hands-on, accessible way, and learn about the techniques used in academic finance I spent a few months putting together a simple (free and open-source) Python toolkit for **factor attribution, portfolio risk decomposition, and long-horizon outcome simulation**, built around ideas that come up often here: diversification, factor exposure, mean-variance optimisation, and the limits of backtests.
At a high level, the tool contains:
1. A GUI **portfolio builder**, sourcing data from Yahoo Finance
2. **Fama–French Five-Factor regressions** (static and rolling) on portfolios built from real-world ETFs denominated in various currencies
3. A mean–variance optimiser, visualisations of inter-asset correlations, risk and drawdowns
4. Simulator for long-horizon outcomes using **block-bootstrap Monte Carlo** methods rather than assuming independent returns
5. Testing engine for retirement withdrawal strategies under return, volatility, and inflation stress assumptions
[S&P 500 \(SPY\) under the 4% rule, with 3% inflation adjustment](https://preview.redd.it/ory2t6e17bdg1.png?width=1386&format=png&auto=webp&s=af7d3bc22c83a940668bfa005c4c1edb7439c265)
The emphasis is on **diagnostics and understanding**, not forecasts or prescriptions. Assumptions are intentionally simplified and explicitly documented (no transaction costs yet, static allocations, etc.). The goal is to make the statistical structure visible rather than hide it behind a polished output.
Why I’m posting here:
This community consistently has some of the most careful discussions I’ve seen around portfolio construction, factor tilts, and the gap between theory and what’s actually implementable. I’d gladly welcome:
\- Critical feedback on methodology or assumptions
\- Suggestions for analyses that would be useful from a Boglehead perspective
\- Ideas for making uncertainty and limitations clearer or more honest
\- Contributions or pull requests from anyone interested (please also feel free to fork if you wish)
Note: *This is a work in progress. Nothing in the project is financial advice, or intended as a prescription. I am not a financial professional.*
The repository, with full documentation, examples, and known limitations, is here:
[https://github.com/husainm97/quant-lab-alpha](https://github.com/husainm97/quant-lab-alpha)
If you’d rather skim, the README walks through the scope, assumptions, and screenshots of the analysis panels. As a fan of the Rational Reminder podcast, the factor regressions are benchmarked against Ben Felix's paper on *Five Factor Investing with ETFs* in an explanatory Jupyter notebook for transparency.
Thanks for taking the time to read.
—
(With many thanks to the mod team for approving this post.)