GARCH Models

Author

Dr. Cohen

This lecture will cover:

Financial time series data are special because of their features, which include tail heaviness, asymmetry, volatility, and serial dependence without correlation.

Let consider \(P_t\) the price of a stock of other financial asset at time \(t\), then we can define the log return by \(Z_t = log(P_t) − log(P_{t−1})\) A model of the return series should support the fact that this data has a conditional variance \(h_t\) of \(Z_t\) is not independent of past value of \(Z_t\).

The idea of the ARCH model is to incorporate the sequence \(h_t\) in the model by:

\[ Z_t =\sqrt{h_t e_t}, \qquad e_t \sim IIDN(0, 1) \]

where \(h_t\) is known as the volatility and related to the past values of $Z_t$ via the ARCH(p) model:

\[ h_t = \alpha_0 + \sum_{i=1}^{p} \alpha_i Z^2_{t-i} \]

The GARCH(p,q) model is given by:

\[ h_t = \alpha_0 + \sum_{i=1}^{p} \alpha_i Z^2_{t-i} + \sum_{j=1}^{q} \beta_j h_{t-j} \]

\(\alpha_0 > 0 \text{ and } \alpha_i ≥ 0, \beta_j ≥ 0\)

Google Share Price

library(rugarch) # run GARCH models
library(quantmod) # upload financial data from Yahoo Finance
library(itsmr)
library(aTSA)

getSymbols("GOOG", from = as.Date("2010-01-01"), to = as.Date("2023-3-30"))
[1] "GOOG"
# Select Open Price
op=GOOG$GOOG.Open
# plot Time Series
plot(op)

# Return data 
R= diff(log(as.numeric(op)))

# Plot Return
plot(R)

# Plot ACF 
acf(R,lag.max = 50)

# Plot ACF of R^2
acf(R^2, lag.max = 50)

GARCH model

# Specify the model
spec1 = ugarchspec()
spec1

*---------------------------------*
*       GARCH Model Spec          *
*---------------------------------*

Conditional Variance Dynamics   
------------------------------------
GARCH Model     : sGARCH(1,1)
Variance Targeting  : FALSE 

Conditional Mean Dynamics
------------------------------------
Mean Model      : ARFIMA(1,0,1)
Include Mean        : TRUE 
GARCH-in-Mean       : FALSE 

Conditional Distribution
------------------------------------
Distribution    :  norm 
Includes Skew   :  FALSE 
Includes Shape  :  FALSE 
Includes Lambda :  FALSE 
# Mean Model  AR(1)
spec1 = ugarchspec(mean.model = list(armaOrder=c(1,0)))
spec1

*---------------------------------*
*       GARCH Model Spec          *
*---------------------------------*

Conditional Variance Dynamics   
------------------------------------
GARCH Model     : sGARCH(1,1)
Variance Targeting  : FALSE 

Conditional Mean Dynamics
------------------------------------
Mean Model      : ARFIMA(1,0,0)
Include Mean        : TRUE 
GARCH-in-Mean       : FALSE 

Conditional Distribution
------------------------------------
Distribution    :  norm 
Includes Skew   :  FALSE 
Includes Shape  :  FALSE 
Includes Lambda :  FALSE 
# Mean Model- EWMA
spec2 = ugarchspec(mean.model = list(armaOrder=c(0,0)),variance.model = list(garchOrder =c(2,0)))
spec2

*---------------------------------*
*       GARCH Model Spec          *
*---------------------------------*

Conditional Variance Dynamics   
------------------------------------
GARCH Model     : sGARCH(2,0)
Variance Targeting  : FALSE 

Conditional Mean Dynamics
------------------------------------
Mean Model      : ARFIMA(0,0,0)
Include Mean        : TRUE 
GARCH-in-Mean       : FALSE 

Conditional Distribution
------------------------------------
Distribution    :  norm 
Includes Skew   :  FALSE 
Includes Shape  :  FALSE 
Includes Lambda :  FALSE 
# Fit GARCH
ugfit = ugarchfit(spec = spec2, data = R)
ugfit

*---------------------------------*
*          GARCH Model Fit        *
*---------------------------------*

