Various Autoregressive Conditional Heteroskedasticity Models (ARCH) using R

Vijaya Gagrani (rexplore0@gmail.com)

September 2015

Background and Objective

The goal of this repository is to discuss various Autoregressive Conditional Heteroskedasticity Models (ARCH) in field of financial risk which includes ARCH, GARCH, EGRCH, TGARCH models. The ARCH models are based on one of the key assumption of the ordinary least squares models that the expected value of all squared error terms or variance is same throughout the sample (homoskendasticity). The opposite concept is heterskendasticity, where variance of the error term is not constant for all points, and thats what the center of the Autoregressive Conditional Heteroskedasticity models (ARCH).

Volatility is important in quantifying financial risk, portfolio selection, derivative pricing, and option pricing model. However, in financial time series, volatility occurs in clusters like periods of high volatility follows with high volatility and vice versa. In addition, more recent events would be more relevant then the distant past events. The ARCH models utilize the heteroskedasticity in time series data to measure volatility (standard deviation). These models are applied to forecast mean, SD, and variance of return based on the past information. In addition, these models allow to use the best weights in forecasting variance instead of using equal weights for all past events.

An ARCH model is similar to the AR(1) model on squared residuals. In an ARCH(1) model, next period’s variance only depends on last period’s squared residual (short memory). The ARCH model is extended as the Generalized ARCH or GARCH model by making variance conditional to the squared residuals of the last and all past period’s (long memory). The typical GARCH model is described as GARCH(1,1) model. The first subscript in GARCH reefers to autoregressive lags or ARCH and second subscript refers to the moving average lags, respectively. These models are basically setup for one period forecast, however a long-horizon forecasting can be constructed. The ARCH/GARCH approaches are widely used in situations where volatility of return is a central concern.

It is also well established that the volatility is more influenced by negative returns then the positive(leverage effect). The nonlinear GARCH, exponential GARCH, and threshold GARCH models accounts the leverage effect. It also is important to note the standard GARCH assumption that the model residuals are normally distributed, however returns on assets are often skewed or leptokurtosisic.

The clustered volatility phenomenon in financial data is visually detectable in simple line plots. In addition, we can identify it by applying two commonly used tests, first is the Ljung-Box test for autocorrelation in squared returns and second is the Lagrange Multiplier (LM test). In rugarch library there are different functions for model specification, parameter estimation, backtesting, and forecasting.

Model Simulation Equations:

X(t) = sigma(t).e(t), ARCH(1): sigma(t)^2 = w + a1.X(t ??? 1)^2 + · · · + apX(t ??? p)^2 GARCH(1,1): sigma(t)^2 = w + aX(t ??? 1)^2 + b.sigma(t ??? 1)^2 EGARCH(1,1) :log.sigma(t)^2= w + L.abs(e(t-1)/sigma(t-1)) + L.abs(e(t-1)/sigma(t-1)) + blog.sigma(t-1)^2 Where; X(t) =time series; w=omega; a=alpha; b=beta; L=Lembda;e:noise

Download Data

[1] "VBLTX" "WFC"   "AAPL"  "GSPC" 

                    VBLTX       WFC      AAPL      GSPS
Observations    5413.0000 5413.0000 5413.0000 5413.0000
NAs                0.0000    0.0000    0.0000    0.0000
Minimum           -0.0434   -0.2721   -0.7312   -0.0947
Quartile 1        -0.0033   -0.0087   -0.0134   -0.0049
Median             0.0000    0.0000    0.0004    0.0006
Arithmetic Mean    0.0003    0.0005    0.0008    0.0003
Geometric Mean     0.0003    0.0002    0.0003    0.0002
Quartile 3         0.0041    0.0094    0.0150    0.0059
Maximum            0.0330    0.2834    0.2869    0.1096
SE Mean            0.0001    0.0003    0.0004    0.0002
LCL Mean (0.95)    0.0001   -0.0001    0.0000    0.0000
UCL Mean (0.95)    0.0005    0.0011    0.0016    0.0006
Variance           0.0000    0.0006    0.0009    0.0001
Stdev              0.0062    0.0237    0.0302    0.0119
Skewness          -0.1445    0.7959   -2.4218   -0.2452
Kurtosis           1.6693   25.2543   68.7114    8.3399

Plot returns and autocorrelations with squared and absolute returns

Testing ARCH Effect or no autocorrelation

