# Risk Budgeting Portfolio

This example shows how to use `riskBudgetingPortfolio`

to create a risk budgeting portfolio and `portfolioRiskContribution`

to compute the risk contribution of the assets in the portfolio.

Risk budgeting is a portfolio allocation strategy that focuses on the allocation of risk to define the weights of a portfolio. The risk budgeting portfolio is constructed by ensuring that the risk contribution of each asset to the portfolio overall risk matches a target risk budget.

A common risk budgeting portfolio is the risk parity or equal risk contribution portfolio. For risk parity portfolios, the goal is to ensure that all assets contribute equally to the portfolio risk, that is, the target risk budget is the same for all assets. Key advantages of the risk budgeting portfolio are stability and diversification of weights:

**Stability of the allocations**: The weights of the risk parity portfolio are more robust to changes in the returns covariance than the weights of the mean-variance portfolio.**Diversification of the portfolio weights**: The risk parity portfolio keeps the portfolio from concentrating in just a few number of assets.

This example follows the example in Section 3.1.1 of Bruder and Roncalli.[1]

### Define the Asset Returns Covariance

Define the covariance matrix of the asset returns (`Sigma`

). `Sigma`

must be a positive semidefinite matrix.

% Define the returns covariance matrix. sigma = [0.2; 0.21; 0.1]; % Assets risk rho = 0.8; % Assets correlation C = @(rho) [ 1 rho rho; rho 1 rho; rho rho 1 ]; % Uniform correlation Sigma = corr2cov(sigma,C(rho)); % Covariance % Check that Sigma is positive semidefinite. All % eigenvalues should be nonnegative (>= 0). eig(Sigma)

`ans = `*3×1*
0.0026
0.0084
0.0831

### Create Risk Budgeting Portfolio

Use `riskBudgetingPortfolio`

with the covariance matrix (`Sigma`

) and a vector of risk budgets (`budget`

) to compute the long-only fully invested risk budgeting portfolio. When you specify the target risk budget, the function computes the risk parity portfolio.

```
% Define a risk budget.
budget = [0.5; 0.25; 0.25];
wRB = riskBudgetingPortfolio(Sigma,budget)
```

`wRB = `*3×1*
0.3912
0.1964
0.4124

### Compute Risk Contribution for Each Asset

Use `portfolioRiskContribution`

to check that the risk contribution of the portfolio obtained in `wRB`

matches the target risk budget. By default, `portfolioRiskContribution`

computes the relative risk contribution of a given portfolio (`wRB`

) with respect to the provided covariance matrix (`Sigma`

).

prc = portfolioRiskContribution(wRB,Sigma)

`prc = `*3×1*
0.5000
0.2500
0.2500

As expected, the risk contribution of each asset matches the target risk budget (`budget`

). You can also use `portfolioRiskContribution`

to compute the absolute risk contribution of each asset.

`mrc = portfolioRiskContribution(wRB,Sigma,RiskContributionType="absolute")`

`mrc = `*3×1*
0.0751
0.0376
0.0376

### Compare Risk Budgeting Portfolios with Mean-Variance

While the allocation strategy of the risk budgeting portfolio focuses only on the risk, the allocation strategy of the mean-variance portfolio also makes use of the assets' return information.

```
% Define the returns mean.
mu = [0.08; 0.08; 0.05];
```

Initialize a `Portfolio`

object with default constraints using `Sigma`

and `mu`

.

```
% Define the mean-variance portfolio.
p = Portfolio(AssetMean=mu,AssetCovar=Sigma);
p = setDefaultConstraints(p);
```

Compute the portfolio on the efficient frontier with a target volatility equal to the risk attained by the risk budgeting portfolio previously computed as `wRB`

.

```
% Define the target volatility.
targetRisk = sqrt(wRB'*Sigma*wRB);
wMV = estimateFrontierByRisk(p,targetRisk)
```

`wMV = `*3×1*
0.3846
0.2030
0.4124

Assume that the correlation between the assets is `0.7`

instead of `0.8`

. Use the new covariance matrix (`Sigma7`

) to compute the same mean-variance and risk budgeting portfolios.

% Update the covariance matrix. Sigma7 = corr2cov(sigma,C(0.7)); % Compute the mean-variance portfolio. p = Portfolio(AssetMean=mu,AssetCovar=Sigma7); p = setDefaultConstraints(p); wMV_rho7 = estimateFrontierByRisk(p,targetRisk)

