# shortrate (3) - Linux Manuals

## NAME

Short-rate modelling framework -

### Classes

class **AffineModel**

*Affine model class. *

class **TermStructureConsistentModel**

*Term-structure consistent model class. *

class **ShortRateModel**

*Abstract short-rate model class. *

class **OneFactorModel**

*Single-factor short-rate model abstract class. *

class **OneFactorAffineModel**

*Single-factor affine base class. *

class **BlackKarasinski**

*Standard Black-Karasinski model class. *

class **CoxIngersollRoss**

*Cox-Ingersoll-Ross model class. *

class **ExtendedCoxIngersollRoss**

*Extended Cox-Ingersoll-Ross model class. *

class **HullWhite**

*Single-factor Hull-White (extended Vasicek) model class. *

class **Vasicek**

*Vasicek model class *

class **TwoFactorModel**

*Abstract base-class for two-factor models. *

class **G2**

*Two-additive-factor gaussian model class. *

## Detailed Description

This framework (corresponding to the ql/ShortRateModels directory) implements some single-factor and two-factor short rate models. The models implemented in this library are widely used by practitionners. For the moment, the ShortRateModels::Model class defines the short-rate dynamics with stochastic equations of the type [ dx_i = mu(t,x_i) dt + igma(t,x_i) dW_t ] where $ r = f(t,x) $. If the model is affine (i.e. derived from the **QuantLib::AffineModel** class), analytical formulas for discount bonds and discount bond options are given (useful for calibration).

## Single-factor models

**The Hull & White model**.RS 4
[ dr_t = ( heta(t) - lpha(t) r_t)dt + igma(t) dW_t ] When $ lpha $ and $ igma $ are constants, this model has analytical formulas for discount bonds and discount bond options.

**The Black-Karasinski model**.RS 4
[ d

ded Cox-Ingersoll-Ross model.RS 4 [ dr_t = ( heta(t) - k r_t)dt + igma qrt{r_t} dW_t ] There are analytical formulas for discount bonds (and soon for discount bond options).

## Calibration

The class CalibrationHelper is a base class that facilitates the instanciation of market instruments used for calibration. It has a method marketValue() that gives the market price using a Black formula, and a modelValue() method that gives the price according to a model

Derived classed are **QuantLib::CapHelper** and **QuantLib::SwaptionHelper**.

For the calibration itself, you must choose an optimization method that will find constant parameters such that the value: [ V = qrt{um_{i=1}^{n} ac{(T_i - M_i)^2}{M_i}}, ] where $ T_i $ is the price given by the model and $ M_i $ is the market price, is minimized. A few optimization methods are available in the ql/Optimization directory.

## Two-factor models

## Pricers

**Analytical pricers**.RS 4

If the model is affine, i.e. discount bond options formulas exist, caps are easily priced since they are a portfolio of discount bond options. Such a pricer is implemented in QuantLib::AnalyticalCapFloor. In the case of single-factor affine models, swaptions can be priced using the Jamshidian decomposition, implemented in QuantLib::JamshidianSwaption.

**Using Finite Differences**.RS 4

(Doesn't work for the moment) For the moment, this is only available for single-factor affine models. If $ x = x(t, r) $ is the state variable and follows this stochastic process: [ dx_t = mu(t,x)dt + igma(t,x)dW_t ] any european-style instrument will follow the following PDE:

[ ac{

artial P}{

artial t} + mu ac{

artial P}{

artial x} + ac{1}{2} igma^2 ac{

artial^2 P}{

artial x^2} = r(t,x)P ].PP
The adequate operator to feed a Finite Difference Model instance is defined in the QuantLib::OneFactorOperator class.

**Using Trees**.RS 4

Each model derived from the single-factor model class has the ability to return a trinomial tree. For yield-curve consistent models, the fitting parameter can be determined either analytically (when possible) or numerically. When a tree is built, it is then pretty straightforward to implement a pricer for any path-independant derivative. Just implement a class derived from NumericalDerivative (see QuantLib::NumericalSwaption for example) and roll it back until the present time... Just look at QuantLib::TreeCapFloor and QuantLib::TreeSwaption for working pricers.

## Author

Generated automatically by Doxygen for QuantLib from the source code.