QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
GenericSequenceStatistics< StatisticsType > Class Template Reference

Statistics analysis of N-dimensional (sequence) data. More...

#include <ql/math/statistics/sequencestatistics.hpp>

+ Inheritance diagram for GenericSequenceStatistics< StatisticsType >:
+ Collaboration diagram for GenericSequenceStatistics< StatisticsType >:

Public Types

typedef StatisticsType statistics_type
 
typedef std::vector< typename StatisticsType::value_type > value_type
 

Public Member Functions

 GenericSequenceStatistics (Size dimension=0)
 
inspectors
Size size () const
 
covariance and correlation
Matrix covariance () const
 returns the covariance Matrix More...
 
Matrix correlation () const
 returns the correlation Matrix More...
 
1-D inspectors lifted from underlying statistics class
Size samples () const
 
Real weightSum () const
 
N-D inspectors lifted from underlying statistics class
std::vector< Realmean () const
 
std::vector< Realvariance () const
 
std::vector< RealstandardDeviation () const
 
std::vector< RealdownsideVariance () const
 
std::vector< RealdownsideDeviation () const
 
std::vector< RealsemiVariance () const
 
std::vector< RealsemiDeviation () const
 
std::vector< RealerrorEstimate () const
 
std::vector< Realskewness () const
 
std::vector< Realkurtosis () const
 
std::vector< Realmin () const
 
std::vector< Realmax () const
 
std::vector< RealgaussianPercentile (Real y) const
 
std::vector< Realpercentile (Real y) const
 
std::vector< RealgaussianPotentialUpside (Real percentile) const
 
std::vector< RealpotentialUpside (Real percentile) const
 
std::vector< RealgaussianValueAtRisk (Real percentile) const
 
std::vector< RealvalueAtRisk (Real percentile) const
 
std::vector< RealgaussianExpectedShortfall (Real percentile) const
 
std::vector< RealexpectedShortfall (Real percentile) const
 
std::vector< Realregret (Real target) const
 
std::vector< RealgaussianShortfall (Real target) const
 
std::vector< Realshortfall (Real target) const
 
std::vector< RealgaussianAverageShortfall (Real target) const
 
std::vector< RealaverageShortfall (Real target) const
 

Modifiers

Size dimension_ = 0
 
std::vector< statistics_typestats_
 
std::vector< Realresults_
 
Matrix quadraticSum_
 
void reset (Size dimension=0)
 
template<class Sequence >
void add (const Sequence &sample, Real weight=1.0)
 
template<class Iterator >
void add (Iterator begin, Iterator end, Real weight=1.0)
 

Detailed Description

template<class StatisticsType>
class QuantLib::GenericSequenceStatistics< StatisticsType >

Statistics analysis of N-dimensional (sequence) data.

It provides 1-dimensional statistics as discrepancy plus N-dimensional (sequence) statistics (e.g. mean, variance, skewness, kurtosis, etc.) with one component for each dimension of the sample space.

For most of the statistics this class relies on the StatisticsType underlying class to provide 1-D methods that will be iterated for all the components of the N-D data. These lifted methods are the union of all the methods that might be requested to the 1-D underlying StatisticsType class, with the usual compile-time checks provided by the template approach.

Tests:
the correctness of the returned values is tested by checking them against numerical calculations.
Examples
MarketModels.cpp.

Definition at line 50 of file sequencestatistics.hpp.

Member Typedef Documentation

◆ statistics_type

typedef StatisticsType statistics_type

Definition at line 53 of file sequencestatistics.hpp.

◆ value_type

typedef std::vector<typename StatisticsType::value_type> value_type

Definition at line 54 of file sequencestatistics.hpp.

Constructor & Destructor Documentation

◆ GenericSequenceStatistics()

GenericSequenceStatistics ( Size  dimension = 0)

Definition at line 160 of file sequencestatistics.hpp.

Member Function Documentation

◆ size()

Size size ( ) const

Definition at line 59 of file sequencestatistics.hpp.

◆ covariance()

Matrix covariance

returns the covariance Matrix

Definition at line 247 of file sequencestatistics.hpp.

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

◆ correlation()

Matrix correlation

returns the correlation Matrix

Definition at line 269 of file sequencestatistics.hpp.

+ Here is the call graph for this function:

◆ samples()

Size samples

Definition at line 165 of file sequencestatistics.hpp.

+ Here is the caller graph for this function:

◆ weightSum()

Real weightSum

