1. GARCH model


  • GARCH(1,1) model \[\begin{align*} Y_t &= \sigma_t e_t \hspace{10mm} e_t \sim_{iid} N(0,1) \\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align*}\]


Conditional Mean and Var of GARCH

  • Conditional Mean: \(0\)

  • Conditional Variance : \(\sigma_t^2\)


Mean and Var of GARCH

  • (unconditional) Mean: \(0\)

  • (unconditional) Variance : \(\sigma_t^2\)



__Ex: Daily SPY

Daily Price of SP500 ETF (SPY) downloaded from Yahoo!

## [1] "SPY"
## [1] FALSE
## [1] TRUE

Fit GARCH(1,1)

## 
## Title:
##  GARCH Modelling 
## 
## Call:
##  garchFit(formula = ~garch(1, 1), data = Y, cond.dist = "norm", 
##     include.mean = FALSE, trace = FALSE) 
## 
## Mean and Variance Equation:
##  data ~ garch(1, 1)
## <environment: 0x7f82dc61aa70>
##  [data = Y]
## 
## Conditional Distribution:
##  norm 
## 
## Coefficient(s):
##      omega      alpha1       beta1  
## 3.7887e-06  1.7598e-01  7.8776e-01  
## 
## Std. Errors:
##  based on Hessian 
## 
## Error Analysis:
##         Estimate  Std. Error  t value Pr(>|t|)    
## omega  3.789e-06   5.539e-07    6.840 7.91e-12 ***
## alpha1 1.760e-01   1.766e-02    9.966  < 2e-16 ***
## beta1  7.878e-01   1.814e-02   43.420  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Log Likelihood:
##  8736.457    normalized:  3.380982 
## 
## Description:
##  Mon Apr 13 18:20:03 2020 by user:
##       AIC       BIC       SIC      HQIC 
## -6.759641 -6.752841 -6.759644 -6.757177

##   B-L test H0: the series is uncorrelated
##   M-L test H0: the square of the series is uncorrelated
##   J-B test H0: the series came from Normal distribution
##   SD         : Standard Deviation of the series
##      BL15  BL20  BL25  ML15 ML20 JB    SD
## [1,]  0.4 0.271 0.063 0.463 0.74  0 0.998





2. Parameter Estimation



Quasi-MLE

  • Quasi-Maximum Likelihood Estimator, means we will use MLE for normal errors, even in the case of non-normality. Theoretically, for GARCH parameters, it is shown that Normal MLE is still consistent under non-normal errors.


  • GARCH(1,1)

    \[\begin{align*} Y_t &= \sigma_t e_t \hspace{10mm} e_t \sim_{iid} N(0,1)\\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align*}\]

Even thorugh we can use quasi-MLE based on Normal distribution, using correct conditional distribution is importatnt when estimating parameters of GARCH.



Importatnce of Conditional Distribution


\[\begin{align*} Y_t &= \sigma_t e_t \hspace{10mm} e_t \sim_{iid} N(0,1)\\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align*}\]

  • [Conditonal distribution] \(=\) [Distribution of \(e_t\)]

  • Guessing correct distribution for \(e_t\) is very important in GARCH parameter estimation.



__Ex: Simulation Study

True parameter (.024, .1, .8)

  • True conditional distribution: Normal Estimated using: Normal

  • True conditional distribution: std(5) Estimated using: Normal

  • True conditional distribution: sged(skew=.7, shape=1.45) Estimated using: Normal

## Warning in sqrt(diag(fit$cvar)): NaNs produced

##              [,1]         [,2]        [,3]
## [1,] 0.0001829513 0.0008560599 0.005964670
## [2,] 0.0003238745 0.0021516543 0.011084095
## [3,] 0.0002726883 0.0011342782 0.008536437
##          [,1]     [,2]     [,3]
## [1,] 1.000000 1.000000 1.000000
## [2,] 1.770277 2.513439 1.858291
## [3,] 1.490497 1.324999 1.431167

Stationarity Cond’n for GARCH

  • GARCH(1,1) is weakly stationary if \[ E( \log(\beta + \alpha e_t^2)) < 0 \]

  • This is satisfied if \[ \alpha + \beta < 1. \]





3. Predicting \(\sigma_t\)


Residuals of GARCH


  • GARCH(1,1) \[\begin{align*} Y_t &= \sigma_t e_t \hspace{10mm} e_t \sim_{iid} N(0,1)\\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align*}\]

  • Using observation \(\{Y_1, \ldots, Y_n\}\), the residuals are \[ \hat e_t = Y_t/ \hat \sigma_t \]

  • how can we get \(\hat \sigma_t\)?



