tailRisk Documentation

tailRisk is a C++ library for the calculation of various tail risk measures. Tail Risk is a core concept in Quantitative Risk Management , relevant in particular in Market Risk and Credit Risk Management. Tail Risk is both an informal term denoting unusually occurring tail events and a more precise term denoting concrete classes of risk measures

The library aims to be a reference implementation for all commonly used tail risk measure definitions.

  • These pages provide the User Documentation for the library (under development).
  • The code is available at GitHub.
  • A pre-packaged container is available at our Docker Hub page.

Example

The data directory contains sample datafiles with various sampled distributions

// Read in some data for a type 0 representation (discrete distribution)
int LossGrid = 1000;
int DataType = 0;
RandomVar L(LossGrid, DataType);
L.ReadFromJSON("../data/example5.json");
L.Print();

// Calculate various measures
double alpha = 0.8;
int threshold = 0;

std::cout << "Mean Value: " << L.Mean() << std::endl;
std::cout << "Median Value: " << L.Median() << std::endl;
std::cout << "STD Value: " << L.StandardDeviation() << std::endl;
std::cout << "Kurtosis: " << L.Kurtosis() << std::endl;
std::cout << "Skeweness: " << L.Skeweness() << std::endl;
std::cout << "Quantile @ " << alpha << ": " << L.Quantile(alpha) << std::endl;
std::cout << "Quantile Index @ " << alpha << ": " << L.Quantile_Index(alpha) << std::endl;
std::cout << "VaR @ " << alpha << ": " << L.VaR(alpha) << std::endl;
std::cout << "Expected Shortfall @ " << alpha << ": " << L.ExpectedShortFall(alpha) << std::endl;
std::cout << "Exceedance Probability: " << L.ExceedanceProbability(threshold) << std::endl;
std::cout << "Mean Excess: " << L.MeanExcess(threshold ) << std::endl;
NOTE: TailRisk is still in active development. As the functionality of the platform is enhanced, the documentation will be enriched and updated, following also user feedback.

tailRisk Random Variable Representations

Random Variable Representations

Reading Time: 0 min.

Random Variable Representations

For context around this aspect of tailRisk, refer to: Random Variable Representation

tailRisk supports two ways of representing in-memory a (one-dimensional) random variable:

  • using a histogram type container
  • using a flexible container of sampling results (realizations)