pinterest
Icon1 Icon2 Icon3 Icon4

DATA SCIENCE

using PYTHON

LIVE ONLINE TRAINING

Generalized Autoregressive Conditional Heteroskedasticity (GARCH) Model

GARCH is a method for calculating market volatility. Financial organizations utilize the model to determine the return volatility of stocks, bonds, and other investment vehicles. When forecasting the values and rates of financial instruments, the GARCH process gives a more realistic backdrop than other models.

GARCH model is the extension of ARCH model as follow:

  • Var(ût) = σ2t = β0 + β1 û2t - 1 + β2 σ2t - 1 + …… + βp û2t – p + βq σ2t – q

Here, σ2t is a function of lagged squared error term û2 as well as lagged σ2t

It is denoted by GARCH(p,q) where p is lagged error term and q is lagged variance. Lagged terms are added based on AIC, BIC, test of significance and so on.

GARCH(1,1) model is similar to ARCH(2) model and GARCH(p,q) model is similar to ARCH(p+q) model.

I implemented the GARCH Model to model the US/UK Foreign Exchange Rate data and GARCH(1,1) is not significant. GARCH(1,0) is significant which is equivalent to ARCH(1) model.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import math

# Load the input files

us_uk_fx_rates = pd.read_excel("./Data/US_UK_Foreign_ Exchange_Rate.xls", sheet_name = "Data"
us_uk_fx_rates.head()

Date us_uk_fx_rates
0 1973-01-01 2.36
1 1973-02-01 2.43
2 1973-03-01 2.47
3 1973-04-01 2.48
4 1973-05-01 2.53

In the dynamic world of financial markets and economic indicators, one feature remains consistent: volatility is never constant. Financial time series often exhibit periods of intense market movement, followed by calmer phases. This phenomenon, known as volatility clustering, cannot be effectively captured by simple models that assume constant variance.

The Generalized Autoregressive Conditional Heteroskedasticity (GARCH) model was introduced — a cornerstone in financial econometrics and time series forecasting.

The GARCH model, developed by Tim Bollerslev in 1986, is an extension of the ARCH (Autoregressive Conditional Heteroskedasticity) model introduced by Robert Engle in 1982. These models are designed to analyze and forecast time series data where the variance changes over time, especially in response to past events.

In simple terms, GARCH allows you to model the volatility of a variable (like stock returns) over time, accounting for the fact that today’s volatility may depend on both yesterday’s volatility and the size of previous shocks.

GARCH is a statistical model that can be used to analyse a number of different types of financial data, for instance, macroeconomic data. Financial institutions typically use this model to estimate the volatility of returns for stocks, bonds and market indices.

GARCH models describe financial markets in which volatility can change, becoming more volatile during periods of financial crises or world events and less volatile during periods of relative calm and steady economic growth.

From arch as arch_model
data = us_uk_fx_rates.us_uk_fx_rates.values
model = arch_model(data, p = 1, q = 1, vol = "GARCH").fit()
model

Iteration: 1, Func. Count: 6, Neg. LLF: -6.68398068169715
Iteration: 2, Func. Count: 18, Neg. LLF: -21.908071990621252
Iteration: 3, Func. Count: 25, Neg. LLF: -32.03648450109571
Iteration: 4, Func. Count: 31, Neg. LLF: -55.846232439431915
Iteration: 5, Func. Count: 39, Neg. LLF: -62.00629943841792
Iteration: 6, Func. Count: 46, Neg. LLF: -64.02116623027486
Iteration: 7, Func. Count: 53, Neg. LLF: -67.5126947148861
Iteration: 8, Func. Count: 61, Neg. LLF: -69.10071398565478
Iteration: 9, Func. Count: 69, Neg. LLF: -69.12731316725817
Iteration: 10, Func. Count: 76, Neg. LLF: -69.98328665858482
Iteration: 11, Func. Count: 83, Neg. LLF: -71.30162039572285
Iteration: 12, Func. Count: 90, Neg. LLF: -72.45196839195539
Iteration: 13, Func. Count: 97, Neg. LLF: -73.46254701038598
Iteration: 14, Func. Count: 104, Neg. LLF: -74.33737542409045
Iteration: 15, Func. Count: 111, Neg. LLF: -75.08567977090624
Iteration: 16, Func. Count: 118, Neg. LLF: -75.71207224502814
Iteration: 17, Func. Count: 125, Neg. LLF: -76.21406935361084
Iteration: 18, Func. Count: 131, Neg. LLF: -76.76586108762588
Iteration: 19, Func. Count: 137, Neg. LLF: -77.61472944930325
Iteration: 20, Func. Count: 143, Neg. LLF: -77.79000895295702
Iteration: 21, Func. Count: 149, Neg. LLF: -77.8962305248309
Iteration: 22, Func. Count: 155, Neg. LLF: -77.94285955703306
Iteration: 23, Func. Count: 161, Neg. LLF: -77.9467880882125
Iteration: 24, Func. Count: 167, Neg. LLF: -77.94696805041445
Iteration: 25, Func. Count: 173, Neg. LLF: -77.946971257477

Optimization terminated successfully. (Exit mode 0)

Current function value: -77.94697145181159

Iterations: 26

Function evaluations: 173

Gradient evaluations: 25

Constant Mean - GARCH Model Results
Dep. Variable:yR-squared:-0.420
Mean Model:Constant MeanAdj. R-squared:-0.420
Vol Model:GARCHLog-Likelihood:77.9470
Distribution:NormalAIC:-147.894
Method:Maximum LikelihoodBIC:-133.270
No. Observations:286
Date:Thu, Jan 28 2021Df Residuals:282
Time:18:14:20Df Model:4
Mean Model
coef std err t P > |t| 95.0% Conf. Int.
mu 1.5769 1.214e-02 129.939 0.000 [1.553, 1.601]
Volatility Model
coef std err t P > |t| 95.0% Conf. Int.
omega 6.9937e-04 4.713e-04 1.484 0.138 [-2.244e-04, 1.623e-03]
alpha[1] 1.0000 0.228 4.381 1.179e-05 [0.553, 1.447]
beta[1] 0.0000 0.244 0.000 1.000 [-0.479, 0.479]

Covariance estimator: robust

ARCHModelResult, id: 0x1dc40593948