QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
Public Types | List of all members
Garch11 Class Reference

GARCH volatility model. More...

#include <garch.hpp>

+ Inheritance diagram for Garch11:
+ Collaboration diagram for Garch11:

Public Types

enum  Mode { MomentMatchingGuess , GammaGuess , BestOfTwo , DoubleOptimization }
 
typedef TimeSeries< Volatilitytime_series
 
- Public Types inherited from VolatilityCompositor
typedef TimeSeries< Volatilitytime_series
 

Public Member Functions

Constructors
 Garch11 (Real a, Real b, Real vl)
 
 Garch11 (const time_series &qs, Mode mode=BestOfTwo)
 
Inspectors
Real alpha () const
 
Real beta () const
 
Real omega () const
 
Real ltVol () const
 
Real logLikelihood () const
 
Mode mode () const
 
VolatilityCompositor interface
time_series calculate (const time_series &quoteSeries) override
 
void calibrate (const time_series &quoteSeries) override
 
- Public Member Functions inherited from VolatilityCompositor
virtual ~VolatilityCompositor ()=default
 
virtual time_series calculate (const time_series &volatilitySeries)=0
 
virtual void calibrate (const time_series &volatilitySeries)=0
 

Additional interface

Real alpha_
 
Real beta_
 
Real gamma_
 
Real vl_
 
Real logLikelihood_
 
Mode mode_
 
void calibrate (const time_series &quoteSeries, OptimizationMethod &method, const EndCriteria &endCriteria)
 
void calibrate (const time_series &quoteSeries, OptimizationMethod &method, const EndCriteria &endCriteria, const Array &initialGuess)
 
template<typename ForwardIterator >
void calibrate (ForwardIterator begin, ForwardIterator end)
 
template<typename ForwardIterator >
void calibrate (ForwardIterator begin, ForwardIterator end, OptimizationMethod &method, EndCriteria endCriteria)
 
template<typename ForwardIterator >
void calibrate (ForwardIterator begin, ForwardIterator end, OptimizationMethod &method, EndCriteria endCriteria, const Array &initialGuess)
 
Real forecast (Real r, Real sigma2) const
 
static time_series calculate (const time_series &quoteSeries, Real alpha, Real beta, Real omega)
 
template<typename InputIterator >
static Real to_r2 (InputIterator begin, InputIterator end, std::vector< Volatility > &r2)
 
static ext::shared_ptr< Problemcalibrate_r2 (Mode mode, const std::vector< Volatility > &r2, Real mean_r2, Real &alpha, Real &beta, Real &omega)
 
static ext::shared_ptr< Problemcalibrate_r2 (Mode mode, const std::vector< Volatility > &r2, Real mean_r2, OptimizationMethod &method, const EndCriteria &endCriteria, Real &alpha, Real &beta, Real &omega)
 
static ext::shared_ptr< Problemcalibrate_r2 (const std::vector< Volatility > &r2, Real mean_r2, OptimizationMethod &method, const EndCriteria &endCriteria, const Array &initialGuess, Real &alpha, Real &beta, Real &omega)
 
static ext::shared_ptr< Problemcalibrate_r2 (const std::vector< Volatility > &r2, OptimizationMethod &method, const EndCriteria &endCriteria, const Array &initialGuess, Real &alpha, Real &beta, Real &omega)
 
static ext::shared_ptr< Problemcalibrate_r2 (const std::vector< Volatility > &r2, Real mean_r2, OptimizationMethod &method, Constraint &constraints, const EndCriteria &endCriteria, const Array &initialGuess, Real &alpha, Real &beta, Real &omega)
 
static ext::shared_ptr< Problemcalibrate_r2 (const std::vector< Volatility > &r2, OptimizationMethod &method, Constraint &constraints, const EndCriteria &endCriteria, const Array &initialGuess, Real &alpha, Real &beta, Real &omega)
 
template<class InputIterator >
static Real costFunction (InputIterator begin, InputIterator end, Real alpha, Real beta, Real omega)
 
template<class InputIterator >
Real costFunction (InputIterator begin, InputIterator end) const
 

Detailed Description

GARCH volatility model.

Volatilities are assumed to be expressed on an annual basis.

Definition at line 38 of file garch.hpp.

Member Typedef Documentation

◆ time_series

Definition at line 40 of file garch.hpp.

Member Enumeration Documentation

◆ Mode

enum Mode
Enumerator
MomentMatchingGuess 

The initial guess is a moment matching estimates for mean(r2), acf(0), and acf(1).

GammaGuess 

The initial guess is an estimate of gamma based on the property: acf(i+1) = gamma*acf(i) for i > 1.

BestOfTwo 

The best of the two above modes

DoubleOptimization 

Double optimization

Definition at line 42 of file garch.hpp.

Constructor & Destructor Documentation

◆ Garch11() [1/2]

Garch11 ( Real  a,
Real  b,
Real  vl 
)

Definition at line 56 of file garch.hpp.

◆ Garch11() [2/2]

Garch11 ( const time_series qs,
Mode  mode = BestOfTwo 
)

Definition at line 60 of file garch.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ alpha()

Real alpha ( ) const

Definition at line 68 of file garch.hpp.

+ Here is the caller graph for this function:

◆ beta()

Real beta ( ) const

Definition at line 69 of file garch.hpp.

+ Here is the caller graph for this function:

◆ omega()

Real omega ( ) const

Definition at line 70 of file garch.hpp.

+ Here is the caller graph for this function:

◆ ltVol()

Real ltVol ( ) const

Definition at line 71 of file garch.hpp.

◆ logLikelihood()

Real logLikelihood ( ) const

Definition at line 72 of file garch.hpp.

◆ mode()

Mode mode ( ) const