Conditional Variance Dynamics   
-----------------------------------
GARCH Model : sGARCH(2,0)
Mean Model  : ARFIMA(0,0,0)
Distribution    : norm 

Optimal Parameters
------------------------------------
        Estimate  Std. Error  t value Pr(>|t|)
mu      0.000618    0.000249   2.4819 0.013068
omega   0.000159    0.000008  21.0675 0.000000
alpha1  0.242481    0.031290   7.7495 0.000000
alpha2  0.301324    0.037833   7.9645 0.000000

Robust Standard Errors:
        Estimate  Std. Error  t value Pr(>|t|)
mu      0.000618    0.000293   2.1104 0.034820
omega   0.000159    0.000016  10.1275 0.000000
alpha1  0.242481    0.051411   4.7165 0.000002
alpha2  0.301324    0.082867   3.6363 0.000277

LogLikelihood : 9034.563 

Information Criteria
------------------------------------
                    
Akaike       -5.4221
Bayes        -5.4148
Shibata      -5.4221
Hannan-Quinn -5.4195

Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
                        statistic p-value
Lag[1]                     0.7328  0.3920
Lag[2*(p+q)+(p+q)-1][2]    0.8391  0.5535
Lag[4*(p+q)+(p+q)-1][5]    2.3090  0.5474
d.o.f=0
H0 : No serial correlation

Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
                        statistic p-value
Lag[1]                     0.7798  0.3772
Lag[2*(p+q)+(p+q)-1][5]    4.7131  0.1776
Lag[4*(p+q)+(p+q)-1][9]    7.2305  0.1806
d.o.f=2

Weighted ARCH LM Tests
------------------------------------
            Statistic Shape Scale P-Value
ARCH Lag[3]    0.1857 0.500 2.000  0.6665
ARCH Lag[5]    0.8537 1.440 1.667  0.7768
ARCH Lag[7]    2.4760 2.315 1.543  0.6174

Nyblom stability test
------------------------------------
Joint Statistic:  1.3026
Individual Statistics:             
mu     0.2283
omega  0.7062
alpha1 0.5477
alpha2 0.1634

Asymptotic Critical Values (10% 5% 1%)
Joint Statistic:         1.07 1.24 1.6
Individual Statistic:    0.35 0.47 0.75

Sign Bias Test
------------------------------------
                   t-value   prob sig
Sign Bias          0.56811 0.5700    
Negative Sign Bias 0.02728 0.9782    
Positive Sign Bias 0.89695 0.3698    
Joint Effect       2.72729 0.4356    


Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
  group statistic p-value(g-1)
1    20     164.0    4.305e-25
2    30     192.0    5.784e-26
3    40     197.8    4.106e-23
4    50     219.3    2.128e-23


Elapsed time : 0.2528391 
# Forecast with GARCH
ugf = ugarchforecast(ugfit, n.ahead = 10)
ugf

*------------------------------------*
*       GARCH Model Forecast         *
*------------------------------------*
Model: sGARCH
Horizon: 10
Roll Steps: 0
Out of Sample: 0

0-roll forecast [T0=1979-02-13 18:00:00]:
        Series   Sigma
T+1  0.0006181 0.01788
T+2  0.0006181 0.01548
T+3  0.0006181 0.01770
T+4  0.0006181 0.01753
T+5  0.0006181 0.01811
T+6  0.0006181 0.01819
T+7  0.0006181 0.01838
T+8  0.0006181 0.01845
T+9  0.0006181 0.01853
T+10 0.0006181 0.01857
plot(ugf@forecast$sigmaFor,type="l")

plot(ugf@forecast$seriesFor,type="l")

NSYE data

library(astsa)

plot(nyse,type="o")

plota(nyse)

plota(nyse^2)

spec2 = ugarchspec(mean.model = list(armaOrder=c(1,0)),

                   variance.model = list(garchOrder =c(1,1)))

spec2

*---------------------------------*
*       GARCH Model Spec          *
*---------------------------------*

Conditional Variance Dynamics   
------------------------------------
GARCH Model     : sGARCH(1,1)
Variance Targeting  : FALSE 

