Time Series - HW 6

profileHenryMa
r_-_garchandigarchexamples-sp500_tsay_.pdf

Estimation: Conditional MLE or Quasi MLE

Special Note: In this course, we estimate volatility models using

the R package fGarch with garchFit command. The program is

easy to use and allows for several types of innovational distributions:

The default is Gaussian (norm), standardized Student-t distribution

(std), generalized error distribution (ged), skew normal distribution

(snorm), skew Student-t (sstd), skew generalized error distribution

(sged), and standardized inverse normal distribution (snig). Except

for the inverse normal distribution, other distribution functions are

discussed in the textbook. Readers should check the book for details

about the density functions and their parameters.

Example: Monthly log returns of Intel stock

R demonstration: The Use fGarch package.

> library(fGarch)

> da=read.table("m-intc7303.txt",header=T)

> head(da)

date rtn

1 19730131 0.01005

.....

6 19730629 0.13333

> intc=log(da$rtn+1) <== log returns

> acf(intc)

> acf(intc^2)

> pacf(intc^2)

> Box.test(intc^2,lag=10,type=’Ljung’)

Box-Ljung test

data: intc^2

X-squared = 59.7216, df = 10, p-value = 4.091e-09

> m1=garchFit(~garch(3,0),data=intc,trace=F) <== trace=F reduces the amount of output.

> summary(m1)

Title:

GARCH Modelling

Call:

garchFit(formula = ~garch(3, 0), data = intc, trace = F)

Mean and Variance Equation:

7

data ~ garch(3, 0)

[data = intc]

Conditional Distribution:

norm

Coefficient(s):

mu omega alpha1 alpha2 alpha3

0.016572 0.012043 0.208649 0.071837 0.049045

Std. Errors:

based on Hessian

Error Analysis:

Estimate Std. Error t value Pr(>|t|)

mu 0.016572 0.006423 2.580 0.00988 **

omega 0.012043 0.001579 7.627 2.4e-14 ***

alpha1 0.208649 0.129177 1.615 0.10626

alpha2 0.071837 0.048551 1.480 0.13897

alpha3 0.049045 0.048847 1.004 0.31536

---

Standardised Residuals Tests:

Statistic p-Value

Jarque-Bera Test R Chi^2 169.7731 0

Shapiro-Wilk Test R W 0.9606957 1.970413e-08

Ljung-Box Test R Q(10) 10.97025 0.3598405

Ljung-Box Test R Q(15) 19.59024 0.1882211

Ljung-Box Test R Q(20) 20.82192 0.40768

Ljung-Box Test R^2 Q(10) 5.376602 0.864644

Ljung-Box Test R^2 Q(15) 22.73460 0.08993976

Ljung-Box Test R^2 Q(20) 23.70577 0.255481

LM Arch Test R TR^2 20.48506 0.05844884

Information Criterion Statistics:

AIC BIC SIC HQIC

-1.228111 -1.175437 -1.228466 -1.207193

> m1=garchFit(~garch(1,0),data=intc,trace=F)

> summary(m1)

Title:

GARCH Modelling

Call:

garchFit(formula = ~garch(1, 0), data = intc, trace = F)

Mean and Variance Equation:

8

data ~ garch(1, 0)

[data = intc]

Conditional Distribution:

norm

Coefficient(s):

mu omega alpha1

0.016570 0.012490 0.363447

Std. Errors:

based on Hessian

Error Analysis:

Estimate Std. Error t value Pr(>|t|)

mu 0.016570 0.006161 2.689 0.00716 **

omega 0.012490 0.001549 8.061 6.66e-16 ***

alpha1 0.363447 0.131598 2.762 0.00575 **

---

Log Likelihood:

230.2423 normalized: 0.6189309

Standardised Residuals Tests:

Statistic p-Value

Jarque-Bera Test R Chi^2 122.4040 0

Shapiro-Wilk Test R W 0.9647629 8.274158e-08

