Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/open-risk/tailrisk
A library for the calculation of tail risk measures
https://github.com/open-risk/tailrisk
expected-shortfall quantile-functions risk-measure value-at-risk
Last synced: 2 months ago
JSON representation
A library for the calculation of tail risk measures
- Host: GitHub
- URL: https://github.com/open-risk/tailrisk
- Owner: open-risk
- License: apache-2.0
- Created: 2020-11-09T08:40:42.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-22T21:15:24.000Z (10 months ago)
- Last Synced: 2024-02-22T22:27:10.003Z (10 months ago)
- Topics: expected-shortfall, quantile-functions, risk-measure, value-at-risk
- Language: C++
- Homepage: https://www.openriskmanagement.com
- Size: 66.4 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# tailRisk
A C++ library for the calculation of various tail risk measures## Documentation
**NB: Documentation still under development.*** Implemented [Risk Measures](RiskMeasures.md)
* Mathematical Documentation available [here](https://www.openriskmanual.org/wiki/Category:Tail_Risk)## Dependencies
* Eigen (Data container and linear algebra calculation library)
* Poco (For parsing JSON inputs and other utilities)
* Stats (A C++ header-only library of statistical distribution functions.)## Example
The data directory contains sample datafiles with various sampled distributions```c++
// 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;
```