QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Attributes | 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
 
typedef time_series::const_iterator const_iterator
 
- 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
 

Public Attributes

QL_DEPRECATED_DISABLE_WARNING typedef time_series::const_value_iterator const_value_iterator
 

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.

◆ const_iterator

Deprecated:
Use auto or time_series::const_iterator instead. Deprecated in version 1.31.

Definition at line 46 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 59 of file garch.hpp.

Constructor & Destructor Documentation

◆ Garch11() [1/2]

Garch11 ( Real  a,
Real  b,
Real  vl 
)

Definition at line 73 of file garch.hpp.

◆ Garch11() [2/2]

Garch11 ( const time_series qs,
Mode  mode = BestOfTwo 
)

Definition at line 77 of file garch.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ alpha()

Real alpha ( ) const

Definition at line 85 of file garch.hpp.

+ Here is the caller graph for this function:

◆ beta()

Real beta ( ) const

Definition at line 86 of file garch.hpp.

+ Here is the caller graph for this function:

◆ omega()

Real omega ( ) const

Definition at line 87 of file garch.hpp.

+ Here is the caller graph for this function:

◆ ltVol()

Real ltVol ( ) const

Definition at line 88 of file garch.hpp.

◆ logLikelihood()

Real logLikelihood ( ) const

Definition at line 89 of file garch.hpp.

◆ mode()

Mode mode ( ) const

Definition at line 90 of file garch.hpp.

◆ calculate() [1/2]

time_series calculate ( const time_series quoteSeries)
overridevirtual

Implements VolatilityCompositor.

Definition at line 95 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 98 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 109 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 117 of file garch.hpp.

+ Here is the call graph for this function:

◆ calibrate() [4/6]

void calibrate ( ForwardIterator  begin,
ForwardIterator  end 
)

Definition at line 127 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 139 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 154 of file garch.hpp.

+ Here is the call graph for this function:

◆ forecast()

Real forecast ( Real  r,
Real  sigma2 
) const

Definition at line 169 of file garch.hpp.

◆ to_r2()

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

Definition at line 175 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 255 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 274 of file garch.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ const_value_iterator

Deprecated:
If needed, use auto or time_series::const_value_iterator. Prefer time_series::const_iterator instead. Deprecated in version 1.31.

Definition at line 55 of file garch.hpp.

◆ alpha_

Real alpha_
private

Definition at line 269 of file garch.hpp.

◆ beta_

Real beta_
private

Definition at line 269 of file garch.hpp.

◆ gamma_

Real gamma_
private

Definition at line 269 of file garch.hpp.

◆ vl_

Real vl_
private

Definition at line 269 of file garch.hpp.

◆ logLikelihood_

Real logLikelihood_
private

Definition at line 270 of file garch.hpp.

◆ mode_

Mode mode_
private

Definition at line 271 of file garch.hpp.