# LinearGaussian2F class

Create two-factor additive Gaussian interest-rate model

## Description

The two-factor additive Gaussian interest rate-model is specified using the zero curve, a, b, sigma, eta, and rho parameters for these equations:

$r\left(t\right)=x\left(t\right)+y\left(t\right)+\varphi \left(t\right)$

$dx\left(t\right)=-a\left(t\right)x\left(t\right)dt+\sigma \left(t\right)d{W}_{1}\left(t\right),x\left(0\right)=0$

$dy\left(t\right)=-b\left(t\right)y\left(t\right)dt+\eta \left(t\right)d{W}_{2}\left(t\right),y\left(0\right)=0$

where $d{W}_{1}\left(t\right)d{W}_{2}\left(t\right)=\rho dt$ is a two-dimensional Brownian motion with correlation ρ, and ϕ is a function chosen to match the initial zero curve.

## Construction

`OBJ = LinearGaussian2F(ZeroCurve,a,b,sigma,eta,rho)` constructs an object for a two-factor additive Gaussian interest-rate model.

For example:

```Settle = datenum('15-Dec-2007'); CurveTimes = [1:5 7 10 20]'; ZeroRates = [.01 .018 .024 .029 .033 .034 .035 .034]'; CurveDates = daysadd(Settle,360*CurveTimes,1); irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates); a = .07; b = .5; sigma = .01; eta = .006; rho = -.7; G2PP = LinearGaussian2F(irdc,a,b,sigma,eta,rho);```

## Properties

The following properties are from the `LinearGaussian2F` class.

`ZeroCurve`

`ZeroCurve` is specified using `IRDataCurve` or `RateSpec`. This is the zero curve used to evolve the path of future interest rates.

Attributes:

 `SetAccess` `public` `GetAccess` `public`

`a`

Mean reversion for the first factor, specified either as a scalar or function handle which takes time as input and returns a scalar mean reversion value.

Attributes:

 `SetAccess` `public` `GetAccess` `public`

`b`

Mean reversion for the second factor, specified either as a scalar or as a function handle which takes time as input and returns a scalar mean reversion value.

Attributes:

 `SetAccess` `public` `GetAccess` `public`

`sigma`

Volatility for the first factor, specified either as a scalar or function handle which takes time as input and returns a scalar mean volatility.

Attributes:

 `SetAccess` `public` `GetAccess` `public`

`eta`

Volatility for the second factor specified, either as a scalar or function handle which takes time as input and returns a scalar mean volatility.

Attributes:

 `SetAccess` `public` `GetAccess` `public`

`rho`

Scalar correlation of the factors.

Attributes:

 `SetAccess` `public` `GetAccess` `public`

## Methods

 simTermStructs Simulate term structures for two-factor additive Gaussian interest-rate model

## Definitions

### Two-Factor Additive Gaussian Interest-Rate Model

Short-rate model based on two factors where the short rate is the sum of the two factors and a deterministic function, in this case ϕ(t), which is chosen to match the initial term structure.

## Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.

## Examples

collapse all

### Construct a Two-Factor Additive Gaussian Interest-Rate Model

Construct a two-factor additive Gaussian interest-rate model.

```Settle = datenum('15-Dec-2007'); CurveTimes = [1:5 7 10 20]'; ZeroRates = [.01 .018 .024 .029 .033 .034 .035 .034]'; CurveDates = daysadd(Settle,360*CurveTimes,1); irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates); a = .07; b = .5; sigma = .01; eta = .006; rho = -.7; G2PP = LinearGaussian2F(irdc,a,b,sigma,eta,rho) ```
```G2PP = LinearGaussian2F with properties: ZeroCurve: [1x1 IRDataCurve] a: @(t,V)ina b: @(t,V)inb sigma: @(t,V)insigma eta: @(t,V)ineta rho: -0.7000 ```

Use the `simTermStructs` method to simulate term structures based on the `LinearGaussian2F` model.

``` SimPaths = simTermStructs(G2PP, 10,'nTrials',100); ```

## References

Brigo, D. and F. Mercurio, Interest Rate Models - Theory and Practice, Springer Finance, 2006.