MarkovFunctional Class Reference

#include <ql/experimental/models/markovfunctional.hpp>

Inheritance diagram for MarkovFunctional:

Public Member Functions

 MarkovFunctional (const Handle< YieldTermStructure > &termStructure, const Real reversion, const std::vector< Date > &volstepdates, const std::vector< Real > &volatilities, const Handle< SwaptionVolatilityStructure > &swaptionVol, const std::vector< Date > &swaptionExpiries, const std::vector< Period > &swaptionTenors, const boost::shared_ptr< SwapIndex > &swapIndexBase, const MarkovFunctional::ModelSettings &modelSettings=ModelSettings())
 
 MarkovFunctional (const Handle< YieldTermStructure > &termStructure, const Real reversion, const std::vector< Date > &volstepdates, const std::vector< Real > &volatilities, const Handle< OptionletVolatilityStructure > &capletVol, const std::vector< Date > &capletExpiries, const boost::shared_ptr< IborIndex > &iborIndex, const MarkovFunctional::ModelSettings &modelSettings=ModelSettings())
 
const ModelSettings & modelSettings () const
 
const ModelOutputs & modelOutputs () const
 
const DatenumeraireDate () const
 
const TimenumeraireTime () const
 
const boost::shared_ptr
< StochasticProcess1D
stateProcess () const
 
const Real numeraire (const Time t, const Real y=0.0) const
 
const Disposable< Arraynumeraire (const Time t, const Array &y) const
 
const Real deflatedZerobond (const Time T, const Time t=0.0, const Real y=0.0) const
 
const Disposable< ArraydeflatedZerobond (const Time T, const Time t, const Array &y) const
 
const Real zerobond (const Time T, const Time t=0.0, const Real y=0.0) const
 
const Real zerobond (const Date &maturity, const Date &referenceDate=Null< Date >(), const Real y=0.0) const
 
const Real zerobondOption (const Option::Type &type, const Date &expiry, const Date &maturity, const Rate strike, const Date &referenceDate=Null< Date >(), const Real y=0.0) const
 
const Real forwardRate (const Date &fixing, const Date &referenceDate=Null< Date >(), const Real y=0.0, const bool zeroFixingDays=false, boost::shared_ptr< IborIndex > iborIdx=boost::shared_ptr< IborIndex >()) const
 
const Real swapRate (const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), const Real y=0.0, const bool zeroFixingDays=false, boost::shared_ptr< SwapIndex > swapIdx=boost::shared_ptr< SwapIndex >()) const
 
const Real swapAnnuity (const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), const Real y=0.0, const bool zeroFixingDays=false, boost::shared_ptr< SwapIndex > swapIdx=boost::shared_ptr< SwapIndex >()) const
 
const Real capletPrice (const Option::Type &type, const Date &expiry, const Rate strike, const Date &referenceDate=Null< Date >(), const Real y=0.0, const bool zeroFixingDays=false, boost::shared_ptr< IborIndex > iborIdx=boost::shared_ptr< IborIndex >()) const
 
const Real swaptionPrice (const Option::Type &type, const Date &expiry, const Period &tenor, const Rate strike, const Date &referenceDate=Null< Date >(), const Real y=0.0, const bool zeroFixingDays=false, boost::shared_ptr< SwapIndex > swapIdx=boost::shared_ptr< SwapIndex >()) const
 
const Real gaussianPolynomialIntegral (const Real a, const Real b, const Real c, const Real d, const Real e, const Real x0, const Real x1) const
 
const Real gaussianShiftedPolynomialIntegral (const Real a, const Real b, const Real c, const Real d, const Real e, const Real h, const Real x0, const Real x1) const
 
const Disposable< ArrayyGrid (const Real yStdDevs, const int gridPoints, const Real T=1.0, const Real t=0, const Real y=0) const
 
void update ()
 
void performCalculations () const
 
- Public Member Functions inherited from TermStructureConsistentModel
 TermStructureConsistentModel (const Handle< YieldTermStructure > &termStructure)
 
const Handle
< YieldTermStructure > & 
termStructure () const
 
- Public Member Functions inherited from Observable
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
void notifyObservers ()
 
- Public Member Functions inherited from CalibratedModel
 CalibratedModel (Size nArguments)
 
void update ()
 
void calibrate (const std::vector< boost::shared_ptr< CalibrationHelper > > &, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >())
 Calibrate to a set of market instruments (caps/swaptions) More...
 
