Accelerating the pace of engineering and science

# Documentation Center

• 평가판
• 제품 업데이트

## Specify a Conditional Variance Model

This example shows how to specify a conditional variance model for daily Deutschmark/British pound foreign exchange rates observed from January 1984 to December 1991.

Load the exchange rate data included with the toolbox.

```load Data_MarkPound
Y = Data;
N = length(Y);

figure
plot(Y)
set(gca,'XTick',[1,659,1318,1975]);
set(gca,'XTickLabel',{'Jan 1984','Jan 1986','Jan 1988',...
'Jan 1992'})
ylabel('Exchange Rate')
title('Deutschmark/British Pound Foreign Exchange Rate')```

The exchange rate looks nonstationary (it does not appear to fluctuate around a fixed level).

Step 2. Calculate the returns.

Convert the series to returns. This results in the loss of the first observation.

```r = price2ret(Y);

figure
plot(2:N,r)
set(gca,'XTick',[1,659,1318,1975]);
set(gca,'XTickLabel',{'Jan 1984','Jan 1986','Jan 1988',...
'Jan 1992'})
ylabel('Returns')
title('Deutschmark/British Pound Daily Returns')```

The returns series fluctuates around a common level, but exhibits volatility clustering.

Step 3. Check for autocorrelation.

Check the returns series for autocorrelation. Plot the sample ACF and PACF, and conduct a Ljung-Box Q-test.

```figure
subplot(2,1,1)
autocorr(r)
subplot(2,1,2)
parcorr(r)

[h,p] = lbqtest(r,[5 10 15])```
```h =

0     0     0

p =

0.3982    0.7278    0.2109```

The sample ACF and PACF show virtually no significant autocorrelation. The Ljung-Box Q-test null hypothesis that all autocorrelations up to the tested lags are zero is not rejected for tests at lags 5, 10, and 15. This suggests that a conditional mean model is not needed for this returns series.

Step 4. Check for conditional heteroscedasticity.

Check the return series for conditional heteroscedasticity. Plot the sample ACF and PACF of the squared returns series (after centering). Conduct Engle's ARCH test with a two-lag ARCH model alternative.

```figure
subplot(2,1,1)
autocorr((r-mean(r)).^2)
subplot(2,1,2)
parcorr((r-mean(r)).^2)

[h,p] = archtest(r-mean(r),'lags',2)```
```h =

1

p =

0```

The sample ACF and PACF of the squared returns show significant autocorrelation. This suggests a GARCH model with lagged variances and lagged squared innovations might be appropriate for modeling this series. Engle's ARCH test rejects the null hypothesis (h = 1) of no ARCH effects in favor of the alternative ARCH model with two lagged squared innovations. An ARCH model with two lagged innovations is locally equivalent to a GARCH(1,1) model.

Step 5. Specify a GARCH(1,1) model.

Based on the autocorrelation and conditional heteroscedasticity specification testing, specify the GARCH(1,1) model with a mean offset:

with and

Assume a Gaussian innovation distribution.

`model = garch('Offset',NaN,'GARCHLags',1,'ARCHLags',1)`
```model =

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```

The created model object, model, has NaN values for all unknown parameters in the specified GARCH(1,1) model.