The ARCH (autoregressive conditional heteroscedasticity) model
The GARCH model (Generalized ARCH)
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:
library(rugarch) # run GARCH modelslibrary(quantmod) # upload financial data from Yahoo Financelibrary(itsmr)library(aTSA)getSymbols("GOOG", from =as.Date("2010-01-01"), to =as.Date("2023-3-30"))
[1] "GOOG"
# Select Open Priceop=GOOG$GOOG.Open# plot Time Seriesplot(op)
# Return data R=diff(log(as.numeric(op)))# Plot Returnplot(R)
# Plot ACF acf(R,lag.max =50)
# Plot ACF of R^2acf(R^2, lag.max =50)
GARCH model
# Specify the modelspec1 =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- EWMAspec2 =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 GARCHugfit =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 GARCHugf =ugarchforecast(ugfit, n.ahead =10)ugf
*---------------------------------*
* 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 GARCHugfit =ugarchfit(spec = spec2, data = nyse)ugfit