QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends | List of all members
Distribution Class Reference

#include <ql/experimental/credit/distribution.hpp>

+ Collaboration diagram for Distribution:

Public Member Functions

 Distribution (int nBuckets, Real xmin, Real xmax)
 
 Distribution ()=default
 
void add (Real value)
 
void addDensity (int bucket, Real value)
 
void addAverage (int bucket, Real value)
 
void normalize ()
 
Size size () const
 
Real x (Size k)
 
std::vector< Real > & x ()
 
Real dx (Size k)
 
std::vector< Real > & dx ()
 
Real dx (Real x)
 
Real density (Size k)
 
Real cumulative (Size k)
 
Real excess (Size k)
 
Real cumulativeExcess (Size k)
 
Real average (Size k)
 
Real confidenceLevel (Real quantil)
 
Real cumulativeDensity (Real x)
 
Real cumulativeExcessProbability (Real a, Real b)
 
Real expectedValue ()
 
Real trancheExpectedValue (Real a, Real d)
 
template<class F >
Real expectedValue (F &f)
 
void tranche (Real attachmentPoint, Real detachmentPoint)
 
int locate (Real x)
 
Real expectedShortfall (Real percValue)
 

Private Attributes

int size_
 
Real xmin_
 
Real xmax_
 
std::vector< int > count_
 
std::vector< Realx_
 
std::vector< Realdx_
 
std::vector< Realdensity_
 
std::vector< RealcumulativeDensity_
 
std::vector< RealexcessProbability_
 
std::vector< RealcumulativeExcessProbability_
 
std::vector< Realaverage_
 
int overFlow_
 
int underFlow_
 
bool isNormalized_
 

Friends

class ManipulateDistribution
 

Detailed Description

Definition at line 37 of file distribution.hpp.

Constructor & Destructor Documentation

◆ Distribution() [1/2]

Distribution ( int  nBuckets,
Real  xmin,
Real  xmax 
)

Definition at line 33 of file distribution.cpp.

◆ Distribution() [2/2]

Distribution ( )
default

Member Function Documentation

◆ add()

void add ( Real  value)

Definition at line 78 of file distribution.cpp.

+ Here is the caller graph for this function:

◆ addDensity()

void addDensity ( int  bucket,
Real  value 
)

Definition at line 95 of file distribution.cpp.

+ Here is the caller graph for this function:

◆ addAverage()

void addAverage ( int  bucket,
Real  value 
)

Definition at line 103 of file distribution.cpp.

+ Here is the caller graph for this function:

◆ normalize()

void normalize ( )

Definition at line 111 of file distribution.cpp.

+ Here is the caller graph for this function:

◆ size()

Size size ( ) const

Definition at line 49 of file distribution.hpp.

+ Here is the caller graph for this function:

◆ x() [1/2]

Real x ( Size  k)

Definition at line 50 of file distribution.hpp.

◆ x() [2/2]

std::vector< Real > & x ( )

Definition at line 51 of file distribution.hpp.

+ Here is the caller graph for this function:

◆ dx() [1/3]

Real dx ( Size  k)

Definition at line 52 of file distribution.hpp.

+ Here is the caller graph for this function:

◆ dx() [2/3]

std::vector< Real > & dx ( )

Definition at line 53 of file distribution.hpp.

◆ dx() [3/3]

Real dx ( Real  x)

Definition at line 71 of file distribution.cpp.

+ Here is the call graph for this function:

◆ density()

Real density ( Size  k)

Definition at line 56 of file distribution.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cumulative()

Real cumulative ( Size  k)

Definition at line 60 of file distribution.hpp.

+ Here is the call graph for this function:

◆ excess()

Real excess ( Size  k)

Definition at line 64 of file distribution.hpp.

+ Here is the call graph for this function:

◆ cumulativeExcess()

Real cumulativeExcess ( Size  k)

Definition at line 68 of file distribution.hpp.

+ Here is the call graph for this function:

◆ average()

Real average ( Size  k)

Definition at line 72 of file distribution.hpp.

◆ confidenceLevel()

Real confidenceLevel ( Real  quantil)

Definition at line 151 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cumulativeDensity()

Real cumulativeDensity ( Real  x)

Definition at line 220 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cumulativeExcessProbability()

Real cumulativeExcessProbability ( Real  a,
Real  b 
)

Definition at line 204 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectedValue() [1/2]

Real expectedValue ( )

Definition at line 162 of file distribution.cpp.

+ Here is the call graph for this function:

◆ trancheExpectedValue()

Real trancheExpectedValue ( Real  a,
Real  d 
)

Definition at line 174 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectedValue() [2/2]

Real expectedValue ( F &  f)

Definition at line 81 of file distribution.hpp.

+ Here is the call graph for this function:

◆ tranche()

void tranche ( Real  attachmentPoint,
Real  detachmentPoint 
)

Transform the loss distribution into the tranche loss distribution for losses L_T = min(L,D) - min(L,A). The effects are: 1) shift the distribution to the left by A, then 2) cut off at D-A, Pr(L_T > D-A) = 0 3) ensure Pr(L_T >= 0) = 1, i.e. a density spike at L_T = 0

Definition at line 236 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ locate()

int locate ( Real  x)

Definition at line 55 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expectedShortfall()

Real expectedShortfall ( Real  percValue)

Definition at line 328 of file distribution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ManipulateDistribution

friend class ManipulateDistribution
friend

Definition at line 39 of file distribution.hpp.

Member Data Documentation

◆ size_

int size_
private

Definition at line 110 of file distribution.hpp.

◆ xmin_

Real xmin_
private

Definition at line 111 of file distribution.hpp.

◆ xmax_

Real xmax_
private

Definition at line 111 of file distribution.hpp.

◆ count_

std::vector<int> count_
private

Definition at line 112 of file distribution.hpp.

◆ x_

std::vector<Real> x_
private

Definition at line 115 of file distribution.hpp.

◆ dx_

std::vector<Real> dx_
private

Definition at line 115 of file distribution.hpp.

◆ density_

std::vector<Real> density_
private

Definition at line 120 of file distribution.hpp.

◆ cumulativeDensity_

std::vector<Real> cumulativeDensity_
private

Definition at line 120 of file distribution.hpp.

◆ excessProbability_

std::vector<Real> excessProbability_
private

Definition at line 121 of file distribution.hpp.

◆ cumulativeExcessProbability_

std::vector<Real> cumulativeExcessProbability_
private

Definition at line 121 of file distribution.hpp.

◆ average_

std::vector<Real> average_
private

Definition at line 123 of file distribution.hpp.

◆ overFlow_

int overFlow_
private

Definition at line 125 of file distribution.hpp.

◆ underFlow_

int underFlow_
private

Definition at line 125 of file distribution.hpp.

◆ isNormalized_

bool isNormalized_
private

Definition at line 126 of file distribution.hpp.