For a single asset, we are using wfc daily closing prices. First, the daily return is calculated using the daily price data. Daily returns are a sequence of independent and identically distributed random variable or i.i.d. sequence, means that return are unpredictable. Also, it means that returns at any given time are random values independent from previous returns. Returns are stationary (drown from an iid sequence), whereas daily prices are nonstationary. The Ljung-Box test and the Lagrange Multiplier indicated no autocorrelation exists in daily return or the data are of heteroscedastic. The LM test also helps to determine the order of the ARCH model appropriate for the data. for wfc assets, the LM test indicated to use the GARCH model instead of the ARCH model, because the current variance depends on more than one past lag variances.


    One Sample t-test

data:  VWAG_ret$WFC
t = 1.6, df = 5400, p-value = 0.1
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 -0.0001187  0.0011450
sample estimates:
mean of x 
0.0005131 

    Box-Ljung test

data:  coredata(WFC_ret^2)
X-squared = 3300, df = 12, p-value <2e-16

    ARCH LM-test; Null hypothesis: no ARCH effects

data:  coredata(WFC_ret)
Chi-squared = 1100, df = 12, p-value <2e-16

GARCH Model Specification (for fixed parameters)

Specify the model using the univariate GARCH specification or ugarchspec function from the rugarch library. Mean to be modeled as an ARMA (1, 1) or for the white noise (0,0).


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

