HRP | R Documentation |
Computes optimal HRP portfolio with full investment and weight constraints.
HRP(sigma, UB = NULL, LB = NULL, tau = 0, ...)
sigma |
a |
UB |
scalar or |
LB |
scalar or |
tau |
trade-off between naive (0) or cluster-based (1) tree-splitting (see Details). |
... |
arguments passed to |
The argument sigma
is a covariance matrix and does not need to be positive definite.
Hierarchical clustering is performed using the cluster
-package. If
cluster_method == 'DIANA'
, the function cluster::diana
is used
to compute a cluster dendrogram, otherwise the function cluster::agnes(., method = cluster_method)
is used. Default is single-linkage agglomerative nesting.
By default, HRP constructs a balanced graph by bisecting each cluster at the
central location (tau = 0)
. Alternatively it is possible to split along
the actual cluster dendrogram (tau = 1)
, or to trade-off the objectives
by setting 0 < tau < 1
. In the latter case, tau
is the proportion
of nodes on the left and right of the central split from which to select the
optimal splitting location (i.e. split at the optimal location that is at
most tau\times x N/2
elements from the central split).
A (N \times 1)
vector of optimal portfolio weights.
Johann Pfitzinger
Lopez de Prado, M. (2016). Building Diversified Portfolios that Outperform Out-of-Sample. SSRN Electronic Journal.
Pfitzinger, J., Katzke, N. (2019). A Constrained Hierarchical Risk Parity Algorithm with Cluster-Based Capital Allocation. Stellenbosch University, Department of Economics. Working Paper 14/2019.
# Load returns of assets or portfolios
data("Industry_10")
rets <- Industry_10
sigma <- cov(rets)
HRP(sigma, UB = 0.15, tau = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.