Write \(\sigma^2_t\) using \(Y_t^2\)


  • Starting with the definition of GARCH(1,1),

    \[\begin{align*} \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \\\\ &= \omega + \alpha Y_{t-1}^2 + \beta \Big(\omega + \alpha Y_{t-2}^2 + \beta \sigma^2_{t-2} \Big)\\ \\ &= \omega + \beta \omega + \alpha Y_{t-1}^2 + \beta \alpha Y_{t-2}^2 + \beta^2 \sigma^2_{t-2} \\ \\ &= \omega + \beta \omega + \alpha Y_{t-1}^2 + \beta \alpha Y_{t-2}^2 + \beta^2 \Big(\omega + \alpha Y_{t-3}^2 + \beta \sigma^2_{t-3} \Big) \\ \\ &= \omega + \beta \omega + \beta^2 \omega + \alpha Y_{t-1}^2 + \beta \alpha Y_{t-2}^2 + \beta^2 \alpha Y_{t-3}^2 + \beta^3 \sigma^2_{t-3} \end{align*}\]

  • Continuing, we get

    \[\begin{align*} &= \omega (1 + \beta + \beta^2 + \cdots ) + \alpha \sum_{i=0}^k \beta^i Y_{t-1-i}^2 + \beta^{k+1} \sigma^2_{t-1-k} \\\\ &= \frac{\omega}{1-\beta} + \alpha \sum_{i=0}^\infty \beta^i Y_{t-1-i}^2 \end{align*}\]

  • That means if we keep going, we can write \[ \sigma_t^2 \hspace{3mm} = \hspace{3mm} \frac{\omega}{1-\beta} + \alpha \sum_{i=0}^\infty \beta^i Y_{t-1-i}^2 \]

  • We will use the truncated and estimated version of this, \[ \hat \sigma_t^2 \hspace{3mm} = \hspace{3mm} \frac{\hat \omega}{1- \hat \beta} \hspace{3mm} + \hspace{3mm} \hat \alpha \sum_{i=0}^{t-1} \hat \beta^i Y_{t-1-i}^2 \]



Now We Can Calculate Residuals


  • GARCH(1,1) says, \[ Y_t \hspace{3mm} = \hspace{3mm} \sigma_t e_t \]

  • Using observation \(\{Y_1, \ldots, Y_n\}\), the residuals are \[ \hat e_t = Y_t/ \hat \sigma_t \]



Forecast \(\sigma_{t+1}\)

  • GARCH(1,1) \[\begin{align*} Y_t &= \sigma_t e_t \hspace{10mm} e_t \sim_{iid} N(0,1)\\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align*}\]

  • Now have 1-step forecast of tomorrow’s volatility \(\sigma_{t+1}\), \[\begin{align*} \sigma_{t}^2(1) &= \hat \omega + \hat \alpha Y_{t}^2 + \hat \beta \hat \sigma^2_{t} \end{align*}\]

  • How well can GARCH predict \(\sigma_t\) of the future?



__Ex: Simulated Data


  • See how closely true sigma is estimated and predicted, using simulated GARCH
## Warning in if (extended) ans else ans[, "garch"]: the condition has length > 1
## and only the first element will be used



Rolling 1-step prediction of \(\sigma_t\)






4. Fit GARCH to SPY



  • See how close estimated sigma and rolling predicted sigma, using real data.

    library(quantmod) source(‘https://nmimoto.github.io/R/TS-00.txt’)

    getSymbols(“SPY”) #- SP500 download from Yahoo! SPY <- Ad(SPY)[‘2010::’]

    is.ts(SPY) # not ts object is.xts(SPY) # its xts object

    plot( log(SPY) ) plot( diff( log(SPY) ) )

```



Fit GARCH and forecast

## 
## Title:
##  GARCH Modelling 
## 
## Call:
##  garchFit(formula = ~garch(1, 1), data = Y, cond.dist = "norm", 
##     include.mean = FALSE, trace = FALSE) 
## 
## Mean and Variance Equation:
##  data ~ garch(1, 1)
## <environment: 0x7f82e3fb4238>
##  [data = Y]
## 
## Conditional Distribution:
##  norm 
## 
## Coefficient(s):
##      omega      alpha1       beta1  
## 3.7887e-06  1.7598e-01  7.8776e-01  
## 
## Std. Errors:
##  based on Hessian 
## 
## Error Analysis:
##         Estimate  Std. Error  t value Pr(>|t|)    
## omega  3.789e-06   5.539e-07    6.840 7.91e-12 ***
## alpha1 1.760e-01   1.766e-02    9.966  < 2e-16 ***
## beta1  7.878e-01   1.814e-02   43.420  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Log Likelihood:
##  8736.457    normalized:  3.380982 
## 
## Description:
##  Mon Apr 13 18:22:52 2020 by user:
##       AIC       BIC       SIC      HQIC 
## -6.759641 -6.752841 -6.759644 -6.757177



10-step predicion of Sigma

##    meanForecast meanError standardDeviation
## 1             0  1.937290          1.937290
## 2             0  1.934433          1.934433
## 3             0  1.932181          1.932181
## 4             0  1.930406          1.930406
## 5             0  1.929008          1.929008
## 6             0  1.927907          1.927907
## 7             0  1.927040          1.927040
## 8             0  1.926358          1.926358
## 9             0  1.925820          1.925820
## 10            0  1.925397          1.925397



Rolling 1-step prediction of \(\sigma_t\)

## [1] 2584
## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced

## Warning in sqrt(diag(fit$cvar)): NaNs produced



More Examples

  • Cryer : CREF stock values

  • Shumway : NYSE us GNP

  • Cowpertwait : SP500, Southern hem Temp.






TS Class Web PageR resource page