Conditional Variance Dynamics   
------------------------------------
GARCH Model     : sGARCH(1,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 

GARCH Model Specification(with only constant in mean equation)


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

Conditional Variance Dynamics   
------------------------------------
GARCH Model     : sGARCH(1,1)
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 

Model Estimation


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

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

Optimal Parameters
------------------------------------
        Estimate  Std. Error  t value Pr(>|t|)
mu      0.000738    0.000165  4.47270 0.000008
omega   0.000001    0.000001  0.98262 0.325795
alpha1  0.075662    0.015284  4.95051 0.000001
beta1   0.923336    0.015057 61.32460 0.000000

Robust Standard Errors:
        Estimate  Std. Error  t value Pr(>|t|)
mu      0.000738    0.000264  2.79762 0.005148
omega   0.000001    0.000013  0.10722 0.914615
alpha1  0.075662    0.148407  0.50983 0.610172
beta1   0.923336    0.144638  6.38376 0.000000

LogLikelihood : 14767 

Information Criteria
------------------------------------
                    
Akaike       -5.4545
Bayes        -5.4496
Shibata      -5.4545
Hannan-Quinn -5.4528

Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
                        statistic   p-value
Lag[1]                      14.28 1.578e-04
Lag[2*(p+q)+(p+q)-1][2]     14.59 1.174e-04
Lag[4*(p+q)+(p+q)-1][5]     18.82 4.076e-05
d.o.f=0
H0 : No serial correlation

Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
                        statistic p-value
Lag[1]                      3.422 0.06435
Lag[2*(p+q)+(p+q)-1][5]     7.339 0.04287
Lag[4*(p+q)+(p+q)-1][9]     8.178 0.11892
d.o.f=2

Weighted ARCH LM Tests
------------------------------------
            Statistic Shape Scale P-Value
ARCH Lag[3]   0.03997 0.500 2.000  0.8415
ARCH Lag[5]   0.13183 1.440 1.667  0.9806
ARCH Lag[7]   0.17455 2.315 1.543  0.9978

Nyblom stability test
------------------------------------
Joint Statistic:  84.76
Individual Statistics:               
mu      0.10911
omega  17.83796
alpha1  0.08951
beta1   0.09981

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.4033 0.6867756    
Negative Sign Bias  3.5881 0.0003360 ***
Positive Sign Bias  1.1868 0.2353482    
Joint Effect       18.4897 0.0003485 ***


Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
  group statistic p-value(g-1)
1    20     101.8    2.563e-13
2    30     141.5    9.369e-17
3    40     131.8    5.311e-12
4    50     151.1    2.464e-12


Elapsed time : 0.4518 
[1] "uGARCHfit"
attr(,"package")
[1] "rugarch"
[1] "fit"   "model"
 [1] "hessian"         "cvar"            "var"            
 [4] "sigma"           "condH"           "z"              
 [7] "LLH"             "log.likelihoods" "residuals"      
[10] "coef"            "robust.cvar"     "scores"         
[13] "se.coef"         "tval"            "matcoef"        
[16] "robust.se.coef"  "robust.tval"     "robust.matcoef" 
[19] "fitted.values"   "convergence"     "kappa"          
[22] "persistence"     "timer"           "ipars"          
[25] "solver"         
 [1] "modelinc"   "modeldesc"  "modeldata"  "pars"       "start.pars"
 [6] "fixed.pars" "maxOrder"   "pos.matrix" "fmodel"     "pidx"      
[11] "n.start"   
       mu     omega    alpha1     beta1 
7.376e-04 1.369e-06 7.566e-02 9.233e-01 
[1] 691.8

Simulate from fitted model

[1] "uGARCHsim"
attr(,"package")
[1] "rugarch"
[1] "simulation" "model"      "seed"      

Fit all arch models with p <= 5

              arch1 arch2  arch3  arch4  arch5
Akaike       0.7009 36.35 -5.264 -5.334 -5.358
Bayes        0.7046 36.35 -5.258 -5.327 -5.349
Shibata      0.7009 36.35 -5.264 -5.334 -5.358
Hannan-Quinn 0.7022 36.35 -5.262 -5.332 -5.355

Backtesting: to check the model perfromance

In this analysis, we compared the estimated VaR with the actual return over the period. The estimated VaR should not be more negative than the actual return (VaR excedence). We calculated tail probability of VaR at 99% confidence level. in this analysis, the actual 97 exceedances versus an expectation of 52, led to reject the null hypothesis that the exceedances are correct and independent. Kupiec’s unconditional coverage compares the number of expected versus actual exceedances given the tail probability of VaR, while the Christoffersen test is a joint test of the unconditional coverage and the independence of the exceedances.

VaR Backtest Report
===========================================
Model:              sGARCH-norm
Backtest Length:    1000
Data:               

==========================================
alpha:              1%
Expected Exceed:    10
Actual VaR Exceed:  15
Actual %:           1.5%

Unconditional Coverage (Kupiec)
Null-Hypothesis:    Correct Exceedances
LR.uc Statistic:    2.189
LR.uc Critical:     6.635
LR.uc p-value:      0.139
Reject Null:        NO

Conditional Coverage (Christoffersen)
Null-Hypothesis:    Correct Exceedances and
                    Independence of Failures
LR.cc Statistic:    3.704
LR.cc Critical:     9.21
LR.cc p-value:      0.157
Reject Null:        NO

Model Backtest Plot

Forecasting

Calculate 99% VaR assuming the standard normal distribution. The next period VaR at 99% is 0.008375 With 99% probability; the daily return is above -2%.

[1] "uGARCHforecast"
attr(,"package")
[1] "rugarch"
[1] "forecast" "model"   
[1] "n.ahead"   "N"         "n.start"   "n.roll"    "sigmaFor" 
[6] "seriesFor"

[1] "uGARCHboot"
attr(,"package")
[1] "rugarch"

Compute h-day variance forecast = sum of h-day ahead variance forecasts

       series   sigma
T+1 0.0007376 0.02300
T+2 0.0007376 0.02302
T+3 0.0007376 0.02304
T+4 0.0007376 0.02306
T+5 0.0007376 0.02308
T+6 0.0007376 0.02309

computing VaR Forecasts

[1] -0.0371
[1] -0.1557

please wait...calculating quantiles...

Useful Resources

Lander, J. P. (2014). R for everyone: Advanced analytics and graphics. Pearson Education.(Chapter 21. Time Series and Autocorrelation).

Berlinger, E., Illés, F., Badics, M., Banai, Á., Daróczi, G., Dömötör, B., … & Vidovics-Dancs, Á. (2015). Mastering R for Quantitative Finance. Packt Publishing Ltd.

Fabozzi, F. J., Focardi, S. M., Rachev, S. T., & Arshanapalli, B. G. (2014). The Basics of Financial Econometrics: Tools, Concepts, and Asset Management Applications. John Wiley & Sons.

Tsay, R. S. (2014). An introduction to analysis of financial data with R. John Wiley & Sons.

http://www.cmat.edu.uy/~mordecki/hk/engle.pdf

http://faculty.washington.edu/ezivot/econ589/econ589univariateGarch.r

http://faculty.washington.edu/ezivot/econ589/univariateGarch2012powerpoint.pdf

http://faculty.washington.edu/ezivot/econ589/ch18-garch.pdf

http://www.ssc.wisc.edu/~bhansen/econometrics/ (Economics 582: Econometrics III)

http://faculty.chicagobooth.edu/john.cochrane/research/papers/time_series_book.pdf(Economics 582: Econometrics III)

http://faculty.washington.edu/ezivot/econ584/notes/timeSeriesConcepts.pdf

http://www.r-bloggers.com/a-practical-introduction-to-garch-modeling/

https://onlinecourses.science.psu.edu/stat510/node/61

http://rpubs.com/VijayaG

http://rexplor.blogspot.com/

http://unstarched.net/r-examples/rugarch/a-short-introduction-to-the-rugarch-package/

http://faculty.washington.edu/ezivot/econ589/univariateGarch2012powerpoint.pdf

Modern Portfolio Theory and Investment Analysis, by E.J. Elton et al., Wiley, New York.