Definition at line 73 of file garch.hpp.

◆ calculate() [1/2]

time_series calculate ( const time_series quoteSeries)
overridevirtual

Implements VolatilityCompositor.

Definition at line 78 of file garch.hpp.

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

◆ calibrate() [1/6]

void calibrate ( const time_series quoteSeries)
overridevirtual

Implements VolatilityCompositor.

Definition at line 81 of file garch.hpp.

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

◆ calculate() [2/2]

Garch11::time_series calculate ( const time_series quoteSeries,
Real  alpha,
Real  beta,
Real  omega 
)
static

Definition at line 374 of file garch.cpp.

+ Here is the call graph for this function:

◆ calibrate() [2/6]

void calibrate ( const time_series quoteSeries,
OptimizationMethod method,
const EndCriteria endCriteria 
)

Definition at line 92 of file garch.hpp.

+ Here is the call graph for this function:

◆ calibrate() [3/6]

void calibrate ( const time_series quoteSeries,
OptimizationMethod method,
const EndCriteria endCriteria,
const Array initialGuess 
)

Definition at line 100 of file garch.hpp.

+ Here is the call graph for this function:

◆ calibrate() [4/6]

void calibrate ( ForwardIterator  begin,
ForwardIterator  end 
)

Definition at line 110 of file garch.hpp.

+ Here is the call graph for this function:

◆ calibrate() [5/6]

void calibrate ( ForwardIterator  begin,
ForwardIterator  end,
OptimizationMethod method,
EndCriteria  endCriteria 
)

Definition at line 122 of file garch.hpp.

+ Here is the call graph for this function:

◆ calibrate() [6/6]

void calibrate ( ForwardIterator  begin,
ForwardIterator  end,
OptimizationMethod method,
EndCriteria  endCriteria,
const Array initialGuess 
)

Definition at line 137 of file garch.hpp.

+ Here is the call graph for this function:

◆ forecast()

Real forecast ( Real  r,
Real  sigma2 
) const

Definition at line 152 of file garch.hpp.

◆ to_r2()

static Real to_r2 ( InputIterator  begin,
InputIterator  end,
std::vector< Volatility > &  r2 
)
static

Definition at line 158 of file garch.hpp.

+ Here is the caller graph for this function:

◆ calibrate_r2() [1/6]

ext::shared_ptr< Problem > calibrate_r2 ( Mode  mode,
const std::vector< Volatility > &  r2,
Real  mean_r2,
Real alpha,
Real beta,
Real omega 
)
static

calibrates GARCH for r^2

Definition at line 393 of file garch.cpp.

+ Here is the caller graph for this function:

◆ calibrate_r2() [2/6]

ext::shared_ptr< Problem > calibrate_r2 ( Mode  mode,
const std::vector< Volatility > &  r2,
Real  mean_r2,
OptimizationMethod method,
const EndCriteria endCriteria,
Real alpha,
Real beta,
Real omega 
)
static

calibrates GARCH for r^2 with user-defined optimization method and end criteria

Definition at line 402 of file garch.cpp.

+ Here is the call graph for this function:

◆ calibrate_r2() [3/6]

ext::shared_ptr< Problem > calibrate_r2 ( const std::vector< Volatility > &  r2,
Real  mean_r2,
OptimizationMethod method,
const EndCriteria endCriteria,
const Array initialGuess,
Real alpha,
Real beta,
Real omega 
)
static

calibrates GARCH for r^2 with user-defined optimization method, end criteria and initial guess

Definition at line 512 of file garch.cpp.

◆ calibrate_r2() [4/6]

ext::shared_ptr< Problem > calibrate_r2 ( const std::vector< Volatility > &  r2,
OptimizationMethod method,
const EndCriteria endCriteria,
const Array initialGuess,
Real alpha,
Real beta,
Real omega 
)
static

calibrates GARCH for r^2 with user-defined optimization method, end criteria and initial guess

Definition at line 502 of file garch.cpp.

◆ calibrate_r2() [5/6]

ext::shared_ptr< Problem > calibrate_r2 ( const std::vector< Volatility > &  r2,
Real  mean_r2,
OptimizationMethod method,
Constraint constraints,
const EndCriteria endCriteria,
const Array initialGuess,
Real alpha,
Real beta,
Real omega 
)
static

calibrates GARCH for r^2 with user-defined optimization method, end criteria, constraints and initial guess

Definition at line 544 of file garch.cpp.

◆ calibrate_r2() [6/6]

ext::shared_ptr< Problem > calibrate_r2 ( const std::vector< Volatility > &  r2,
OptimizationMethod method,
Constraint constraints,
const EndCriteria endCriteria,
const Array initialGuess,
Real alpha,
Real beta,
Real omega 
)
static

Definition at line 525 of file garch.cpp.

+ Here is the call graph for this function:

◆ costFunction() [1/2]

static Real costFunction ( InputIterator  begin,
InputIterator  end,
Real  alpha,
Real  beta,
Real  omega 
)
static

Definition at line 238 of file garch.hpp.

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

◆ costFunction() [2/2]

Real costFunction ( InputIterator  begin,
InputIterator  end 
) const
private

Definition at line 257 of file garch.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ alpha_

Real alpha_
private

Definition at line 252 of file garch.hpp.

◆ beta_

Real beta_
private

Definition at line 252 of file garch.hpp.

◆ gamma_

Real gamma_
private

Definition at line 252 of file garch.hpp.

◆ vl_

Real vl_
private

Definition at line 252 of file garch.hpp.

◆ logLikelihood_

Real logLikelihood_
private

Definition at line 253 of file garch.hpp.

◆ mode_

Mode mode_
private

Definition at line 254 of file garch.hpp.