Conditional Mean Dynamics
------------------------------------
Mean Model      : ARFIMA(1,0,0)
Include Mean        : TRUE 
GARCH-in-Mean       : FALSE 

Conditional Distribution
------------------------------------
Distribution    :  norm 
Includes Skew   :  FALSE 
Includes Shape  :  FALSE 
Includes Lambda :  FALSE 
# Fit GARCH

ugfit = ugarchfit(spec = spec2, data = nyse)

ugfit

*---------------------------------*
*          GARCH Model Fit        *
*---------------------------------*

Conditional Variance Dynamics   
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model  : ARFIMA(1,0,0)
Distribution    : norm 

Optimal Parameters
------------------------------------
        Estimate  Std. Error  t value Pr(>|t|)
mu      0.000734    0.000197   3.7272 0.000194
ar1     0.107539    0.025129   4.2795 0.000019
omega   0.000006    0.000000  22.5392 0.000000
alpha1  0.108783    0.007194  15.1220 0.000000
beta1   0.815154    0.010097  80.7321 0.000000

Robust Standard Errors:
        Estimate  Std. Error  t value Pr(>|t|)
mu      0.000734    0.000200   3.6781 0.000235
ar1     0.107539    0.022202   4.8436 0.000001
omega   0.000006    0.000001   6.2411 0.000000
alpha1  0.108783    0.014164   7.6803 0.000000
beta1   0.815154    0.027102  30.0767 0.000000

LogLikelihood : 6732.066 

Information Criteria
------------------------------------
                    
Akaike       -6.7271
Bayes        -6.7131
Shibata      -6.7271
Hannan-Quinn -6.7219

Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
                        statistic p-value
Lag[1]                      1.536  0.2152
Lag[2*(p+q)+(p+q)-1][2]     1.560  0.4047
Lag[4*(p+q)+(p+q)-1][5]     2.102  0.6816
d.o.f=1
H0 : No serial correlation

Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
                        statistic p-value
Lag[1]                      1.264  0.2609
Lag[2*(p+q)+(p+q)-1][5]     1.327  0.7823
Lag[4*(p+q)+(p+q)-1][9]     1.760  0.9316
d.o.f=2

Weighted ARCH LM Tests
------------------------------------
            Statistic Shape Scale P-Value
ARCH Lag[3]   0.06405 0.500 2.000  0.8002
ARCH Lag[5]   0.10165 1.440 1.667  0.9865
ARCH Lag[7]   0.46563 2.315 1.543  0.9814

Nyblom stability test
------------------------------------
Joint Statistic:  15.6521
Individual Statistics:              
mu     0.07411
ar1    0.18618
omega  2.10064
alpha1 0.18819
beta1  0.21744

Asymptotic Critical Values (10% 5% 1%)
Joint Statistic:         1.28 1.47 1.88
Individual Statistic:    0.35 0.47 0.75

Sign Bias Test
------------------------------------
                   t-value     prob sig
Sign Bias           0.1864 0.852153    
Negative Sign Bias  2.8413 0.004539 ***
Positive Sign Bias  0.9201 0.357652    
Joint Effect       12.4901 0.005880 ***


Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
  group statistic p-value(g-1)
1    20     94.48    5.282e-12
2    30     96.52    3.499e-09
3    40    127.48    2.524e-11
4    50    115.75    2.522e-07


Elapsed time : 0.2217271 
# Forecast with GARCH

ugf = ugarchforecast(ugfit, n.ahead = 10)

ugf

*------------------------------------*
*       GARCH Model Forecast         *
*------------------------------------*
Model: sGARCH
Horizon: 10
Roll Steps: 0
Out of Sample: 0

0-roll forecast [T0=2000-01-01]:
        Series    Sigma
T+1  0.0012251 0.009906
T+2  0.0007872 0.009839
T+3  0.0007401 0.009777
T+4  0.0007350 0.009719
T+5  0.0007345 0.009665
T+6  0.0007344 0.009616
T+7  0.0007344 0.009569
T+8  0.0007344 0.009527
T+9  0.0007344 0.009487
T+10 0.0007344 0.009450
plot(ugf@forecast$sigmaFor,type="l")

plot(ugf@forecast$seriesFor,type="l")