Ljung-Box Test R Q(10) 13.72604 0.1858587 <=== Meaning?

Ljung-Box Test R Q(15) 22.31714 0.09975386 <==== implication?

Ljung-Box Test R Q(20) 23.88257 0.2475594

Ljung-Box Test R^2 Q(10) 12.50025 0.2529700

Ljung-Box Test R^2 Q(15) 30.11276 0.01152131

Ljung-Box Test R^2 Q(20) 31.46404 0.04935483

LM Arch Test R TR^2 22.036 0.0371183

Information Criterion Statistics:

AIC BIC SIC HQIC

-1.221733 -1.190129 -1.221861 -1.209182

> plot(m1)

Make a plot selection (or 0 to exit):

1: Time Series

2: Conditional SD

3: Series with 2 Conditional SD Superimposed

4: ACF of Observations

5: ACF of Squared Observations

9

6: Cross Correlation

7: Residuals

8: Conditional SDs

9: Standardized Residuals

10: ACF of Standardized Residuals

11: ACF of Squared Standardized Residuals

12: Cross Correlation between r^2 and r

13: QQ-Plot of Standardized Residuals

Selection: 13

Make a plot selection (or 0 to exit):

1: Time Series

2: Conditional SD

3: Series with 2 Conditional SD Superimposed

4: ACF of Observations

5: ACF of Squared Observations

6: Cross Correlation

7: Residuals

8: Conditional SDs

9: Standardized Residuals

10: ACF of Standardized Residuals

11: ACF of Squared Standardized Residuals

12: Cross Correlation between r^2 and r

13: QQ-Plot of Standardized Residuals

Selection: 0

The fitted ARCH(1) model is

rt = 0.0176 + at, at = σt�t, �t ∼ N(0, 1) σ2t = 0.0125 + 0.363σ

2 t−1.

Model checking statistics indicate that there are some higher order

dependence in the volatility, e.g., see Q(15) for the squared standard-

ized residuals. It turns out that a GARCH(1,1) model fares better

for the data.

Next, consider Student-t innovations. R demonstration > m2=garchFit(~garch(1,0),data=intc,cond.dist="std",trace=F)

10

�3 �2 �1 0 1 2 3

�4 �2

0 2

qnorm � QQ Plot

Theoretical Quantiles

Sa m

ple Q

ua nt

ile s

Figure 3: QQ-plot for standardized residuals of an ARCH(1) model with Gaussian innova- tions for monthly log returns of INTC stock: 1973 to 2003.

> summary(m2)

Title:

GARCH Modelling

Call:

garchFit(formula = ~garch(1, 0), data = intc, cond.dist = "std",

trace = F)

Mean and Variance Equation:

data ~ garch(1, 0)

[data = intc]

Conditional Distribution: <====== Standardized Student-t.

std

Coefficient(s):

mu omega alpha1 shape

0.021571 0.013424 0.259867 5.985979

Std. Errors:

based on Hessian

11

Error Analysis:

Estimate Std. Error t value Pr(>|t|)

mu 0.021571 0.006054 3.563 0.000366 ***

omega 0.013424 0.001968 6.820 9.09e-12 ***

alpha1 0.259867 0.119901 2.167 0.030209 *

shape 5.985979 1.660030 3.606 0.000311 *** <== Estimate of degrees of freedom

---

Log Likelihood:

242.9678 normalized: 0.6531391

Standardised Residuals Tests:

Statistic p-Value

Jarque-Bera Test R Chi^2 130.8931 0

Shapiro-Wilk Test R W 0.9637529 5.744026e-08

Ljung-Box Test R Q(10) 14.31288 0.1591926

Ljung-Box Test R Q(15) 23.34043 0.07717449

Ljung-Box Test R Q(20) 24.87286 0.2063387

Ljung-Box Test R^2 Q(10) 15.35917 0.1195054

Ljung-Box Test R^2 Q(15) 33.96318 0.003446127

