portvine

Codecov test coverage R-CMD-check lifecycle

Portfolio level unconditional as well as conditional risk measure estimation for backtesting and stress testing using Vine Copula and ARMA-GARCH models. The package implements the proposed approaches in Sommer (2022) and Sommer et al. (2023).

Installation

You can install the released version of portvine from CRAN with:

install.packages("portvine")

You can install the development version of portvine from GitHub with:

# install.packages("devtools")
devtools::install_github("EmanuelSommer/portvine")

What it does and why

The implemented algorithms for the unconditional as well as conditional portfolio level risk measure estimation are based on my masters thesis at the chair of Mathematical Statistics at the TUM which you can find here. The general idea of the unconditional risk measure estimation approach is summarized in the flowchart below for a \(d\)-dimensional portfolio.




For the single conditional approach the general idea for a \(d\)-dimensional portfolio and a market index \(I\) is summarized in the flowchart below.




If you want to get your hands dirty fast the Get Started vignette is a perfect fit for you as it showcases a minimal case study with a lot of code examples and some handy visualization functions that were not incorporated into the package as they are highly opinionated.

In order to grasp what is going on under the hood a look at the Under the hood article on the package website is advised before starting to use the package. There the most important algorithms used during the risk measure estimation are explained. If this doesn’t saturate your hunger for the theory behind the package you should take a look at Sommer (2022).

Moreover the help pages are quite detailed so feel free to have a look at them.

Parallel processing

The risk estimation algorithms implemented in this package lend themselves perfectly for parallel processing. In this package this is enabled through the in my humble opinion amazing future framework. For details please have a look at the detailed section on parallel processing within the help page of the estimate_risk_roll() function (or function reference on the package website). Some performance measurements of different parallel strategies and further information on the implemented parallelisms are presented in the Parallel processing article on the package website.

Acknowledgements

This package is built on the shoulder of giants most importantly the R packages rvinecopulib and rugarch. Thus a big thanks goes to all the contributors and maintainers! Also I would like to thank Claudia Czado and Karoline Bax for giving me the opportunity to work on this project in the first place and their dedicated collaboration along the way!