Basic Prerequisites: Linear Algebra & Matrices and Statistics & Inference (correlation matrices, dendrograms). (these are the folder-level prerequisites for pages 02–06; page 01 states its own, smaller, entry requirements)


1. Intuition & Practical Objective

Every quadratic allocator - Markowitz mean–variance, global minimum variance, and even a “naive” analytic risk model - ultimately evaluates a term like or . That matrix inverse is the point of failure. The sample covariance is the estimator of an -parameter object from numbers, so its worst-conditioned directions are almost pure estimation noise (see Covariance Shrinkage & RMT Denoising). Inverting does not merely propagate that noise - it amplifies it by , which is largest exactly where the eigenvalues are smallest. The optimizer then bets its largest positions on the assets whose covariances it knows least well.

Hierarchical Risk Parity (HRP) (López de Prado, 2016) sidesteps the inverse entirely. It does three things:

  1. Turn correlations into a metric distance. - a genuine metric on the assets.
  2. Build a hierarchical tree (dendrogram) from that distance and quasi-diagonalize the covariance matrix by reordering assets so similar ones sit adjacent.
  3. Allocate top-down by recursive bisection: split the portfolio’s risk budget between the two halves of each cluster in proportion to the inverse of their sub-portfolio variances, recursing until each asset has a weight.

The crucial structural fact: HRP never inverts and never solves a quadratic program. It only ever reads the diagonal of sub-blocks of and the correlation ranks. That makes it well-defined even when is singular () and dramatically less sensitive to estimation error than MVO - the property that earns it the phrase “the covariance matrix’s inverse is replaced by a tree.”

This folder is Pillar 5’s HRP topic-folder and it is a hub: (a) it gives the fast formula lookup below (job #1), and (b) it routes you through six sub-pages from raw intuition to the HRP/HERC comparison.

The one-sentence essence. “If the covariance matrix cannot be trusted enough to invert, do not invert it - cluster the assets on a correlation distance, quasi-diagonalize so clusters are contiguous, and recursively bisect the risk budget down that tree using only sub-block variances.”


2. Mathematical Ground Truth & Derivations

Quick-Reference Lookup (job #1). Formulas transcribed from López de Prado (2016, J. Portfolio Management 42(4)) and López de Prado, Advances in Financial Machine Learning (2018, Ch. 16); linkage recurrences cross-checked against Hastie, Tibshirani & Friedman (2009), ESL §14.3.12 (eqs. 14.41–14.43). Every number in the check column was re-executed and reproduced exactly (§3, snippets 01–06).

Notation: assets, returns covariance with , volatilities , correlation , dendrogram merge heights .

QuantityFormulaVerified check
Correlation-
Correlation distanceEQ1–EQ3 () → ; EQ1–BD1 () →
Euclidean embeddingidentical assets () →
Lance–Williams updategeneral agglomeration recurrence
- single linkageU5 heights
- complete linkageU5 heights
- average linkage (UPGMA)U5 heights
Quasi-diagonalizationleaf order in-order traversal of the dendrogramU8 order: BD1,BD2,EQ3,EQ1,EQ2,CM3,CM1,CM2
Cluster varianceBD1,BD2:
Split factortop U8 split:
HRP weightsBD1 , BD2 , EQ1
Risk ordering (U8) (holds here, not a theorem for HRP vs ERC)
Sample-cov collapse (MVO) reported vs true gross exposure , 21 of 50 short (§3, snippet 02)

Critical interpretation caveat. A low HRP weight is not an underweight of risk. HRP equalizes risk only within each subtree; across clusters it weights by inverse sub-portfolio variance, and it assigns each asset the product of the alphas on its root-to-leaf path. Two assets in the same cluster share every alpha above their common node, so their relative risk is set only by the splits below it. HRP is not an ERC portfolio - do not confuse the two (see snippet 06, max between HRP and HERC on the same tree).


3. Computational Implementation - the HRP engine

Runs on numpy only. The linkage is implemented from scratch (Lance–Williams), so nothing here depends on scipy. It reproduces every verified number above; the worked universe is 8 assets in three economically-distinct blocks (3 equity, 2 rates, 3 commodity).


4. Failure Modes & First-Principles Breakdowns

Hub signposts - the folder’s failure-mode analysis lives in 05 · Failure Modes & Practice. In one line each:

  1. Linkage choice is a modelling decision, not a detail. Single linkage chains (a bridge asset can be dragged into a cluster it does not belong to); complete linkage is conservative; the tree - and the weights - can differ materially. On a chained universe the top split flips from P3,P4 to P5P1,P2,P3,P4 (snippet 03).
  2. Clustering noise. A bootstrap of the same data rebuilds the tree on different samples: K=3 co-membership agreement is , but individual HRP weights carry a standard deviation of up to of their mean (snippet 05, EXP B).
  3. does not blow HRP up - it blows up its inputs. HRP is defined on a singular (it never inverts), but and the correlations feeding the distance are themselves noisy; HRP is robust, not immune.

5. References

  • López de Prado, Marcos (2016). “Building Diversified Portfolios that Outperform Out of Sample.” Journal of Portfolio Management 42(4):59–69. The HRP paper: correlation distance, tree clustering, quasi-diagonalization, recursive bisection, and the out-of-sample comparison against MVO and inverse-variance. The primary source this folder is transcribed from.
  • López de Prado, Marcos (2018). Advances in Financial Machine Learning, Wiley
  • Raffinot, Thomas (2017/18). “Hierarchical Clustering-Based Asset Allocation.” Journal of Portfolio Management 44(2):89–99. *HACA/HERC
  • Hastie, Tibshirani & Friedman (2009). The Elements of Statistical Learning (2nd ed.)
  • Maillard, Roncalli & Teïletche (2010). “The Properties of Equally Weighted Risk Contribution Portfolios.” J. Portfolio Management 36(4):60–70. *The ERC benchmark HRP is not (

6. Connected Graph Bridges

Beginner: start at 01 · Practitioner: start at 05