Ljung-Box Test R^2 Q(20) 35.46828 0.01774746

LM Arch Test R TR^2 24.11517 0.01961957

Information Criterion Statistics:

AIC BIC SIC HQIC

-1.284773 -1.242634 -1.285001 -1.268039

> plot(m2)

Make a plot selection (or 0 to exit):

1: Time Series

2: Conditional SD

3: Series with 2 Conditional SD Superimposed

4: ACF of Observations

5: ACF of Squared Observations

6: Cross Correlation

7: Residuals

8: Conditional SDs

9: Standardized Residuals

10: ACF of Standardized Residuals

11: ACF of Squared Standardized Residuals

12: Cross Correlation between r^2 and r

13: QQ-Plot of Standardized Residuals

Selection: 13 <== The plot shows that the model needs further improvements.

12

> predict(m2,5) <===== Prediction

meanForecast meanError standardDeviation

1 0.02157100 0.1207911 0.1207911

2 0.02157100 0.1312069 0.1312069

3 0.02157100 0.1337810 0.1337810

4 0.02157100 0.1344418 0.1344418

5 0.02157100 0.1346130 0.1346130

The fitted model with Student-t innovations is

rt = 0.0216 + at, at = σt�t, � ∼ t5.99 σ2t = 0.0134 + 0.260a

2 t−1.

We use t5.99 to denote the standardized Student-t distribution with

5.99 d.f.

Comparison with normal innovations:

• Using a heavy-tailed dist for �t reduces the ARCH effect. • The difference between the models is small for this particular instance.

You may try other distributions for �t.

GARCH Model

at = σt�t,

σ2t = α0 + m∑

i=1 αia

2 t−i +

s∑

j=1 βjσ

2 t−j

where {�t} is defined as before, α0 > 0, αi ≥ 0, βj ≥ 0, and ∑max(m,s) i=1 (αi + βi) < 1.

Re-parameterization:

Let ηt = a 2 t − σ2t . {ηt} un-correlated series.

The GARCH model becomes

a2t = α0 + max(m,s)∑

i=1 (αi + βi)a

2 t−i + ηt −

s∑

j=1 βjηt−j.

13

This is an ARMA form for the squared series a2t .

Use it to understand properties of GARCH models, e.g. moment

equations, forecasting, etc.

Focus on a GARCH(1,1) model

σ2t = α0 + α1a 2 t−1 + β1σ

2 t−1,

• Weak stationarity: 0 ≤ α1, β1 ≤ 1, (α1 + β1) < 1. • Volatility clusters • Heavy tails: if 1− 2α21 − (α1 + β1)2 > 0, then

E(a4t )

[E(a2t )] 2 =

3[1− (α1 + β1)2] 1− (α1 + β1)2 − 2α21

> 3.

• For 1-step ahead forecast, σ2h(1) = α0 + α1a

2 h + β1σ

2 h.

For multi-step ahead forecasts, use a2t = σ 2 t �

2 t and rewrite the

model as

σ2t+1 = α0 + (α1 + β1)σ 2 t + α1σ

2 t (�

2 t − 1).

2-step ahead volatility forecast

σ2h(2) = α0 + (α1 + β1)σ 2 h(1).

In general, we have

σ2h( ) = α0 + (α1 + β1)σ 2 h( − 1), > 1.

This result is exactly the same as that of an ARMA(1,1) model

with AR polynomial 1− (α1 + β1)B.

14

Example: Monthly excess returns of S&P 500 index starting from

1926 for 792 observations.

The fitted of a Gaussian AR(3) model

r̃t = rt − 0.0062 r̃t = .089r̃t−1 − .024r̃t−2 − .123r̃t−3 + .007 + at,

σ̂2a = 0.00333.

For the GARCH effects, use a GARCH(1,1) model, we have

A joint estimation:

