MATLAB Examples

Dot Notation

A model created by garch, egarch, or gjr has values assigned to all model properties. To change any of these property values, you do not need to reconstruct the whole model. You can modify property values of an existing model using dot notation. That is, type the model name, then the property name, separated by '.' (a period).

```Mdl = garch(1,1) ```
```Mdl = GARCH(1,1) Conditional Variance Model: -------------------------------------- Distribution: Name = 'Gaussian' P: 1 Q: 1 Constant: NaN GARCH: {NaN} at Lags [1] ARCH: {NaN} at Lags [1] ```

The default model has no mean offset, so the Offset property does not appear in the model output. The property exists, however:

```Offset = Mdl.Offset ```
```Offset = 0 ```

Modify the model to add an unknown mean offset term:

```Mdl.Offset = NaN ```
```Mdl = GARCH(1,1) Conditional Variance Model with Offset: -------------------------------------------------- Distribution: Name = 'Gaussian' P: 1 Q: 1 Constant: NaN GARCH: {NaN} at Lags [1] ARCH: {NaN} at Lags [1] Offset: NaN ```

Offset now appears in the model output, with the updated nonzero value.

Be aware that every model property has a data type. Any modifications you make to a property value must be consistent with the data type of the property. For example, GARCH and ARCH (and Leverage for egarch and gjr models) are all cell vectors. This means you must index them using cell array syntax.

```GJRMdl = gjr(1,1) ```
```GJRMdl = GJR(1,1) Conditional Variance Model: -------------------------------------- Distribution: Name = 'Gaussian' P: 1 Q: 1 Constant: NaN GARCH: {NaN} at Lags [1] ARCH: {NaN} at Lags [1] Leverage: {NaN} at Lags [1] ```

To modify the property value of GARCH, assign GARCH a cell array. Here, assign known GARCH coefficient values:

```GJRMdl.GARCH = {0.6,0.2} ```
```GJRMdl = GJR(2,1) Conditional Variance Model: -------------------------------------- Distribution: Name = 'Gaussian' P: 2 Q: 1 Constant: NaN GARCH: {0.6 0.2} at Lags [1 2] ARCH: {NaN} at Lags [1] Leverage: {NaN} at Lags [1] ```

The updated model now has two GARCH terms (at lags 1 and 2) with the specified equality constraints.

Similarly, the data type of Distribution is a data structure. The default data structure has only one field, Name, with value 'Gaussian'.

```Distribution = GJRMdl.Distribution ```
```Distribution = struct with fields: Name: 'Gaussian' ```

To modify the innovation distribution, assign Distribution a new name or data structure. The data structure can have up to two fields, Name and DoF. The second field corresponds to the degrees of freedom for a Student's t distribution, and is only required if Name has the value 't'.

To specify a Student's t distribution with unknown degrees of freedom, enter:

```GJRMdl.Distribution = 't' ```
```GJRMdl = GJR(2,1) Conditional Variance Model: -------------------------------------- Distribution: Name = 't', DoF = NaN P: 2 Q: 1 Constant: NaN GARCH: {0.6 0.2} at Lags [1 2] ARCH: {NaN} at Lags [1] Leverage: {NaN} at Lags [1] ```

The updated model has a Student's t distribution with NaN degrees of freedom. To specify a t distribution with eight degrees of freedom, say:

```GJRMdl.Distribution = struct('Name','t','DoF',8) ```
```GJRMdl = GJR(2,1) Conditional Variance Model: -------------------------------------- Distribution: Name = 't', DoF = 8 P: 2 Q: 1 Constant: NaN GARCH: {0.6 0.2} at Lags [1 2] ARCH: {NaN} at Lags [1] Leverage: {NaN} at Lags [1] ```

The degrees of freedom property in the model is updated. Note that the DoF field of Distribution is not directly assignable. For example, GJRMdl.Distribution.DoF = 8 is not a valid assignment. However, you can get the individual fields:

```DistributionDoF = GJRMdl.Distribution.DoF ```
```DistributionDoF = 8 ```