Definition at line 170 of file sequencestatistics.hpp.

◆ mean()

std::vector< Real > mean
Examples
MarketModels.cpp.

Definition at line 186 of file sequencestatistics.hpp.

+ Here is the caller graph for this function:

◆ variance()

std::vector< Real > variance

Definition at line 187 of file sequencestatistics.hpp.

◆ standardDeviation()

std::vector< Real > standardDeviation

Definition at line 188 of file sequencestatistics.hpp.

◆ downsideVariance()

std::vector< Real > downsideVariance

Definition at line 189 of file sequencestatistics.hpp.

◆ downsideDeviation()

std::vector< Real > downsideDeviation

Definition at line 190 of file sequencestatistics.hpp.

◆ semiVariance()

std::vector< Real > semiVariance

Definition at line 191 of file sequencestatistics.hpp.

◆ semiDeviation()

std::vector< Real > semiDeviation

Definition at line 192 of file sequencestatistics.hpp.

◆ errorEstimate()

std::vector< Real > errorEstimate

Definition at line 193 of file sequencestatistics.hpp.

◆ skewness()

std::vector< Real > skewness

Definition at line 194 of file sequencestatistics.hpp.

◆ kurtosis()

std::vector< Real > kurtosis

Definition at line 195 of file sequencestatistics.hpp.

◆ min()

std::vector< Real > min

Definition at line 196 of file sequencestatistics.hpp.

◆ max()

std::vector< Real > max

Definition at line 197 of file sequencestatistics.hpp.

◆ gaussianPercentile()

std::vector< Real > gaussianPercentile ( Real  y) const

Definition at line 211 of file sequencestatistics.hpp.

◆ percentile()

std::vector< Real > percentile ( Real  y) const

Definition at line 218 of file sequencestatistics.hpp.

◆ gaussianPotentialUpside()

std::vector< Real > gaussianPotentialUpside ( Real  percentile) const

Definition at line 212 of file sequencestatistics.hpp.

◆ potentialUpside()

std::vector< Real > potentialUpside ( Real  percentile) const

Definition at line 219 of file sequencestatistics.hpp.

◆ gaussianValueAtRisk()

std::vector< Real > gaussianValueAtRisk ( Real  percentile) const

Definition at line 213 of file sequencestatistics.hpp.

◆ valueAtRisk()

std::vector< Real > valueAtRisk ( Real  percentile) const

Definition at line 220 of file sequencestatistics.hpp.

◆ gaussianExpectedShortfall()

std::vector< Real > gaussianExpectedShortfall ( Real  percentile) const

Definition at line 214 of file sequencestatistics.hpp.

◆ expectedShortfall()

std::vector< Real > expectedShortfall ( Real  percentile) const

Definition at line 221 of file sequencestatistics.hpp.

◆ regret()

std::vector< Real > regret ( Real  target) const

Definition at line 222 of file sequencestatistics.hpp.

◆ gaussianShortfall()

std::vector< Real > gaussianShortfall ( Real  target) const

Definition at line 215 of file sequencestatistics.hpp.

◆ shortfall()

std::vector< Real > shortfall ( Real  target) const

Definition at line 223 of file sequencestatistics.hpp.

◆ gaussianAverageShortfall()

std::vector< Real > gaussianAverageShortfall ( Real  target) const

Definition at line 216 of file sequencestatistics.hpp.

◆ averageShortfall()

std::vector< Real > averageShortfall ( Real  target) const

Definition at line 224 of file sequencestatistics.hpp.

◆ reset()

void reset ( Size  dimension = 0)

Definition at line 229 of file sequencestatistics.hpp.

+ Here is the caller graph for this function:

◆ add() [1/2]

void add ( const Sequence &  sample,
Real  weight = 1.0 
)

Definition at line 115 of file sequencestatistics.hpp.

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

◆ add() [2/2]

void add ( Iterator  begin,
Iterator  end,
Real  weight = 1.0 
)

Definition at line 120 of file sequencestatistics.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ dimension_

Size dimension_ = 0
protected

Definition at line 144 of file sequencestatistics.hpp.

◆ stats_

std::vector<statistics_type> stats_
protected

Definition at line 145 of file sequencestatistics.hpp.

◆ results_

std::vector<Real> results_
mutableprotected

Definition at line 146 of file sequencestatistics.hpp.

◆ quadraticSum_

Matrix quadraticSum_
protected

Definition at line 147 of file sequencestatistics.hpp.