rt = 0.032rt−1 − 0.030rt−2 − 0.011rt−3 + 0.0077 + at σ2t = 7.98× 10−5 + .853σ2t−1 + 0.124a2t−1.

Implied unconditional variance of at is

0.0000798

1− 0.853− 0.1243 = 0.00352 close to the expected value. All AR coefficients are statistically in-

significant.

A simplified model:

rt = 0.00745 + at, σ 2 t = 8.06× 10−5 + .854σ2t−1 + .122a2t−1.

Model checking:

For ãt: Q(10) = 11.22(0.34) and Q(20) = 24.30(0.23).

For ã2t : Q(10) = 9.92(0.45) and Q(20) = 16.75(0.67).

Forecast: 1-step ahead forecast:

σ2h(1) = 0.00008 + 0.854σ 2 h + 0.122a

2 h

Horizon 1 2 3 4 5 ∞ Return .0074 .0074 .0074 .0074 .0074 .0074

Volatility .054 .054 .054 .054 .054 .059

15

R demonstration:

> sp5=scan("sp500.txt")

Read 792 items

> pacf(sp5)

> m1=arima(sp5,order=c(3,0,0))

> m1

Call:

arima(x = sp5, order = c(3, 0, 0))

Coefficients:

ar1 ar2 ar3 intercept

0.0890 -0.0238 -0.1229 0.0062

s.e. 0.0353 0.0355 0.0353 0.0019

sigma^2 estimated as 0.00333: log likelihood = 1135.25, aic=-2260.5

> m2=garchFit(~arma(3,0)+garch(1,1),data=sp5,trace=F)

> summary(m2)

Title:

GARCH Modelling

Call:

garchFit(formula = ~arma(3,0)+garch(1, 1), data = sp5, trace = F)

Mean and Variance Equation:

data ~ arma(3, 0) + garch(1, 1)

[data = sp5]

Conditional Distribution: norm

Error Analysis:

Estimate Std. Error t value Pr(>|t|)

mu 7.708e-03 1.607e-03 4.798 1.61e-06 ***

ar1 3.197e-02 3.837e-02 0.833 0.40473

ar2 -3.026e-02 3.841e-02 -0.788 0.43076

ar3 -1.065e-02 3.756e-02 -0.284 0.77677

omega 7.975e-05 2.810e-05 2.838 0.00454 **

alpha1 1.242e-01 2.247e-02 5.529 3.22e-08 ***

beta1 8.530e-01 2.183e-02 39.075 < 2e-16 ***

---

Log Likelihood:

1272.179 normalized: 1.606287

Standardised Residuals Tests:

Statistic p-Value

Jarque-Bera Test R Chi^2 73.04842 1.110223e-16

Shapiro-Wilk Test R W 0.985797 5.961994e-07

Ljung-Box Test R Q(10) 11.56744 0.315048

16

Ljung-Box Test R Q(15) 17.78747 0.2740039

Ljung-Box Test R Q(20) 24.11916 0.2372256

Ljung-Box Test R^2 Q(10) 10.31614 0.4132089

Ljung-Box Test R^2 Q(15) 14.22819 0.5082978

Ljung-Box Test R^2 Q(20) 16.79404 0.6663038

LM Arch Test R TR^2 13.34305 0.3446075

Information Criterion Statistics:

AIC BIC SIC HQIC

-3.194897 -3.153581 -3.195051 -3.179018

> m2=garchFit(~garch(1,1),data=sp5,trace=F)

> summary(m2)

Title: GARCH Modelling

Call:

garchFit(formula = ~garch(1, 1), data = sp5, trace = F)

Mean and Variance Equation:

data ~ garch(1, 1)

[data = sp5]

Conditional Distribution: norm

Error Analysis:

Estimate Std. Error t value Pr(>|t|)

mu 7.450e-03 1.538e-03 4.845 1.27e-06 ***

omega 8.061e-05 2.833e-05 2.845 0.00444 **

