apaMeanVariance.Strategies.RiskBudgeting.Weights.FromCovars(RiskBudget, Covariances, DoShowVolRetOtherwiseWeightsOnly)
=apaMeanVariance.Strategies.RiskBudgeting.Weights.FromCovars(RiskBudget, Covariances, DoShowVolRetOtherwiseWeightsOnly)Result
Returns the constituent weights of the fully invested and long-only risk budgeting portfolio, i.e. the portfolio which implements a target vector of percentage volatility contributions. The weights are positive, sum to 1, and the percentage contribution of each asset to portfolio volatility (as calculated by apaContribution.Volatility) equals its risk budget. Optionally, the portfolio volatility and expected return are shown in front of the weights.
Syntax
RiskBudget: 1 x n vector of target percentage contributions to portfolio volatility; budgets must be non-negative and are normalized to sum to 1; assets with a budget of 0 receive a weight of 0
Covariances: n x n covariance matrix; must be positive semidefinite
DoShowVolRetOtherwiseWeightsOnly: optional; TRUE returns the portfolio volatility sqrt(w'Σw), calculated from Covariances and therefore a sample or population volatility as Covariances is, the portfolio expected return, which is #N/A because the function has no expected returns argument, and the n constituent weights, i.e. a 1 x (n + 2) row; FALSE returns the weights only; default: FALSE
Algorithm
With the risk budgets b(i) normalized to sum to 1 and the covariance matrix Σ, the risk budgeting portfolio solves
At the optimum, the percentage contribution of each asset to portfolio variance, and therefore also to portfolio volatility, equals its budget:
Because the budgets sum to 1, the objective does not change if all weights are multiplied by a positive constant. The budget constraint therefore only fixes the scale, and the function solves the equivalent unconstrained and strictly convex problem of Spinu (2013), followed by a normalization of the solution:
The first-order conditions y(i) (Σy)(i) = b(i) are exactly the risk budgeting conditions. F is minimized with a damped Newton method. Gradient, Hessian, Newton decrement λ and update are
The iteration starts at y = b / sqrt(b'Σb). The Hessian is positive definite, and each Newton system is solved with a Cholesky factorization. The damped steps guarantee convergence from any starting point (F is self-concordant), and once the Newton decrement is small, full Newton steps converge quadratically. Steps are additionally shortened if necessary to keep all y(i) strictly positive. The iteration stops when λ falls below 1E-12, which typically takes fewer than 20 iterations; the risk contributions then match the budgets to machine precision.
Remarks
For a positive semidefinite covariance matrix and positive budgets, the solution exists and is unique, because the logarithmic terms keep all weights strictly positive. Singular covariance matrices, e.g. with duplicated assets, are accepted; matrices that are not positive semidefinite return an error message.
The portfolio is long-only and fully invested; additional bounds or linear constraints are not supported, because with binding constraints the budgets can in general no longer be met. apaMeanVariance.Strategies.RiskParity.Weights.FromCovars is the special case with equal budgets.
Pressing Esc aborts the calculation; the function then returns "Calculation aborted by user."
