# QuantLib_GenericRiskStatistics man page

GenericRiskStatistics< S > — empirical-distribution risk measures

## Synopsis

`#include <ql/math/statistics/riskstatistics.hpp>`

Inherits S.

### Public Types

typedef S::value_type value_type

### Public Member Functions

Real semiVariance () const
Real semiDeviation () const
Real downsideVariance () const
Real downsideDeviation () const
Real regret (Real target) const
Real potentialUpside (Real percentile) const
potential upside (the reciprocal of VAR) at a given percentile
Real valueAtRisk (Real percentile) const
value-at-risk at a given percentile
Real expectedShortfall (Real percentile) const
expected shortfall at a given percentile
Real shortfall (Real target) const
Real averageShortfall (Real target) const

## Detailed Description

### template<class S>

class QuantLib::GenericRiskStatistics< S >" empirical-distribution risk measures

This class wraps a somewhat generic statistic tool and adds a number of risk measures (e.g.: value-at-risk, expected shortfall, etc.) based on the data distribution as reported by the underlying statistic tool.

Examples: DiscreteHedging.cpp.

## Member Function Documentation

### Real semiVariance () const

returns the variance of observations below the mean, [ ac{N}{N-1} mathrm{E}left[ (x-langle x rangle)^2 ;|; x < langle x rangle right]. ]

See Markowitz (1959).

### Real semiDeviation () const

returns the semi deviation, defined as the square root of the semi variance.

### Real downsideVariance () const

returns the variance of observations below 0.0, [ ac{N}{N-1} mathrm{E}left[ x^2 ;|; x < 0right]. ]

### Real downsideDeviation () const

returns the downside deviation, defined as the square root of the downside variance.

### Real regret (Real target) const

returns the variance of observations below target, [ ac{N}{N-1} mathrm{E}left[ (x-t)^2 ;|; x < t right]. ]

See Dembo and Freeman, 'The Rules Of Risk', Wiley (2001).

### Real potentialUpside (Real centile) const

potential upside (the reciprocal of VAR) at a given percentile

Precondition:

percentile must be in range [90%-100%)

### Real valueAtRisk (Real centile) const

value-at-risk at a given percentile

Precondition:

percentile must be in range [90%-100%)

### Real expectedShortfall (Real centile) const

expected shortfall at a given percentile returns the expected loss in case that the loss exceeded a VaR threshold,

[ mathrm{E}left[ x ;|; x < mathrm{VaR}(p) right], ].PP that is the average of observations below the given percentile \$ p \$. Also know as conditional value-at-risk.

See Artzner, Delbaen, Eber and Heath, 'Coherent measures of risk', Mathematical Finance 9 (1999)

Precondition:

percentile must be in range [90%-100%)

### Real shortfall (Real target) const

probability of missing the given target, defined as [ mathrm{E}left[ Theta ;|; (-infty,infty) right] ] where [ Theta(x) = left begin{array}{ll} 1 & x < t \ 0 & x geq t \nd{array} right. ]

### Real averageShortfall (Real target) const

averaged shortfallness, defined as [ mathrm{E}left[ t-x ;|; x<t right] ]

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

The man pages averageShortfall(3), downsideDeviation(3), downsideVariance(3), potentialUpside(3), regret(3), semiDeviation(3), semiVariance(3), shortfall(3) and valueAtRisk(3) are aliases of QuantLib_GenericRiskStatistics(3).

Mon Apr 30 2018 Version 1.12.1 QuantLib