alpha1 1.220e-01 2.202e-02 5.540 3.02e-08 ***

beta1 8.544e-01 2.175e-02 39.276 < 2e-16 ***

---

Log Likelihood:

1269.455 normalized: 1.602848

Standardised Residuals Tests:

Statistic p-Value

Jarque-Bera Test R Chi^2 80.32111 0

Shapiro-Wilk Test R W 0.9850517 3.141228e-07

Ljung-Box Test R Q(10) 11.22050 0.340599

Ljung-Box Test R Q(15) 17.99703 0.262822

Ljung-Box Test R Q(20) 24.29896 0.2295768

Ljung-Box Test R^2 Q(10) 9.920157 0.4475259

Ljung-Box Test R^2 Q(15) 14.21124 0.509572

Ljung-Box Test R^2 Q(20) 16.75081 0.6690903

LM Arch Test R TR^2 13.04872 0.3655092

Information Criterion Statistics:

17

AIC BIC SIC HQIC

-3.195594 -3.171985 -3.195645 -3.186520

> plot(m2)

Make a plot selection (or 0 to exit):

1: Time Series

2: Conditional SD

3: Series with 2 Conditional SD Superimposed

4: ACF of Observations

5: ACF of Squared Observations

6: Cross Correlation

7: Residuals

8: Conditional SDs

9: Standardized Residuals

10: ACF of Standardized Residuals

11: ACF of Squared Standardized Residuals

12: Cross Correlation between r^2 and r

13: QQ-Plot of Standardized Residuals

Selection: 3

> predict(m2,6)

meanForecast meanError standardDeviation

1 0.007449721 0.05377242 0.05377242

2 0.007449721 0.05388567 0.05388567

3 0.007449721 0.05399601 0.05399601

4 0.007449721 0.05410353 0.05410353

5 0.007449721 0.05420829 0.05420829

6 0.007449721 0.05431038 0.05431038

Turn to Student-t innovation. (R output omitted.)

Estimation of degrees of freedom:

rt = 0.0085 + at, at = σt�t, �t ∼ t7 σ2t = .000125 + .113a

2 t−1 + .842σ

2 t−1,

where the estimated degrees of freedom is 7.00.

Forecasting evaluation

Not easy to do; see Andersen and Bollerslev (1998).

IGARCH model

18

0 200 400 600 800

�0 .2

0. 0

0. 2

0. 4

Series with 2 Conditional SD Superimposed

Index

x

Figure 4: Monthly S&P 500 excess returns and fitted volatility

An IGARCH(1,1) model:

at = σt�t, σ 2 t = α0 + β1σ

2 t−1 + (1− β1)a2t−1.

For the monthly excess returns of the S&P 500 index, we have

rt = .007 + at, σ 2 t = .0001 + .806σ

2 t−1 + .194a

2 t−1

For an IGARCH(1,1) model,

σ2h( ) = σ 2 h(1) + ( − 1)α0, ≥ 1,

where h is the forecast origin.

Effect of σ2h(1) on future volatilities is persistent, and the volatility

forecasts form a straight line with slope α0. See Nelson (1990) for

more info.

Special case: α0 = 0.

used in RiskMetrics to VaR calculation.

19

Example: An IGARCH(1,1) model for the monthly excess returns

of S&P500 index from 1926 to 1991 is given below via R.

rt = 0.0074 + at, at = σt�t

σ2t = 5.11× 10−5 + .143a2t−1 + .857σ2t−1. R demonstration: Using R script Igarch.R.

> source("Igarch.R")

> m4=Igarch(sp5)

Maximized log-likehood: -1268.205

Coefficient(s):

Estimate Std. Error t value Pr(>|t|)

mu 7.41587e-03 1.52545e-03 4.86144 1.1653e-06 ***

omega 5.10855e-05 1.74923e-05 2.92046 0.0034952 **

beta 8.57124e-01 2.14420e-02 39.97404 < 2.22e-16 ***

---

20