# Using egarch Objects

EGARCH conditional variance time series model

An `egarch` model object specifies the functional form and stores the parameter values of a exponential generalized autoregressive conditional heteroscedastic (EGARCH) model. EGARCH models attempt to address volatility clustering in an innovations process. Volatility clustering occurs when an innovations process does not exhibit significant autocorrelation, but the variance of the process changes with time. EGARCH models are appropriate when positive and negative shocks of equal magnitude might not contribute equally to volatility [1].

The EGARCH(P,Q) conditional variance model includes:

• P past log conditional variances that compose the GARCH component polynomial

• Q past standardized innovations that compose the ARCH and leverage component polynomials

To create an `egarch` model object, use `egarch`. Specify only the GARCH and ARCH (and leverage) polynomial degrees P and Q, respectively, using the shorthand syntax `egarch(P,Q)`. Then, pass the model and time series data to `estimate` to fit the model to the data. Or, specify the values of some parameters, and then estimate others.

Use a completely specified model (i.e., all parameter values of the model are known) to:

## Examples

collapse all

### Create EGARCH Model

Create an `egarch` model object using name-value pair arguments.

Specify an EGARCH(1,1) model. By default, the conditional mean model offset is zero. Specify that the offset is `NaN`. Include a leverage term.

```Mdl = egarch('GARCHLags',1,'ARCHLags',1,'LeverageLags',1,'Offset',NaN) ```
```Mdl = EGARCH(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] Leverage: {NaN} at Lags [1] Offset: NaN ```

`Mdl` is an `egarch` model object. The software sets all parameters to `NaN`, except `P`, `Q`, and `Distribution`.

Since `Mdl` contains `NaN` values, `Mdl` is appropriate for estimation only. Pass `Mdl` and time-series data to `estimate`. For a continuation of this example, see Estimate EGARCH Model.

### Create EGARCH Model Using Shorthand Syntax

Create an `egarch` model object using the shorthand notation `egarch(P,Q)`, where `P` is the degree of the GARCH polynomial and `Q` is the degree of the ARCH and leverage polynomial.

Create an EGARCH(3,2) model.

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

`Mdl` is an `egarch` model object. All properties of `Mdl`, except `P`, `Q`, and `Distribution`, are `NaN` values. By default, the software:

• Includes a conditional variance model constant

• Excludes a conditional mean model offset (i.e., the offset is `0`)

• Includes all lag terms in the GARCH polynomial up to lag `P`

• Includes all lag terms in the ARCH and leverage polynomials up to lag `Q`

`Mdl` specifies only the functional form of an EGARCH model. Because it contains unknown parameter values, you can pass `Mdl` and time-series data to `estimate` to estimate the parameters.

### Access EGARCH Model Properties

Access the properties of a created `egarch` model object using dot notation.

Create an `egarch` model object.

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

Remove the second GARCH term from the model. That is, specify that the GARCH coefficient of the second lagged conditional variance is `0`.

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

The GARCH polynomial has two unknown parameters corresponding to lags 1 and 3.

Display the distribution of the disturbances.

```Mdl.Distribution ```
```ans = Name: 'Gaussian' ```

The disturbances are Gaussian with mean 0 and variance 1.

Specify that the underlying disturbances have a t distribution with five degrees of freedom.

```Mdl.Distribution = struct('Name','t','DoF',5) ```
```Mdl = EGARCH(3,2) Conditional Variance Model: ----------------------------------------- Distribution: Name = 't', DoF = 5 P: 3 Q: 2 Constant: NaN GARCH: {NaN NaN} at Lags [1 3] ARCH: {NaN NaN} at Lags [1 2] Leverage: {NaN NaN} at Lags [1 2] ```

Specify that the ARCH coefficients are 0.2 for the first lag and 0.1 for the second lag.

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

To estimate the remaining parameters, you can pass `Mdl` and your data to estimate and use the specified parameters as equality constraints. Or, you can specify the rest of the parameter values, and then simulate or forecast conditional variances from the GARCH model by passing the fully specified model to `simulate` or `forecast`, respectively.

### Estimate EGARCH Model

Fit an EGARCH model to an annual time series of Danish nominal stock returns from 1922-1999. The example follows from Create EGARCH Model.

Load the `Data_Danish` data set. Plot the nominal returns (`RN`).

```load Data_Danish; nr = DataTable.RN; figure; plot(dates,nr); hold on; plot([dates(1) dates(end)],[0 0],'r:'); % Plot y = 0 hold off; title('Danish Nominal Stock Returns'); ylabel('Nominal return (%)'); xlabel('Year'); ```

The nominal return series seems to have a nonzero conditional mean offset and seems to exhibit volatility clustering. That is, the variability is smaller for earlier years than it is for later years. For this example, assume that an EGARCH(1,1) model is appropriate for this series.

Create an EGARCH(1,1) model. The conditional mean offset is zero by default. To estimate the offset, specify that it is `NaN`. Include a leverage lag.

```Mdl = egarch('GARCHLags',1,'ARCHLags',1,'LeverageLags',1,'Offset',NaN); ```

Fit the EGARCH(1,1) model to the data.

```EstMdl = estimate(Mdl,nr); ```
``` EGARCH(1,1) Conditional Variance Model: -------------------------------------- Conditional Probability Distribution: Gaussian Standard t Parameter Value Error Statistic ----------- ----------- ------------ ----------- Constant -0.62723 0.744008 -0.843043 GARCH{1} 0.774189 0.23628 3.27657 ARCH{1} 0.38636 0.373606 1.03414 Leverage{1} -0.00249883 0.19222 -0.0129998 Offset 0.10325 0.0377269 2.73676 ```

