Design of Risk Parity Portfolios
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0a1137b Dec 18, 2018

README.md

riskParityPortfolio

CRAN_Status_Badge CRAN Downloads CRAN Downloads Total

codecov Travis-CI-Badge Build status Docker Build Status

The package riskParityPortfolio provides tools to design risk-parity portfolios. In its simplest form, we consider the convex formulation with a unique solution proposed by Spinu (2013) and use a cyclical method inspired by Griveau-Billion (2013). For more general formulations, which are usually nonconvex, we implement the successive convex approximation method proposed by Feng & Palomar (2015).

Installation

To install riskParityPortfolio type the following inside an R session:

# Installation from CRAN
install.packages("riskParityPortfolio")

# Installation from GitHub
install.packages("devtools")
devtools::install_github("dppalomar/riskParityPortfolio")

# Getting help
library(riskParityPortfolio)
help(package = "riskParityPortfolio")
package?riskParityPortfolio
?riskParityPortfolio

# Citing this work
citation("riskParityPortfolio")

You can also get riskParityPortfolio from Docker as follows:

docker pull mirca/riskparityportfolio

Usage of riskParityPortfolio

library(riskParityPortfolio)

set.seed(0)
# create covariance matrix
N <- 5
V <- matrix(rnorm(N^2), nrow = N)
Sigma <- cov(V)

# risk-parity portfolio
res <- riskParityPortfolio(Sigma)
names(res)
#> [1] "w"                 "risk_contribution"
res$w
#> [1] 0.1817376 0.1432048 0.2031782 0.2129650 0.2589145
res$risk_contribution
#> [1] 0.01504086 0.01504086 0.01504085 0.01504086 0.01504086
c(res$w * (Sigma %*% res$w))
#> [1] 0.01504086 0.01504086 0.01504085 0.01504086 0.01504086

# risk budggeting portfolio
res <- riskParityPortfolio(Sigma, b = c(0.4, 0.4, 0.1, 0.05, 0.05))
res$risk_contribution/sum(res$risk_contribution)
#> [1] 0.40 0.40 0.10 0.05 0.05

Documentation

For more detailed information, please check the vignette or the package webpage.

Citation

If you have used this package in your research, please consider citing the following sources:

Links

Package: CRAN and GitHub. README file: GitHub-readme. Vignette: GitHub-html-vignette and GitHub-pdf-vignette.