`wMV_rho7 = `*3×1*
0.3841
0.2600
0.3559

```
% Compute the risk budgeting portfolio.
wRB_rho7 = riskBudgetingPortfolio(Sigma7,budget)
```

`wRB_rho7 = `*3×1*
0.3844
0.1986
0.4170

What if the correlation is `0.9`

instead of `0.8`

(`Sigma9`

) and the risk of the second asset is `0.18`

instead of `0.21`

?

% Update the covariance matrix. sigma2 = sigma; sigma2(2) = 0.18; Sigma9 = corr2cov(sigma2,C(0.9)); % Compute the mean-variance portfolio. p = Portfolio(AssetMean=mu,AssetCovar=Sigma9); p = setDefaultConstraints(p); wMV_rho9 = estimateFrontierByRisk(p,targetRisk)

`wMV_rho9 = `*3×1*
0.0000
0.6612
0.3388

```
% Compute the risk budgeting portfolio.
wRB_rho9 = riskBudgetingPortfolio(Sigma9,budget)
```

`wRB_rho9 = `*3×1*
0.3852
0.2196
0.3952

What if the original covariance (`Sigma`

) is correct, but the mean of the first asset is `0.09`

instead of `0.08`

?

% Update the returns vector. mu1 = mu; mu1(1) = 0.09; % Compute the mean-variance portfolio. p = Portfolio(AssetMean=mu1,AssetCovar=Sigma); p = setDefaultConstraints(p); wMV_mu1 = estimateFrontierByRisk(p,targetRisk)

`wMV_mu1 = `*3×1*
0.5664
0
0.4336

```
% Compute the risk budgeting portfolio.
wRB_mu1 = riskBudgetingPortfolio(Sigma,budget)
```

`wRB_mu1 = `*3×1*
0.3912
0.1964
0.4124

The weights of the risk budgeting portfolio are more stable than those of the mean-variance portfolio. When the change is in the expected returns, the risk budgeting portfolio remains the same as in the original problem. The risk budgeting portfolio accounts only for changes to the covariance matrix and a change in the vector of expected returns does not affect the weights allocation.

```
% Display a table of weights for the risk budgeting portfolios.
RBtable = table(wRB,wRB_rho7,wRB_rho9,wRB_mu1)
```

`RBtable=`*3×4 table*
wRB wRB_rho7 wRB_rho9 wRB_mu1
_______ ________ ________ _______
0.39123 0.38444 0.38521 0.39123
0.19638 0.19857 0.21957 0.19638
0.41239 0.41699 0.39522 0.41239

```
% Display a table of weights for the mean-variance portfolios.
MVtable = table(wMV,wMV_rho7,wMV_rho9,wMV_mu1)
```

`MVtable=`*3×4 table*
wMV wMV_rho7 wMV_rho9 wMV_mu1
_______ ________ __________ _______
0.38462 0.38411 1.1102e-16 0.56638
0.20301 0.26003 0.6612 0
0.41237 0.35586 0.3388 0.43362

The results on these tables show that the risk budgeting portfolio is more robust to changes in the parameters. The weights in the third and fourth column of the mean-variance portfolio table change so drastically that the portfolios stop investing in some assets altogether when the parameters change. The mean-variance portfolio tends to concentrate weights in a few number of assets, which decreases portfolio diversification.

### References

[1] Bruder, B. and T. Roncalli. *Managing Risk Exposures Using the Risk Budgeting Approach*. January 2012. Available at SSRN: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2009778.

## See Also

`portfolioRiskContribution`

| `riskBudgetingPortfolio`

| `Portfolio`

| `setDefaultConstraints`

| `plotFrontier`

| `estimateFrontierLimits`

| `estimateFrontierByRisk`

| `estimatePortRisk`

## Related Examples

- Backtest Using Risk-Based Equity Indexation
- Creating the Portfolio Object
- Working with Portfolio Constraints Using Defaults
- Estimate Efficient Portfolios for Entire Efficient Frontier for Portfolio Object
- Estimate Efficient Frontiers for Portfolio Object
- Portfolio Optimization Against a Benchmark
- Portfolio Optimization Examples Using Financial Toolbox
- Portfolio Optimization Using Social Performance Measure
- Diversify Portfolios Using Custom Objective