`EstMdl` is a fully specified `egarch` model object. That is, it does not contain `NaN` values. You can assess the adequacy of the model by generating residuals using `infer`, and then analyzing them.

To simulate conditional variances or responses, pass `EstMdl` to `simulate`. See Simulate EGARCH Model Observations and Conditional Variances.

To forecast innovations, pass `EstMdl` to `forecast`. See Forecast EGARCH Model Conditional Variances.

### Simulate EGARCH Model Observations and Conditional Variances

Simulate conditional variance or response paths from a fully specified `egarch` model object. That is, simulate from an estimated `egarch` model or a known `egarch` model in which you specify all parameter values. This example follows from Estimate EGARCH Model.

Load the `Data_Danish` data set.

```load Data_Danish; rn = DataTable.RN; ```

Create an EGARCH(1,1) model with an unknown conditional mean offset. Fit the model to the annual, nominal return series. Include a leverage term.

```Mdl = egarch('GARCHLags',1,'ARCHLags',1,'LeverageLags',1,'Offset',NaN); EstMdl = estimate(Mdl,rn); ```
``` EGARCH(1,1) Conditional Variance Model: -------------------------------------- Conditional Probability Distribution: Gaussian Standard t Parameter Value Error Statistic ----------- ----------- ------------ ----------- Constant -0.62723 0.744008 -0.843043 GARCH{1} 0.774189 0.23628 3.27657 ARCH{1} 0.38636 0.373606 1.03414 Leverage{1} -0.00249883 0.19222 -0.0129998 Offset 0.10325 0.0377269 2.73676 ```

Simulate 100 paths of conditional variances and responses from the estimated EGARCH model.

```numObs = numel(rn); % Sample size (T) numPaths = 100; % Number of paths to simulate rng(1); % For reproducibility [VSim,YSim] = simulate(EstMdl,numObs,'NumPaths',numPaths); ```

`VSim` and `YSim` are `T`-by- `numPaths` matrices. Rows correspond to a sample period, and columns correspond to a simulated path.

Plot the average and the 97.5% and 2.5% percentiles of the simulate paths. Compare the simulation statistics to the original data.

```VSimBar = mean(VSim,2); VSimCI = quantile(VSim,[0.025 0.975],2); YSimBar = mean(YSim,2); YSimCI = quantile(YSim,[0.025 0.975],2); figure; subplot(2,1,1); h1 = plot(dates,VSim,'Color',0.8*ones(1,3)); hold on; h2 = plot(dates,VSimBar,'k--','LineWidth',2); h3 = plot(dates,VSimCI,'r--','LineWidth',2); hold off; title('Simulated Conditional Variances'); ylabel('Cond. var.'); xlabel('Year'); subplot(2,1,2); h1 = plot(dates,YSim,'Color',0.8*ones(1,3)); hold on; h2 = plot(dates,YSimBar,'k--','LineWidth',2); h3 = plot(dates,YSimCI,'r--','LineWidth',2); hold off; title('Simulated Nominal Returns'); ylabel('Nominal return (%)'); xlabel('Year'); legend([h1(1) h2 h3(1)],{'Simulated path' 'Mean' 'Confidence bounds'},... 'FontSize',7,'Location','NorthWest'); ```

### Forecast EGARCH Model Conditional Variances

Forecast conditional variances from a fully specified `egarch` model object. That is, forecast from an estimated `egarch` model or a known `egarch` model in which you specify all parameter values. The example follows from Estimate EGARCH Model.

Load the `Data_Danish` data set.

```load Data_Danish; nr = DataTable.RN; ```

Create an EGARCH(1,1) model with an unknown conditional mean offset and include a leverage term. Fit the model to the annual nominal return series.

```Mdl = egarch('GARCHLags',1,'ARCHLags',1,'LeverageLags',1,'Offset',NaN); EstMdl = estimate(Mdl,nr); ```
``` EGARCH(1,1) Conditional Variance Model: -------------------------------------- Conditional Probability Distribution: Gaussian Standard t Parameter Value Error Statistic ----------- ----------- ------------ ----------- Constant -0.62723 0.744008 -0.843043 GARCH{1} 0.774189 0.23628 3.27657 ARCH{1} 0.38636 0.373606 1.03414 Leverage{1} -0.00249883 0.19222 -0.0129998 Offset 0.10325 0.0377269 2.73676 ```

Forecast the conditional variance of the nominal return series 10 years into the future using the estimated EGARCH model. Specify the entire returns series as presample observations. The software infers presample conditional variances using the presample observations and the model.

```numPeriods = 10; vF = forecast(EstMdl,numPeriods,'Y0',nr); ```

Plot the forecasted conditional variances of the nominal returns. Compare the forecasts to the observed conditional variances.

```v = infer(EstMdl,nr); figure; plot(dates,v,'k:','LineWidth',2); hold on; plot(dates(end):dates(end) + 10,[v(end);vF],'r','LineWidth',2); title('Forecasted Conditional Variances of Nominal Returns'); ylabel('Conditional variances'); xlabel('Year'); legend({'Estimation sample cond. var.','Forecasted cond. var.'},... 'Location','Best'); ```

## Properties

 Conditional Variance Model Properties Specify conditional variance model functional form and parameter values

## Object Functions

 estimate Fit conditional variance model to data filter Filter disturbances through conditional variance model forecast Forecast conditional variances from conditional variance models infer Infer conditional variances of conditional variance models print Display parameter estimation results for conditional variance models simulate Monte Carlo simulation of conditional variance models

## Create Object

Create `egarch` models using `egarch`.

You can specify an `egarch` model as part of a composition of conditional mean and variance models. For details, see `arima`.