Main Content

riskBudgetingPortfolio

Compute risk budgeting portfolios

Since R2022a

Description

pwgt = riskBudgetingPortfolio(Sigma) computes risk budgeting portfolios for long-only, fully invested, risk budgeting portfolios. When a budget input argument is not provided, the budget is set the same for all assets.

A risk budgeting portfolio is an allocation strategy that focuses on the allocation of risk without considering the returns. The goal of this strategy is to ensure that each asset in a portfolio contributes a given target risk level to the overall portfolio volatility.

example

pwgt = riskBudgetingPortfolio(Sigma,budget) computes risk budgeting portfolios for the long-only, fully invested, risk budgeting portfolios associated with the target risk budgets (Budget).

example

pwgt = riskBudgetingPortfolio(___,Name=Value) specifies options using name-value arguments in addition to the input arguments in the previous syntaxes.

example

[pwgt,exitflag] = riskBudgetingPortfolio(___,Name=Value) add an output argument for exitflag and specifies options using name-value arguments in addition to the input arguments in the previous syntax.

example

Examples

collapse all

Use riskBudgetingPortfolio to compute long-only, fully invested, risk budgeting portfolios.

Assume the returns covariance matrix is given by the following values.

Sigma = [0.0100    0.0075    0.0100    0.0150
         0.0075    0.0225    0.0150    0.0225
         0.0100    0.0150    0.0400    0.0450
         0.0150    0.0225    0.0450    0.0900];

When a budget input argument is not provided, by default, the riskBudgetingPortfolio function computes a risk parity portfolio. The riskBudgetingPortfolio default is to consider that the risk contribution is the same for all assets and the weights are long-only and fully invested.

pwgt = riskBudgetingPortfolio(Sigma)
pwgt = 4×1

    0.4101
    0.2734
    0.1899
    0.1266

However, if a vector is passed for the optional input budget, the riskBudgetingPortfolio function computes the long-only, fully invested, risk budgeting portfolios that achieve the target risk contributions specified in budget.

pwgt = riskBudgetingPortfolio(Sigma, [0.1;0.2;0.3;0.4])
pwgt = 4×1

    0.2292
    0.2800
    0.2633
    0.2275

Use riskBudgetingPortfolio to compute the risk budgeting portfolio when the asset returns contain NaN values.

Assume the returns covariance matrix is given by the following values.

load('CAPMuniverse.mat','AssetsTimeTable')
Sigma = cov(AssetsTimeTable{:,1:12},'partialrows')
Sigma = 12×12

    0.0012    0.0005    0.0005    0.0005    0.0005    0.0001    0.0004    0.0003    0.0006    0.0003    0.0005    0.0006
    0.0005    0.0023    0.0007    0.0005    0.0009    0.0001    0.0005    0.0003    0.0006    0.0004    0.0006    0.0011
    0.0005    0.0007    0.0012    0.0006    0.0007    0.0000    0.0006    0.0004    0.0007    0.0005    0.0008    0.0008
    0.0005    0.0005    0.0006    0.0009    0.0006    0.0000    0.0005    0.0003    0.0006    0.0004    0.0005    0.0006
    0.0005    0.0009    0.0007    0.0006    0.0017    0.0002    0.0005    0.0003    0.0005    0.0004    0.0007    0.0010
    0.0001    0.0001    0.0000    0.0000    0.0002    0.0006   -0.0000    0.0000    0.0000    0.0000    0.0000    0.0002
    0.0004    0.0005    0.0006    0.0005    0.0005   -0.0000    0.0009    0.0003    0.0005    0.0003    0.0005    0.0005
    0.0003    0.0003    0.0004    0.0003    0.0003    0.0000    0.0003    0.0004    0.0003    0.0002    0.0004    0.0004
    0.0006    0.0006    0.0007    0.0006    0.0005    0.0000    0.0005    0.0003    0.0010    0.0005    0.0006    0.0006
    0.0003    0.0004    0.0005    0.0004    0.0004    0.0000    0.0003    0.0002    0.0005    0.0006    0.0004    0.0005
      ⋮

