project

Hierarchical Bayesian Portfolio Optimization

resultBayesian covariance prototype with repo; no universal return claim.

A Bayesian covariance estimation project built after sample covariance made mean variance portfolios unstable.

status: complete prototypemethod: NUTS and LKJ priorsconfidence: medium

Problem

Mean variance optimization is brutally sensitive to covariance estimates. With a modest time window and multiple assets, sample covariance can be mostly noise, and the optimizer will still allocate as if the noise is information.

Approach

Built a hierarchical covariance model in PyMC with LKJ priors on correlation and half Cauchy priors on volatilities, then used NUTS to sample a posterior instead of handing one point estimate to the optimizer.

The goal was not just a portfolio weight vector. It was an uncertainty distribution around the covariance structure, so the allocation could reflect how much the data actually knew.

What I tried that failed

The first mean variance runs produced concentrated portfolios that looked decisive and changed too much from one window to the next.

Treating the sample covariance matrix as truth hid the uncertainty in the most important input, so the optimizer happily found fragile solutions.

Finding

The Bayesian version made the uncertainty visible and produced more stable behavior in the experiments. I treat that as a modeling result rather than a universal portfolio performance claim.

How to reproduce

The public repo contains the model and experiment code. A next pass should freeze datasets and promote the most important posterior diagnostics into the README.