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>. |
Authors: | Carlos Trucios [aut, cre] |
Maintainer: | Carlos Trucios <[email protected]> |
License: | GPL-2 |
Version: | 1.0.1 |
Built: | 2025-03-08 04:00:20 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 will be transformed into correlation matrix and then into a distance matrix. |
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
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 will be transformed into correlation matrix and then into a distance matrix. |
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
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 will be transformed into correlation matrix and then into a distance matrix. |
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
and DHRP_Portfolio
covar <- cov(daily_returns) HERC_Portfolio(covar)
covar <- cov(daily_returns) HERC_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 will be transformed into correlation matrix and then into a distance matrix. |
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
and DHRP_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.