| Title: | Hierarchical Risk Clustering Portfolio Allocation Strategies |
|---|---|
| Description: | Machine learning hierarchical risk clustering portfolio allocation strategies. The implemented methods are: Hierarchical risk parity (De Prado, 2016) <DOI: 10.3905/jpm.2016.42.4.059>. Hierarchical clustering-based asset allocation (Raffinot, 2017) <DOI: 10.3905/jpm.2018.44.2.089>. Hierarchical equal risk contribution portfolio (Raffinot, 2018) <DOI: 10.2139/ssrn.3237540>. A Constrained Hierarchical Risk Parity Algorithm with Cluster-based Capital Allocation (Pfitzingera and Katzke, 2019) <https://www.ekon.sun.ac.za/wpapers/2019/wp142019/wp142019.pdf>. Hierarchical Risk Budgeting (Koumou, 2024) <DOI: 10.3905/jfds.2024.1.156>. |
| Authors: | Carlos Trucios [aut, cre] (ORCID: <https://orcid.org/0000-0001-8746-8877>), Moon Jun Kwon [aut], São Paulo Research Foundation (FAPESP), grants 2022/09122-0, 2025/06131-7 and 2025/08502-2 [fnd], Programa de Incentivo a Novos Docentes da UNICAMP (PIND), grant 2525/23 [fnd] |
| Maintainer: | Carlos Trucios <[email protected]> |
| License: | GPL-2 |
| Version: | 1.1.0 |
| Built: | 2026-10-20 11:50:48 UTC |
| Source: | https://github.com/ctruciosm/hierportfolios |
Dataset used to illustrate how to use the portfolio allocation strategies implemented in this package.
Performs the Constrained Hierarchical Risk Parity portfolio strategy proposed by Pfitzinger and Katzke (2019).
DHRP_Portfolio(covar, graph = FALSE, tau = 1, UB = NULL, LB = NULL)DHRP_Portfolio(covar, graph = FALSE, tau = 1, UB = NULL, LB = NULL)
covar |
Covariance matrix of returns. The covariance matrix is converted into a correlation matrix, which is then used to construct the distance matrix for hierarchical clustering. |
graph |
To plot de dendrogram set this value to TRUE. By default this value is equal to FALSE. |
tau |
Parameter to evaluate asset similarity at the cluster edges. Default value is 1. |
UB |
Upper bound for weights. By default this value is equal to NULL |
LB |
Lower bound for weights. By default this value is equal to NULL |
portfolio weights
Carlos Trucios and Moon Jun Kwon
Pfitzinger, J., and Katzke, N. A constrained hierarchical risk parity algorithm with cluster-based capital allocation (2019). Working Paper.
HCAA_Portfolio, HRP_Portfolio, HRB_Portfolio and HERC_Portfolio
covar <- cov(mldp_returns) DHRP_Portfolio(covar)covar <- cov(mldp_returns) DHRP_Portfolio(covar)
Performs the Hierarchical Clustering-Based Asset Allocation strategy proposed by Raffinot (2017). Several linkage methods for the hierarchical clustering can be used, by default the "ward" linkage is used. The numbers of clusters is selected using the Gap index of Tibshirani et al. (2001).
HCAA_Portfolio(covar, linkage = "ward", graph = FALSE, clusters = NULL)HCAA_Portfolio(covar, linkage = "ward", graph = FALSE, clusters = NULL)
covar |
Covariance matrix of returns. The covariance matrix is converted into a correlation matrix, which is then used to construct the distance matrix for hierarchical clustering. |
linkage |
Linkage method used in the hierarchical clustering. Allowed options are "single", "complete", "average" or "ward". Default option is "ward". |
graph |
To plot de dendrogram set this value to TRUE. By default this value is equal to FALSE. |
clusters |
Numbers of clusters. If NULL (default), the gap index is applied. |
portfolio weights.
Carlos Trucios
Raffinot, Thomas. "Hierarchical clustering-based asset allocation." The Journal of Portfolio Management 44.2 (2017): 89-99.
Tibshirani, Robert, Guenther Walther, and Trevor Hastie. "Estimating the number of clusters in a data set via the gap statistic." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 63.2 (2001): 411-423.
HRP_Portfolio, HERC_Portfolio, HRB_Portfolio and DHRP_Portfolio
covar <- cov(daily_returns) HCAA_Portfolio(covar)covar <- cov(daily_returns) HCAA_Portfolio(covar)
Performs the Hierarchical Equal Risk Contribution portfolio strategy proposed by Raffinot (2018). Several linkage methods for the hierarchical clustering can be used, by default the "ward" linkage is used. This function uses the variance as risk measure. The number of clusters is selected using the Gap index of Tibshirani et al. (2001). The implemenation follows Sjostrand and Nina (2020).
HERC_Portfolio(covar, linkage = "ward", graph = FALSE, clusters = NULL)HERC_Portfolio(covar, linkage = "ward", graph = FALSE, clusters = NULL)
covar |
Covariance matrix of returns. The covariance matrix is converted into a correlation matrix, which is then used to construct the distance matrix for hierarchical clustering. |
linkage |
Linkage method used in the hierarchical clustering. Allowed options are "single", "complete", "average" or "ward". Default option is "ward". |
graph |
To plot de dendrogram set this value to TRUE. By default this value is equal to FALSE. |
clusters |
Numbers of clusters. If NULL (default), the gap index is applied. |
portfolio weights.
Carlos Trucios and Moon Jun Kwon
Raffinot, Thomas. "The hierarchical equal risk contribution portfolio." Available at SSRN 3237540 (2018).
Tibshirani, Robert, Guenther Walther, and Trevor Hastie. "Estimating the number of clusters in a data set via the gap statistic." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 63.2 (2001): 411-423.
HRP_Portfolio, HCAA_Portfolio, HRB_Portfolio and DHRP_Portfolio
covar <- cov(daily_returns) HERC_Portfolio(covar)covar <- cov(daily_returns) HERC_Portfolio(covar)
Computes portfolio weights using the Hierarchical Risk Budgeting (HRB) strategy proposed by Koumou (2024). The method combines hierarchical clustering with a risk-budgeting procedure. The clustering is based on asset correlations, and several linkage methods are available. By default, single linkage is used.
HRB_Portfolio( covar, linkage = "single", graph = FALSE, upsilon = 2, Sigma = c("diag", "full") )HRB_Portfolio( covar, linkage = "single", graph = FALSE, upsilon = 2, Sigma = c("diag", "full") )
covar |
Covariance matrix of returns. The covariance matrix is converted into a correlation matrix, which is then used to construct the distance matrix for hierarchical clustering. |
linkage |
Linkage method used in the hierarchical clustering. Allowed options are "single", "complete", "average" or "ward". Default option is "single". |
graph |
To plot de dendrogram set this value to TRUE. By default this value is equal to FALSE. |
upsilon |
Pparameter controlling the sensitivity of the allocation procedure to rare assets. The default is |
Sigma |
If "full", the portfolio volatility is used as R(w), if "diag" the measure used in the empirical application of the original paper, which ignores dependence between assets is used. By default "diag" is used. |
portfolio weights
Carlos Trucios
Koumou, Gilles Boevi. "Hierarchical Risk Budgeting". Journal of Financial Data Science 6.2 (2024): 35-53
HRP_Portfolio, HCAA_Portfolio, HERC_Portfolio and DHRP_Portfolio
covar <- cov(mldp_returns) HRB_Portfolio(covar)covar <- cov(mldp_returns) HRB_Portfolio(covar)
Performs the Hierarchical Risk Parity portfolio proposed strategy by De Prado (2016). Several linkage methods for the hierarchical clustering can be used, by default the "single" linkage is used.
HRP_Portfolio(covar, linkage = "single", graph = FALSE)HRP_Portfolio(covar, linkage = "single", graph = FALSE)
covar |
Covariance matrix of returns. The covariance matrix is converted into a correlation matrix, which is then used to construct the distance matrix for hierarchical clustering. |
linkage |
Linkage method used in the hierarchical clustering. Allowed options are "single", "complete", "average" or "ward". Default option is "single". |
graph |
To plot de dendrogram set this value to TRUE. By default this value is equal to FALSE. |
portfolio weights
Carlos Trucios
De Prado, Marcos Lopez. "Building diversified portfolios that outperform out of sample." The Journal of Portfolio Management 42.4 (2016): 59-69.
HCAA_Portfolio, HERC_Portfolio, DHRP_Portfolio and HRB_Portfolio
covar <- cov(mldp_returns) HRP_Portfolio(covar)covar <- cov(mldp_returns) HRP_Portfolio(covar)
This dataset contains the simulated returns used in the numerical example of Marcos Lopez de Prado's paper, hence the name mldp_returns. The Python code used to reproduce this simulated data is kindly provided by the author in the supplementary material of his paper.
De Prado, Marcos Lopez. "Building diversified portfolios that outperform out of sample." The Journal of Portfolio Management 42.4 (2016): 59-69.