# QuantLib_MarkovFunctional man page

MarkovFunctional —

## Synopsis

`#include <ql/models/shortrate/onefactormodels/markovfunctional.hpp>`

Inherits **Gaussian1dModel**, and **CalibratedModel**.

### Public Member Functions

MarkovFunctional(constHandle<YieldTermStructure> &termStructure, constRealreversion, const std::vector<Date> &volstepdates, const std::vector<Real> &volatilities, constHandle<SwaptionVolatilityStructure> &swaptionVol, const std::vector<Date> &swaptionExpiries, const std::vector<Period> &swaptionTenors, const boost::shared_ptr<SwapIndex> &swapIndexBase, const MarkovFunctional::ModelSettings &modelSettings=ModelSettings())MarkovFunctional(constHandle<YieldTermStructure> &termStructure, constRealreversion, const std::vector<Date> &volstepdates, const std::vector<Real> &volatilities, constHandle<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

constDate&numeraireDate() const

constTime&numeraireTime() const

constArray&volatility() const

voidcalibrate(const std::vector< boost::shared_ptr<CalibrationHelper> > &helper,OptimizationMethod&method, constEndCriteria&endCriteria, constConstraint&constraint=Constraint(), const std::vector<Real> &weights=std::vector<Real>(), const std::vector< bool > &fixParameters=std::vector< bool >())

Calibrate to a set of market instruments (usually caps/swaptions)

voidupdate()

const std::vector< std::pair<Size,Size> >arbitrageIndices() const

voidforceArbitrageIndices(const std::vector< std::pair<Size,Size> > &indices)

### Protected Member Functions

Real numeraireImpl(constTimet, constRealy, constHandle<YieldTermStructure> &yts) constReal zerobondImpl(constTimeT, constTimet, constRealy, constHandle<YieldTermStructure> &yts) const

voidgenerateArguments()

voidperformCalculations() constDisposable< std::vector< bool > >FixedFirstVolatility() const

### Friends

classZeroHelper

### Additional Inherited Members

## Detailed Description

One factor Markov Functional model class. Some documentation is available here http://ssrn.com/abstract_id=2183721 http://quantlib.org/slides/qlws13/caspe…

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. Alternatively a **SABR** smile with arbitrage free wings can be fitted to the input smile to provide an appropriate input smile.

If you use the Kahale or **SABR** method 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.

During calibration a monocurve setup is assumed with the given yield term structure determining the rates throughout, no matter what curves are linked to the indices in the volatility term structures. The yield term structure should therefore be the main risk curve, i.e. the forwarding curve for the respective swaption or cap underlyings.

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 no delay. The model diagnostic outputs refer to this modified instrument. In general the actual market instrument including the delay is still matched very well though the calibration is done on a slightly different instrument.

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.

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.

When using a shifted lognormal smile input the lower rate bound is adjusted by the shift so that a lower bound of 0.0 always corresponds to the lower bound of the shifted distribution.

## Member Function Documentation

### void update () [virtual]

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Reimplemented from **CalibratedModel**.

### void performCalculations () const [protected], [virtual]

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

Reimplemented from **Gaussian1dModel**.

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

arbitrageIndices(3), FixedFirstVolatility(3), forceArbitrageIndices(3), MarkovFunctional(3), modelOutputs(3), modelSettings(3), numeraireDate(3) and ZeroHelper(3) are aliases of QuantLib_MarkovFunctional(3).