Hierarchical Risk Parity vs Mean Variance Optimization
You have a candidate list, a few years of end-of-day prices, and one decision to make before you commit capital: do you hand the covariance matrix to a mean-variance optimizer, or do you let hierarchical risk parity cluster the assets and allocate down the tree?
Both methods chase the same goal — a portfolio weighted toward stocks that correlate weakly with each other, and therefore a portfolio with lower volatility than an equal-weight or market-cap-weight basket of the same names. They differ in where the weights come from. Mean variance optimization (MVO) solves for them from a covariance matrix. Hierarchical risk parity (HRP) derives them from the correlation structure itself, without ever inverting that matrix.
That single difference explains most of the practical behaviour — the stability of the output, the concentration you see in the weights, and how badly each method reacts when your inputs are noisy. This article compares them on assumptions, behaviour, and fit, and shows where each belongs in a real workflow. RSJ Portfolio implements both, so the comparison is one you can run on your own data rather than take on faith.
What Each Method Actually Does
Mean Variance Optimization (MVO)
MVO is Markowitz’s framework: for a given level of expected return, find the weights with the lowest variance — or, flipped around, for a given level of risk, find the weights with the highest expected return. The math is a constrained optimization over the covariance matrix of asset returns.
The textbook minimum-variance solution (long-only constraint ignored, for clarity) looks like this:
import numpy as np
import pandas as pd
prices = pd.read_csv("eod_prices.csv", index_col="date", parse_dates=True)
returns = prices.pct_change().dropna()
cov = returns.cov().values
# minimize w'Σw subject to sum(w) = 1, unconstrained closed form
inv_cov = np.linalg.inv(cov)
ones = np.ones(len(cov))
w_mvo = inv_cov @ ones / (ones @ inv_cov @ ones)
print(w_mvo.round(4))
The two operations that decide everything: returns.cov() and np.linalg.inv(cov). If the covariance estimate is off, the inverse amplifies the error — often into extreme long and short positions that no sensible investor would hold. A useful diagnostic is the condition number:
print("condition number:", round(np.linalg.cond(cov), 1))
A large condition number means the matrix is close to singular, and small data changes will swing the weights. That is the failure mode MVO is famous for.
Hierarchical Risk Parity (HRP)
HRP takes a different route. It converts the correlation matrix into a distance measure, clusters assets into a hierarchy, then splits capital recursively down that tree — at each split, allocating between the two branches in inverse proportion to their risk.
from scipy.cluster.hierarchy import linkage
from scipy.spatial.distance import squareform
corr = returns.corr()
dist = np.sqrt(0.5 * (1 - corr)) # correlation distance
link = linkage(squareform(dist.values, checks=False), method="single")
# then: bisect the tree, weight each branch by inverse variance, recurse
There is no matrix inversion anywhere in that pipeline. The correlation matrix is used as a structure — who sits next to whom — rather than as a system of equations to be solved.
The difference that matters
MVO is an optimization over estimated parameters. HRP is a recursive allocation over an estimated structure. Parameters are fragile; structure is comparatively stable. Two stocks that moved together for three years will usually still cluster together after you add one more year of data, even if the exact correlation coefficient drifts.
Both methods can be pointed at different objectives. Minimum volatility, maximum Sharpe ratio, minimum semi variance — these are targets, not methods, and RSJ Portfolio exposes them as selectable objectives on top of the allocation engine.
The Landscape of Allocation Methods
HRP and MVO are not the only two options. An optimizer worth using should offer a set, because the right choice depends on what you believe about your inputs:
- Minimum volatility — the classic defensive target: lowest portfolio variance, no return forecast required.
- Maximum Sharpe ratio — requires a return model, since it trades risk against expected return.
- Minimum semi variance — penalizes only downside dispersion, which lines up better with how investors actually experience risk. Weak downside correlation is a different and often more useful signal than weak total correlation.
- Hierarchical risk parity — clustering-based, no matrix inversion, robust when correlations are unstable.
- Conditional value at risk (CVaR) — an objective that targets tail losses rather than variance.
RSJ Portfolio supports all of these as selectable allocation methods, plus eight risk models and return models. That combination matters more than people expect: the choice of risk estimator — sample covariance, semi-covariance, CVaR, and the other models — frequently moves the resulting weights further than switching the allocation method does. If you want the details of the CVaR objective itself, we covered it in Conditional Value at Risk in Portfolio Optimization, Explained.
Weight constraints apply across all of them. A maximum weight per asset, long-only bounds, or a floor on position size will change an HRP allocation and an MVO allocation in the same place: they stop the optimizer from doing something you would never do by hand anyway.
Selection Criteria: Ease, Automation, Security, Price, Integration
When you compare tools rather than textbooks, the questions shift from “which estimator is better” to “which one can I actually run every month without it becoming a project.”
Ease. RSJ Portfolio is a Windows desktop application with a guided workflow — selection, recommendation, configuration. You search for symbols, build a candidate list, pick an objective and a risk model, and read the resulting allocation. None of the linear algebra above is exposed, which is the point: the app exists so you decide what to optimize, not how to invert a matrix.
Automation. Prices are cached locally, so a repeat run against the same candidate list does not re-download history. That turns re-optimization from a data-fetching chore into a five-minute check. We walked through the mechanics of that in Automating Repeat Portfolio Optimization Runs With a Local Price Cache.
Security and data. All computation is local. Price data from the supported providers is cleaned through a documented pipeline and stored in a local cache; nothing about your candidate list or your allocation leaves the machine. The cleaning step matters more than it sounds — splits, stale quotes, and mismatched currencies will quietly wreck a covariance estimate, and checking for that is a habit worth building (How to Check If a Portfolio Optimizer Uses Look-Ahead Bias).
Price. A single-user license with a one-time checkout — no subscription. Current details, including what the license covers, are on the pricing page.
Integration. Allocations are exportable for further analysis, and portfolios quoted in several currencies get a defined conversion path rather than a silent mix of units.
Side-by-Side Comparison
| Method | Core idea | Robustness to estimation error | Typical use case | RSJ Portfolio support |
|---|---|---|---|---|
| Hierarchical Risk Parity (HRP) | Cluster assets by correlation distance, then allocate capital recursively down the tree | High — no matrix inversion; weights move smoothly as correlations drift | Many assets, unstable correlations, no strong return views | Selectable allocation method |
| Mean Variance Optimization (MVO) | Maximize expected return for a given risk (or minimize risk for a given return) via the covariance matrix | Lower — sensitive to both covariance and return estimates; tends to concentrate | Fewer assets, a stable covariance estimate, high-confidence return forecasts | Selectable allocation method |
The practical test is not which table cell sounds better — it is what each method does to your candidate list. RSJ Portfolio lets you run both against the same symbols, the same date range, and the same risk model, and compare the resulting allocations and risk metrics directly. That side-by-side run is usually more informative than any general rule of thumb, because the answer depends on how correlated your specific universe happens to be.
Verdict: Who Should Pick Which?
Choose MVO if you have return forecasts you genuinely trust and a covariance estimate you are confident in. It is the standard for mean-variance efficiency, it optimizes the trade-off explicitly, and it says exactly what it is doing. If your universe is small, your history is clean, and your views are strong, MVO will use that information more aggressively than HRP ever will.
Choose HRP if you are more worried about estimation error than about squeezing out an extra basis point of expected return. It produces more diversified, more stable allocations, it degrades gracefully when correlations shift, and it does not require you to invert anything. For a universe of dozens of names — where the covariance matrix is mostly noise anyway — that robustness is the whole argument.
In practice, run both. Many quants do. When HRP and MVO agree, you have a portfolio you can defend. When they disagree sharply, the disagreement itself is the signal: it usually means the covariance estimate is unstable or the return forecasts are doing more work than the data supports. RSJ Portfolio supports both methods with selectable risk models, objectives, and weight constraints, so the comparison is a configuration change rather than a separate research project. Reading the output of that comparison — weights, risk contributions, concentration — is its own skill; we covered it in How to Read Optimizer Allocation Weights and Risk Model Output.
FAQ
Is HRP always better than MVO?
No. HRP tends to be more robust when correlations are unstable or the number of assets is large, because it avoids inverting the covariance matrix. MVO can be superior when you have high-confidence return forecasts and a stable covariance estimate. The best choice depends on your data and objectives.
Can I use both methods in RSJ Portfolio?
Yes. RSJ Portfolio supports hierarchical risk parity, minimum volatility, maximum Sharpe ratio, minimum semi variance, and conditional value at risk as selectable allocation methods. You can run both HRP and MVO on the same candidate list and compare the results.
What data do I need to run these optimizers?
You need historical end-of-day prices for your candidate stocks. RSJ Portfolio supports several data providers, cleans the price data, and caches it locally so you can run repeated optimizations without re-downloading.
How does RSJ Portfolio handle correlation and volatility reduction?
RSJ Portfolio analyses the return correlation between stocks and allocates capital to candidates that correlate weakly — or whose downside correlates weakly — which reduces the volatility of the resulting portfolio. It uses modern portfolio theory with selectable objectives, risk estimators, and weight constraints.
Conclusion
HRP and MVO are not competitors so much as answers to different questions. MVO asks what the optimal weights are, given your estimates. HRP asks how the assets relate to each other and splits capital accordingly. If your inputs are trustworthy, the first question is the more useful one. If they are not — and with real market data they rarely are, in full — the second is the safer bet.
The only way to know which side your portfolio falls on is to run both and look at the weights. Download the Windows installer from the downloads page, build your candidate list, and run the same universe through HRP and minimum volatility in one sitting. The differences will tell you more about your data than this article can.
Related posts
- Conditional Value at Risk in Portfolio Optimization, Explained
- How to Check If a Portfolio Optimizer Uses Look-Ahead Bias
- Automating Repeat Portfolio Optimization Runs With a Local Price Cache