Logo
Reference manual - version qle_version
stoplightbounds.hpp File Reference

compute stop light bounds for overlapping and correlated PL More...

#include <ql/math/matrix.hpp>
#include <ql/math/matrixutilities/pseudosqrt.hpp>
#include <ql/types.hpp>
#include <vector>

Functions

std::vector< Size > stopLightBounds (const std::vector< Real > &stopLightP, const Size observations, const Size numberOfDays=10, const Real p=0.99, const Size numberOfPortfolios=1, const Matrix &correlation=Matrix(1, 1, 1.0), const Size samples=1500000, const Size seed=42, const SalvagingAlgorithm::Type salvaging=SalvagingAlgorithm::Spectral, const Size exceptions=Null< Size >(), Real *cumProb=nullptr)
std::vector< Size > stopLightBoundsTabulated (const std::vector< Real > &stopLightP, const Size observations, const Size numberOfDays=10, const Real p=0.99, const std::vector< int > &obsNb=std::vector< int >{}, const std::vector< int > &amberLimit=std::vector< int >{}, const std::vector< int > &redLimit=std::vector< int >{})
std::vector< Size > stopLightBounds (const std::vector< Real > &stopLightP, const Size observations, const Real p, const Size exceptions=Null< Size >(), Real *cumProb=nullptr)
std::vector< std::pair< Size, std::vector< Size > > > generateStopLightBoundTable (const std::vector< Size > &observations, const std::vector< Real > &stopLightP, const Size samples, const Size seed, const Size numberOfDays=10, const Real p=0.99)
std::vector< double > decorrelateOverlappingPnls (const std::vector< double > &pnl, const Size numberOfDays)

Detailed Description

compute stop light bounds for overlapping and correlated PL

Function Documentation

◆ stopLightBounds()

std::vector< Size > stopLightBounds ( const std::vector< Real > & stopLightP,
const Size observations,
const Size numberOfDays = 10,
const Real p = 0.99,
const Size numberOfPortfolios = 1,
const Matrix & correlation = Matrix(1, 1, 1.0),
const Size samples = 1500000,
const Size seed = 42,
const SalvagingAlgorithm::Type salvaging = SalvagingAlgorithm::Spectral,
const Size exceptions = Null< Size >(),
Real * cumProb = nullptr )

Computes the maximum number of exceptions K such that the probability of having less or equal to K exceptions is less than s for a given vector of stop light levels s, i.e.

P(X <= K) < s and P(X <= K+1) >= s

In the basel approach we have

s = 0.95 : K = maximum number of exceptions such that the model is considered to be "green" s = 0.9999 : K = maxium number of exception such that the model is considered to be "amber"

See https://www.bis.org/publ/bcbs22.pdf:

"The yellow zone begins at the point such that the probability of obtaining that number or fewer exceptions equals or exceeds 95%."

and similar for the red zone.

An overlapping PL over a given period is considered, possibly also several portfolios with correlated PL. If the parameter exceptions m is not null, cumProb is set to the probability of having less of equal to m exceptions (this is not affecting the return value).