Real value (const Array &params, const std::vector< boost::shared_ptr< CalibrationHelper > > &)
 
const boost::shared_ptr
< Constraint > & 
constraint () const
 
EndCriteria::Type endCriteria ()
 returns end criteria result
 
Disposable< Arrayparams () const
 Returns array of arguments on which calibration is done.
 
virtual void setParams (const Array &params)
 
- Public Member Functions inherited from Observer
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
std::pair< std::set
< boost::shared_ptr
< Observable > >::iterator,
bool > 
registerWith (const boost::shared_ptr< Observable > &)
 
Size unregisterWith (const boost::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
- Public Member Functions inherited from LazyObject
void update ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 

Protected Member Functions

void generateArguments ()
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 

Friends

class ZeroHelper
 

Additional Inherited Members

- Protected Attributes inherited from CalibratedModel
std::vector< Parameterarguments_
 
boost::shared_ptr< Constraintconstraint_
 
EndCriteria::Type shortRateEndCriteria_
 
- Protected Attributes inherited from LazyObject
bool calculated_
 
bool frozen_
 

Detailed Description

One factor Markov Functional model class. Some documentation is available here http://ssrn.com/abstract_id=2183721

Warning:

The model requires a suitable input smile which means it should be arbitrage free, smooth (at least implying a C^1 call price function) and with a call price function not decreasing too slow in strike direction. A method for arbitrage free extra- and interpolation due to Kahale is provided and may be used to improve an input smile.

If you use the KahaleExtrapolation for smile pretreatment then this implies zero density for negative underlying rates. This means that in this case the market yield term structure must imply positive underlying atm forward rates. In principle the mf model is able to produce negative rates. To make this work the smileSection provided as input must have an digitalOptionPrice (or an optionPrice) implementation that is consistent with such a yield term structure and the model setting lowerRateBound must be set appropriately as a lower limit for the underlying rates.

If you do not use a smile pretreatment you should ensure that the input smileSection is arbitrage free and that the input smileSection covers the strikes from lowerRateBound to upperRateBound

The model assumes a monocurve setup. Workarounds for spreads between different forward curves or forward and discounting curve are at the moment left to be implemented in pricing engines. Note that this implies slightly different atm forward levels compared to a multicurve setup with e.g. OIS discounting and Ibor forwarding curves. The volatility structures feeded into the model should therefore be consistent with the monocurve assumption of the model.

The model uses a simplified formula for the npv of a swaps floating leg namely $P(t,T_0)-P(t,T_1)$ with $T_0$ being the start date of the leg and $T_1% being the last payment date, which is an approximation to the true npv.

The model calibrates to slightly modified market options in the sense that the start date is set equal to the fixing date, i.e. there is not delay. The model outputs refer to this modified instrument. This modification can be switched on and off in the models pricing functions via the flat zeroFixingDays. In general the actual market instrument including the delay is still matched very well though the calibration is done on a slightly different instrument in fact.

AdjustYts and AdjustDigitals are experimental options. Specifying AdjustYts may have a negative impact on the volatility smile match, so it should be used with special care. For long term calibration it seems an interesting option though.

NTL support must be enabled by defining MF_ENABLE_NTL in this file. For details on NTL see http://www.shoup.net/ntl/

A bad fit to the initial yield term structure may be due to a non suitable input smile or accumulating numerical errors in very long term calibrations. The former point is adressed by smile pretreatment options. The latter point may be tackled by higher values for the numerical parameters possibly together with NTL high precision computing.

Member Function Documentation

const Real gaussianPolynomialIntegral ( const Real  a,
const Real  b,
const Real  c,
const Real  d,
const Real  e,
const Real  x0,
const Real  x1 
) const
Computes the integral

\[ {2\pi}^{-0.5} \int_{a}^{b} p(x) \exp{-0.5*x*x} \mathrm{d}x \]

with

\[ p(x) = ax^4+bx^3+cx^2+dx+e \]

.

const Real gaussianShiftedPolynomialIntegral ( const Real  a,
const Real  b,
const Real  c,
const Real  d,
const Real  e,
const Real  h,
const Real  x0,
const Real  x1 
) const
Computes the integral

\[ {2\pi}^{-0.5} \int_{a}^{b} p(x) \exp{-0.5*x*x} \mathrm{d}x \]

with

\[ p(x) = a(x-h)^4+b(x-h)^3+c(x-h)^2+d(x-h)+e \]

.

void performCalculations ( ) const
virtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Implements LazyObject.