# BraceGatarekMusiela

Create `BraceGatarekMusiela` model object for `Cap`, `Floor`, `FixedBond`, `FloatBond`, `FloatBondOption`, `FixedBondOption`, `OptionEmbeddedFixedBond`, or `OptionEmbeddedFloatBond` instrument

## Description

Create and price a `Cap`, `Floor`, `FloatBond`, `FloatBondOption`, `FixedBond`, `FixedBondOption`, `OptionEmbeddedFixedBond`, or `OptionEmbeddedFloatBond` instrument object with a `BraceGatarekMusiela` model using this workflow:

1. Use `finmodel` to specify a `BraceGatarekMusiela` model object for the `Cap`, `Floor`, `FixedBond`, `FloatBond`, `FloatBondOption`, `FixedBondOption`, `OptionEmbeddedFixedBond`, or `OptionEmbeddedFloatBond` instrument object.

2. Use `finpricer` to specify an `IRMonteCarlo` pricing method for a `Cap`, `Floor`, `FixedBond`, `FloatBond`, `FloatBondOption`, `FixedBondOption`, `OptionEmbeddedFixedBond`, or `OptionEmbeddedFloatBond` instrument object.

For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

For more information on the available pricing methods for a `Cap`, `Floor`, `FixedBond`, `FloatBond`, `FloatBondOption`, `FixedBondOption`, `OptionEmbeddedFixedBond`, or `OptionEmbeddedFloatBond` instrument, see Choose Instruments, Models, and Pricers.

## Creation

### Syntax

``BraceGatarekMusielaModelObj = finmodel(ModelType,'Volatility',volatility_value,'Correlation',correlation_value)``
``BraceGatarekMusielaModelObj = finmodel(___,Name,Value)``

### Description

example

````BraceGatarekMusielaModelObj = finmodel(ModelType,'Volatility',volatility_value,'Correlation',correlation_value)` creates a `BraceGatarekMusiela` model object by specifying `ModelType` and the required name-value pair arguments `Volatility` and `Correlation` to set the properties.```

example

````BraceGatarekMusielaModelObj = finmodel(___,Name,Value)` sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, ```BraceGatarekMusielaModelObj = finmodel("BraceGatarekMusiela",'Volatility',VolFunc,'Correlation',Correlation,'Period',1)``` creates a `BraceGatarekMusiela` model object. You can specify multiple name-value pair arguments.```

### Input Arguments

expand all

Model type, specified as a string with the value of `"BraceGatarekMusiela"` or a character vector with the value of `'BraceGatarekMusiela'`.

Data Types: `char` | `string`

`BraceGatarekMusiela` Name-Value Pair Arguments

Specify required and optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: ```BraceGatarekMusielaModelObj = finmodel("BraceGatarekMusiela",'Volatility',VolFunc,'Correlation',Correlation,'Period',1)```

Volatility, specified as the comma-separated pair consisting of `'Volatility'` and an (`NumRates-1`)-by-`1` cell array of function handles. Each function handle must take time as an input and return a scalar volatility.

Data Types: `double` | `cell`

Correlation matrix, specified as a comma-separated pair consisting of `'Correlation'` and a (`NumRates-1`)-by-(`NumRates-1`) correlation matrix.

Data Types: `double`

Optional `BraceGatarekMusiela` Name-Value Pair Arguments

expand all

Number of Brownian factors, specified as the comma-separated pair consisting of `'NumFactors'` and a scalar numeric. The default is `NaN` which means that `NumFactors` is equal to the number of rates.

Data Types: `double`

Period of forward rates, specified as the comma-separated pair consisting of `'Period'` and a scalar numeric. The default is `2`, meaning forward rates are spaced at `0`, `.5`, `1`, `1.5`, and so on.

Data Types: `double`

## Properties

expand all

Volatility, returned as a (`NumRates-1`)-by-`1` cell array of function handles.

Data Types: `double` | `cell`

Correlation matrix, returned as a (`NumRates-1`)-by-(`NumRates-1`) correlation matrix.

Data Types: `double`

Number of Brownian factors, returned as a scalar numeric.

Data Types: `double`

Period of forward rates, returned as a scalar numeric.

Data Types: `double`

## Examples

collapse all

This example shows the workflow to price a `Floor` instrument when using a `BraceGatarekMusiela` model and an `IRMonteCarlo` pricing method.

Create Floor Instrument Object

Use `fininstrument` to create a `Floor` instrument object.

`FloorOpt = fininstrument("Floor","Maturity",datetime(2022,9,15),'Strike',0.05,'Reset',1,'Name',"floor_option")`
```FloorOpt = Floor with properties: Strike: 0.0500 Maturity: 15-Sep-2022 ResetOffset: 0 Reset: 1 Basis: 0 Principal: 100 ProjectionCurve: [0x0 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: "floor_option" ```

Create BraceGatarekMusiela Model Object

Use `finmodel` to create a `LinearGaussian2F` model object.

```BGMVolFunc = @(a,t) (a(1)*t + a(2)).*exp(-a(3)*t) + a(4); BGMVolParams = [.3 -.02 .7 .14]; numRates = 20; VolFunc(1:numRates-1) = {@(t) BGMVolFunc(BGMVolParams,t)}; Beta = .08; CorrFunc = @(i,j,Beta) exp(-Beta*abs(i-j)); Correlation = CorrFunc(meshgrid(1:numRates-1)',meshgrid(1:numRates-1),Beta); BGM = finmodel("BraceGatarekMusiela",'Volatility',VolFunc,'Correlation',Correlation,'Period',1);```

Create `ratecurve` Object

Create a `ratecurve` object using `ratecurve`.

```Settle = datetime(2019,1,1); Type = 'zero'; ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)```
```myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [9x1 datetime] Rates: [9x1 double] Settle: 01-Jan-2019 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous" ```

Create `IRMonteCarlo` Pricer Object

Use `finpricer` to create an `IRMonteCarlo` pricer object and use the `ratecurve` object for the `'DiscountCurve'` name-value pair argument.

`outPricer = finpricer("IRMonteCarlo",'Model',BGM,'DiscountCurve',myRC,'SimulationDates',ZeroDates)`
```outPricer = BGMMonteCarlo with properties: NumTrials: 1000 RandomNumbers: [] DiscountCurve: [1x1 ratecurve] SimulationDates: [01-Jul-2019 01-Jan-2020 01-Jan-2021 ... ] Model: [1x1 finmodel.BraceGatarekMusiela] ```

Price `Floor` Instrument

Use `price` to compute the price and sensitivities for the `Floor` instrument.

`[Price,outPR] = price(outPricer,FloorOpt,["all"])`
```Price = 14.7882 ```
```outPR = priceresult with properties: Results: [1x3 table] PricerData: [1x1 struct] ```
`outPR.Results`
```ans=1×3 table Price Delta Gamma ______ ______ ______ 14.788 -400.4 1280.7 ```

expand all