# capbylg2f

Price cap using Linear Gaussian two-factor model

## Syntax

``CapPrice = capbylg2f(ZeroCurve,a,b,sigma,eta,rho,Strike,Maturity)``
``CapPrice = capbylg2f(___,Name,Value)``

## Description

example

````CapPrice = capbylg2f(ZeroCurve,a,b,sigma,eta,rho,Strike,Maturity)` returns cap price for a two-factor additive Gaussian interest-rate model. NoteAlternatively, you can use the `Cap` object to price cap instruments. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments. ```

example

````CapPrice = capbylg2f(___,Name,Value)` adds optional name-value pair arguments. NoteUse the optional name-value pair argument, `Notional`, to pass a schedule to compute the price for an amortizing cap. ```

## Examples

collapse all

Define the `ZeroCurve`, `a`, `b`, `sigma`, `eta`, and `rho` parameters to price the cap.

```Settle = datetime(2007,12,15); ZeroTimes = [3/12 6/12 1 5 7 10 20 30]'; ZeroRates = [0.033 0.034 0.035 0.040 0.042 0.044 0.048 0.0475]'; CurveDates = daysadd(Settle,360*ZeroTimes); irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates); a = .07; b = .5; sigma = .01; eta = .006; rho = -.7; CapMaturity = daysadd(Settle,360*[1:5 7 10 15 20 25 30],1); Strike = [0.035 0.037 0.038 0.039 0.040 0.042 0.044 0.046 0.047 0.047 0.047]'; Price = capbylg2f(irdc,a,b,sigma,eta,rho,Strike,CapMaturity)```
```Price = 11×1 0.0218 0.3167 0.7640 1.3055 1.9152 3.0909 4.7998 7.3122 9.7917 11.4568 ⋮ ```

Define the `ZeroCurve`, `a`, `b`, `sigma`, `eta`, `rho`, and `Notional` parameters for the amortizing cap.

```Settle = datetime(2007,12,15); % Define ZeroCurve ZeroTimes = [3/12 6/12 1 5 7 10 20 30]'; ZeroRates = [0.033 0.034 0.035 0.040 0.042 0.044 0.048 0.0475]'; CurveDates = daysadd(Settle,360*ZeroTimes); irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates); % Define a, b, sigma, eta, and rho a = .07; b = .5; sigma = .01; eta = .006; rho = -.7; % Define the amortizing caps CapMaturity = daysadd(Settle,360*[1:5 7 10 15 20 25 30],1); Strike = [0.035 0.037 0.038 0.039 0.040 0.042 0.044 0.046 0.047 0.047 0.047]'; Notional = {{datetime(2010,12,15) 100;datetime(2014,12,15) 70;datetime(2022,12,15) 40;datetime(2037,12,15) 10}}; % Price the amortizing caps Price = capbylg2f(irdc,a,b,sigma,eta,rho,Strike,CapMaturity, 'Notional', Notional)```
```Price = 11×1 0.0218 0.3167 0.7640 1.1150 1.5162 2.2952 2.8006 3.6532 3.6963 3.8628 ⋮ ```

## Input Arguments

collapse all

Zero-curve for the Linear Gaussian two-factor model, specified using `IRDataCurve` or `RateSpec`.

Data Types: `struct`

Mean reversion for first factor for the Linear Gaussian two-factor model, specified as a scalar numeric.

Data Types: `double`

Mean reversion for second factor for the Linear Gaussian two-factor model, specified as a scalar numeric.

Data Types: `double`

Volatility for first factor for the Linear Gaussian two-factor model, specified as a scalar numeric.

Data Types: `double`

Volatility for second factor for the Linear Gaussian two-factor model, specified as a scalar numeric.

Data Types: `double`

Scalar correlation of the factors, specified as a scalar numeric.

Data Types: `double`

Cap strike price, specified as a nonnegative integer using a `NumCaps`-by-`1` vector.

Data Types: `double`

Cap maturity date, specified using a `NumCaps`-by-`1` vector using a datetime array, string array, or date character vectors.

To support existing code, `capbylg2f` also accepts serial date numbers as inputs, but they are not recommended.

### Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

Example: ```Price = capbylg2f(irdc,a,b,sigma,eta,rho,Strike,CapMaturity,'Reset',1,'Notional',100)```

Frequency of cap payments per year, specified as the comma-separated pair consisting of `'Reset'` and a positive integers for the values `[1,2,4,6,12]` in a `NumCaps`-by-`1` vector.

Data Types: `single` | `double`

Notional value of cap, specified as the comma-separated pair consisting of `'Notional'` and a `NINST`-by-`1` of notional principal amounts or `NINST`-by-`1` cell array where each element is a `NumDates`-by-`2` cell array where the first column is dates and the second column is the associated principal amount. The date indicates the last day that the principal value is valid.

Data Types: `single` | `double`

## Output Arguments

collapse all

Expected prices of cap, returned as a scalar or an `NumCaps`-by-`1` vector.

collapse all

### Cap

A cap is a contract that includes a guarantee that sets the maximum interest rate to be paid by the holder, based on an otherwise floating interest rate.

The payoff for a cap is:

$\mathrm{max}\left(CurrentRate-CapRate,0\right)$

## Algorithms

The following defines the two-factor additive Gaussian interest rate model, given the `ZeroCurve`, `a`, `b`, `sigma`, `eta`, and `rho` parameters:

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

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

`$dy\left(t\right)=-b\left(y\right)\left(t\right)dt+\eta \left(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.

## References

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

## Version History

Introduced in R2013a

expand all