Portfolio Risk Budgeting with a Log-Barrier Optimization
Summary
The document explains how to derive long-only portfolio weights from target risk budgets. It presents a formulation attributed to Spinu that minimizes portfolio variance with a logarithmic penalty weighted by each asset’s risk budget, subject to weights summing to one. The covariance matrix and budget vector are the key inputs, and the example seeks weights aligned with a specified division of variance contribution.
Answers point to software implementing this approach, including a cyclical coordinate descent method described in a later research paper. One example reports weights for a five-asset covariance matrix and a chosen budget vector, illustrating that risk budgets need not imply equal capital weights. The material assumes nonnegative weights and a fully invested portfolio in the stated formulation; it does not explain handling additional constraints or how to scale the resulting portfolio to a separate target volatility. The example is illustrative, not evidence of out-of-sample performance.
Key ideas
- Risk budgeting sets target shares of portfolio risk contribution for individual assets.
- The cited optimization uses covariance risk and a log-barrier term weighted by each risk budget.
- The stated formulation assumes nonnegative weights that sum to one.
- A coordinate descent implementation is also cited for solving risk parity problems.
- The document does not detail how to impose additional portfolio constraints or target volatility.
Tags
Full text
# How to derive portfolio weights from risk budget
# How to derive portfolio weights from risk budget
Goal: I'm trying to frame target volatility investments given some view on what asset to overweight. For example, starting with a risk-parity allocation, tweak the marginal risk contribution of each asset (all equals in risk-parity) and derive the corresponding target weights of the portfolio.
Example: you want to invest in 3 assets. You are given the risk budget for each stock [0.5, 0.3, 0.2]. The goal is to derive the portfolio weights such that the marginal contribution of each asset to the variance of the portfolio is explained by respectively 50%, 30% and 20% for each asset. The goal is to find the portfolio weights $\mathbf{w} \in \mathbb{R}^3$ such that the target vol of the portfolio is $v \in \mathbb{R}^+$.
Question: what the relevant literature on portfolio construction from risk budgeting? A necessary condition for the answer is to provide references. Some python code which solves the example above for a given correlation matrix would be appreciated.
## Answer by Zé Vinícius (score 4, accepted)
https://quant.stackexchange.com/a/46813
What you want is to design a risk budgeting portfolio. If your constraints are only $\mathbf{1}^T\mathbf{w}=1$ and $\mathbf{w} \geq \mathbf{0}$, then the correct way to do it is to use the formulation proposed by Spinu [1]: $$\begin{array}{ll} \underset{\mathbf{w}}{\textsf{minimize}} & \frac{1}{2}\mathbf{w}^{T}\Sigma\mathbf{w} - \sum_{i=1}^{N}b_i\log(w_i)\\ \textsf{subject to} & \mathbf{1}^T\mathbf{w}=1. \end{array}$$ where $\mathbf{w}$ is the vector of portfolio weights, $\Sigma$ is the covariance matrix, and $b_i, i = 1, 2, ..., N,$ are the risk budgets.
I've implemented a solver for that optimization problem in both R and Python. The code is open source, you can check out the documentations at: https://github.com/dppalomar/riskParityPortfolio (R version) and https://github.com/dppalomar/riskparity.py (Python version).
As a code snippet, you can do it in one line of Python code:
```
import riskparityportfolio as rp
optimum_weights = rp.vanilla.design(cov, np.array([0.5, 0.3, 0.2]))
```
where `cov` is the covariance matrix of your assets.
[1] Florin Spinu, An Algorithm for Computing Risk Parity Weights, 2013. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2297383
## Answer by jaehyukchoi49 (score 2)
https://quant.stackexchange.com/a/71141
PyFENG package implements an improved cyclical coordinate descent (CCD) method based on Choi & Chen (2022):
- Choi J, Chen R (2022) Improved iterative methods for solving risk parity portfolio. Journal of Derivatives and Quantitative Studies 30. https://doi.org/10.1108/JDQS-12-2021-0031 (Open access)
Below is a 5 asset example. After installing PyFENG (`pip install pyfeng`), run
```
import numpy as np
import pyfeng as pf
cov = np.array([
[ 94.868, 33.750, 12.325, -1.178, 8.778 ],
[ 33.750, 445.642, 98.955, -7.901, 84.954 ],
[ 12.325, 98.955, 117.265, 0.503, 45.184 ],
[ -1.178, -7.901, 0.503, 5.460, 1.057 ],
[ 8.778, 84.954, 45.184, 1.057, 34.126 ]
])/10000
m = pf.RiskParity(cov=cov, budget=[0.1, 0.1, 0.2, 0.3, 0.3])
m.weight()
```
Output:
```
array([0.077, 0.025, 0.074, 0.648, 0.176])
```
See the PyFENG documentation for more options.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.