If only the covariance matrix is provided, the riskBudgetingPortfolio default is to consider that the risk contribution is the same for all assets and the weights are long-only and fully invested. Basically, the default is to obtain the risk parity portfolio.

pwgt = riskBudgetingPortfolio(Sigma)
pwgt = 12×1

    0.0718
    0.0576
    0.0610
    0.0757
    0.0574
    0.1940
    0.0817
    0.1178
    0.0676
    0.0981
      ⋮

However, if a vector is passed for the optional input budget, then the risk budgeting portfolio is computed using the default ccd algorithm.

pwgt = riskBudgetingPortfolio(Sigma,[0.1; 0.04; 0.2; 0.05; 0.1; 0.1; 0.1; 0.05; 0.1; 0.03; 0.1; 0.03],Algorithm="ccd")
pwgt = 12×1

    0.0871
    0.0315
    0.1415
    0.0482
    0.0717
    0.2235
    0.0995
    0.0757
    0.0829
    0.0386
      ⋮

This example shows how to use riskBudgetingPortfolio to compute the risk budgeting portfolio when the budget values are a matrix.

Assume the returns covariance matrix is given by the following values.

Sigma = [0.0100    0.0075    0.0100    0.0150;
         0.0075    0.0225    0.0150    0.0225;
         0.0100    0.0150    0.0400    0.0450;
         0.0150    0.0225    0.0450    0.0900];

If only the covariance matrix is provided, the riskBudgetingPortfolio default is to consider that the risk contribution is the same for all assets and the weights are long-only and fully invested. Basically, the default is to obtain the risk parity portfolio.

pwgt = riskBudgetingPortfolio(Sigma)
pwgt = 4×1

    0.4101
    0.2734
    0.1899
    0.1266

If a matrix is passed for the optional input budget, then the risk budgeting portfolio is computed.

B = [0.25    0.10    0.10828;
     0.25    0.20    0.17197;
     0.25    0.30    0.28026;
     0.25    0.40    0.43949];
pwgt = riskBudgetingPortfolio(Sigma,B)
pwgt = 4×3

    0.4101    0.2292    0.2500
    0.2734    0.2800    0.2500
    0.1899    0.2633    0.2500
    0.1266    0.2275    0.2500

Input Arguments

collapse all

Covariance matrix of returns, specified using an NumAssets-by-NumAssets positive semidefinite covariance matrix.

Sigma and budget must have the same number of NumAssets.

Note

If Sigma is not a symmetric positive semidefinite matrix, use nearcorr to create a positive semidefinite matrix.

Data Types: double

Target risk budget for each asset, specified using an NumAssets-by-NumPortfolios matrix. budget must be nonnegative and all columns must sum to 1 because the values for budget represent the percentage of risk that each asset contributes of the total portfolio risk.

budget and Sigma must have the same number of NumAssets.

Data Types: double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: pwgt = riskBudgetingPortfolio(Sigma, [0.1;0.2;0.3;0.4],Algorithm="newton",BudgetTolerance=1e6)

Optimization algorithm, specified as Algorithm and a character vector or string:

  • "ccd" — Cyclical coordinate descent algorithm

  • "newton" — Newton algorithm with backtracking line-search

Data Types: char | string

Deviation tolerance from target budget, specified as BudgetTolerance and a scalar positive numeric.

Data Types: double

Maximum number of iterations allowed for the Algorithm, specified as MaxIterations and a scalar positive integer.

Data Types: double

Output Arguments

collapse all

Portfolio weights, returned as a matrix in which each column represents a portfolio.

Indication of why the algorithm stopped, returned as a 1-by-NumPortfolios vector with one of the following values:

  • 1 — The weights of the portfolio achieve the target risk budget up to BudgetTolerance accuracy.

  • 0 — The number of iterations exceeded MaxIterations.

  • -1 — The solver cannot find a descent direction. This value applies only to the "newton" option for the Algorithm.

.

Version History

Introduced in R2022a