Modelling Volatility
Dr Aishwarya Krishna
Agenda
• What is volatility?
• Why is studying volatility important?
• Characteristics of Volatility
• Calculate returns and volatility
• ARCH effects checking
• Modelling
• Forecasting
Defining volatility
• Annualized standard deviation of the change in price or value of a financial security
• Computing volatility
• Prices of an asset are {T+1} points {𝑃𝑡 , 𝑡 = 0,1,2,3 … . 𝑇}
𝑃𝑡
• Returns of assets for T time periods 𝑅𝑡 = log
𝑃𝑡−1
• {𝑅𝑡 } assumed covariance stationary with 𝜎= 𝑣𝑎𝑟 𝑅𝑡 = 𝐸[ 𝑅𝑡 − 𝐸 𝑅𝑡 2]
1
• With sample estimate 𝜎ො = σ𝑇𝑡=1 𝑅𝑡 − 𝑅ത 2 ത 1 σ𝑇𝑡=1 𝑅𝑡
where 𝑅=
𝑇−1 T
252𝜎ො Daily prices for 252 days
• Annualized values = ൞ 52𝜎ො
𝑣𝑜𝑙 Weekly prices for 52 weeks
12𝜎ො Monthly prices
Characteristics of volatility
• Although it cannot be observed directly, it has some basic
characteristics
• There exist volatility clusters
• Volatility evolves continuously over time i.e volatility jumps are not frequent
• Volatility does not diverge to infinity. It always has bounds. i.e it is stationary
• Leverage effect: volatility seems to react differently to a big price increase or
drop
Candle stick plot
• Candle stick plot where orange represents closing
price was lower than opening price and green
indicates if closing price was higher than the opening
price
• Each candle represents a summary statistics of price
for a day. The red color means that we had a
negative return or a decrease of the price, while a
green color of the candle means that the price has
increase over the considered day.
getSymbols("^BSESN",
src="yahoo", from="2005-01-
01", to= "2021-12-31")
sensex<-BSESN
sensex<-[Link](sensex)
#candle stick plot
chartSeries(sensex["2021-12"])
#Simple plot for the entire time
Calculate returns
#Daily Returns
return<-CalculateReturns(AAPL$[Link])
head(BSESN)
return<-CalculateReturns(BSESN$[Link])
View(return)
#since first row has a missing value, we need to remove that
return<-return[-1]
View(return)
#to see the distribution
hist(return)
• The next step is the calculation of the daily return of the
price and display it. For the return calculation we use the #to plot the histogram with density and normal curve
function CalculateReturns(). #return in blue, density curve in green and normal curve in red
• As we can see, the histogram of the returns seems to be [Link](return, methods=c('[Link]',
more skewed than the normal distribution, meaning that '[Link]'),colorset=c('blue','green','red'))
considering the normal distribution for the returns is not a
good choice. The student distribution tends to be the
more adapted for this distribution. We will see if that is
confirmed by the model estimation.
Chart series return
chartSeries(sensex) chartSeries(return,theme="white")
Finding annualized volatility of returns
• The next step is to calculate the annualized #capture Annualized volatility
volatility and the rolling-window volatility of return<-[Link](return)
returns. This can be done either at the daily, sd(return)
monthly, quarterly frequency, etc. Here is sqrt(252)*sd(return)
the code for the monthly. width = 22 (252 for
yearly frequency) sqrt(252)*sd(return["2008"])
sqrt(252)*sd(return["2013"])
sqrt(252)*sd(return["2020"])
sqrt(252)*sd(return["2021"])
[Link](R=return["2008::2021"],width=22,FUN="sd.a
nnualized",scale=252, main="Sensex annualized volatility")
[Link](R=return["2008::2021"],width=252,FUN="sd.
annualized",scale=252, main="Sensex annualized volatility")
ARCH models: Structure
Consider a discrete time process for the price of a security
{𝑆𝑡 , 𝑡 = 1,2,3 … . }
Engle(1982), the architect of ARCH models, proposes
𝑆𝑡
𝑟𝑡 = log as 𝑟𝑡 = 𝜇𝑡 + 𝑎𝑡 ,
𝑆𝑡−1
where 𝜇𝑡 is the mean return, conditional on 𝐹𝑡−1 ,the information available through time (t-1)
𝑎𝑡 = 𝜖𝑡 × 𝜎𝑡 , 𝑤ℎ𝑒𝑟𝑒 𝜖𝑡 𝑖𝑠 i.i.d with E[𝜖𝑡 ] =0 and Var[𝜖𝑡 ] =1
2 2
𝜎𝑡2 = 𝛼0 + 𝛼1 𝑎𝑡−1 + 𝛼2 𝑎𝑡−2 + ⋯ + 𝛼𝑝 𝑎𝑡−𝑝 2
where 𝛼𝑖 ≥ 0, 𝑗 =
0,1 … . 𝑝
𝜎𝑡2 = var(R t |Ft−1 ) is called the conditional heteroscedasticity of returns
ARCH models
• The autoregressive conditional heteroskedasticity (ARCH) model concerns time series with
time-varying heteroskedasticity, where variance is conditional on the information existing at a
given point in time.
• Basic idea is that
a. Shock 𝑎𝑡 of an asset return is serially uncorrelated, but dependent
b. The dependence of 𝑎𝑡 can be described by a quadratic function of its lagged values
2 2
𝜎𝑡2 = 𝛼0 + 𝛼1 𝑎𝑡−1 + 𝛼2 𝑎𝑡−2 2
+ ⋯ + 𝛼𝑝 𝑎𝑡−𝑝
𝑎𝑡 = 𝜖𝑡 × 𝜎𝑡
𝜖𝑡 = 𝑁(0,1)
2 𝑚 2
• Large past shocks 𝑎𝑡−𝑖 𝑖=1
imply a large conditional variance 𝜎𝑡 for the innovation 𝑎𝑡 . Shocks
tend to be followed by another shock.
• Spikes in the graph suggest that percentage changes are not serially independent and have some
ARCH effects.
2
• 𝑎𝑡 is a stationary process with E(𝑎𝑡 )=0 and Var(𝑎𝑡 )= Var 𝑎𝑡−1 = 𝐸 𝑎𝑡2 = 𝐸 𝑎𝑡−1
GARCH model
𝑆𝑡
For a log return series 𝑟𝑡 = log as 𝑟𝑡 = 𝜇𝑡 + 𝑎𝑡 ,
𝑆𝑡−1
GARCH(m,s) 𝜎𝑡2 = 𝛼0 + σ𝑚 𝛼 𝑎 2
𝑖=1 𝑖 𝑡−𝑖 + σ 𝑚
𝛽 𝜎 2
𝑗=1 𝑖 𝑡−𝑗
𝑎𝑡 = 𝜖𝑡 × 𝜎𝑡
where 𝜇𝑡 is the mean return, conditional on 𝐹𝑡−1 ,the information available through time (t-1)
𝑎𝑡 = 𝜖𝑡 × 𝜎𝑡 , 𝑤ℎ𝑒𝑟𝑒 𝜖𝑡 𝑖𝑠 i.i.d with E[𝜖𝑡 ] =0 and Var[𝜖𝑡 ] =1
GARCH specification
• Mean model
• ARMA(0,0)---constant
mean ####1. Standard GARCH or sGARCH model with
constant mean
• Variance model
s<-ugarchspec([Link] =
• Standard GARCH list(armaOrder=c(0,0)),
• Distribution model [Link]=list(model="sGARCH"),
[Link] = "norm")
• 𝜖𝑡 = 𝑁(0,1)
m<-ugarchfit(data=return,spec=s)
summary(m)
m
We can start with the standard GARCH model where we consider the conditional error term is a normal distribution.
We use the function ugarchspec() for the model specification and ugarchfit() for the model fitting. For the standard
GARCH model, we specify a constant to mean ARMA model, which means that arma0rder = c(0,0). We consider the
GARCH(1,1) model and the distribution of the conditional error term is the normal distribution.
Understanding the results
*---------------------------------* • conditional mean of the error term in a time
* GARCH Model Fit * series model is constant
*---------------------------------*
• 𝑟𝑡 = 𝜇 + 𝑎𝑡
• 𝑟𝑡 = 0.000897 + 𝑎𝑡
Conditional Variance Dynamics
----------------------------------- • 𝑎𝑡 ~𝑁(0, 𝜎𝑡2 )
GARCH Model : sGARCH(1,1) 2 2
• 𝜎𝑡2 = 𝜔 + 𝛼1 𝑎𝑡−1 + 𝛽1 𝜎𝑡−1
Mean Model : ARFIMA(0,0,0)
2 2
Distribution : norm • 𝜎𝑡2 = 0.000002+ 0.099163 𝑎𝑡−1 + 0.892837 𝜎𝑡−1
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu 0.000897 0.000148 6.0765 0.000000
omega 0.000002 0.000001 1.8899 0.058772
alpha1 0.099163 0.012171 8.1473 0.000000
beta1 0.892837 0.012127 73.6222 0.000000
Very low p value
Understanding the results indicates serial
correlation
Information Criteria Weighted Ljung-Box Test on Standardized
------------------------------------ Residuals
------------------------------------
Akaike -6.1410 statistic p-value
Bayes -6.1349 Lag[1] 24.92 5.987e-07
Shibata -6.1410 Lag[2*(p+q)+(p+q)-1][2] 25.04 2.119e-07
Hannan-Quinn -6.1388 Lag[4*(p+q)+(p+q)-1][5] 25.25 6.781e-07
d.o.f=0
H0 : No serial correlation
• It displays the Akaike (AIC), Bayes Ljung-Box test for testing the serial correlation of the error
(BIC), Hannan-Quinn and Shibata criteria terms. The null hypothesis is that there is no serial correlation
for the model estimation. The lower these of the error terms. The decision rule is simple. Basically, if the
values, the better the model is in terms of p-value is lower than 5%, the null hypothesis is rejected. As we
fitting. can see that the p-value is lower than 5%, meaning to reject
the null hypothesis. Then there no serial correlation of the error
term.
Indicates error is not
Goodness of fit tests following normal
distribution
Weighted Ljung-Box Test on Standardized Adjusted Pearson Goodness-of-Fit Test:
Squared Residuals ------------------------------------
------------------------------------ group statistic p-value(g-1)
statistic p-value 1 20 77.84 4.366e-09
Lag[1] 0.8039 0.3699 2 30 86.56 1.221e-07
Lag[2*(p+q)+(p+q)-1][5] 2.0416 0.6086 3 40 111.49 6.636e-09
Lag[4*(p+q)+(p+q)-1][9] 3.2100 0.7238 4 50 124.27 1.813e-08
d.o.f=2
it is useful to check if the error term follows the
This indicates no serial correlation as null normal distribution. The null hypothesis is that the
is accepted due to higher p values conditional error term follows a normal distribution.
If the p-value is lower than 5%, the null hypothesis
is rejected. As we can see, the normal distribution is
by far rejected (as the p-value is close to zero).
12 plots- normal dist
The GARCH model with Skewed student’s T
distribution
Adjusted Pearson Goodness-of-Fit Test: s<-ugarchspec([Link] =
------------------------------------ list(armaOrder=c(0,0)),
group statistic p-value(g-1) [Link]=list(model="sGARCH"),
1 20 25.43 0.1469 [Link] = "sstd")
2 30 29.21 0.4543
3 40 45.38 0.2233
4 50 54.07 0.2868
For the goodness of fit of the residual to the considered skewed student distribution,
we can see that the p-value is greater than 5%, meaning that there is not enough
evidence to reject the fact that the residuals fit well that distribution (see table
named "Adjusted Pearson Goodness-of-Fit Test ").
GJR GARCH
• The GJR-GARCH model estimation s<-ugarchspec([Link] =
is estimated by changing in the list(armaOrder=c(0,0)),
model specification in the function [Link]=list(model="gjrGARCH"),
ugarchspec(), the terms "sGARCH" [Link] = "sstd")
by "gjrGARCH". Here is the code
Optimal Parameters
𝑟𝑡 = 𝜇 + 𝑎𝑡 ------------------------------------
𝑟𝑡 = 0.000558 + 𝑎𝑡 Estimate Std. Error t value Pr(>|t|)
𝑎𝑡 ~𝑇(0, 𝜎𝑡2 ) mu 0.000558 0.000147 3.7982 0.000146
2 2
𝜎𝑡2 𝑎𝑡−1 < 0 = 𝜔 + (𝛼1 +𝛾)𝑎𝑡−1 + 𝛽1 𝜎𝑡−1 omega 0.000003 0.000001 2.5535 0.010663
2 2
𝜎𝑡2 = 0.000003+ (0.016761+ 0.151716) 𝑎𝑡−1 + 0.892728 𝜎𝑡−1 alpha1 0.016761 0.007135 2.3493 0.018810
2 2 beta1 0.892728 0.010285 86.8007 0.000000
𝜎𝑡2 𝑎𝑡−1 < 0 = 𝜔 + (𝛼1 )𝑎𝑡−1 + 𝛽1 𝜎𝑡−1
2
𝜎𝑡2 = 0.000002+ (0.016761) 𝑎𝑡−1 2
+ 0.892728 𝜎𝑡−1 gamma1 0.151716 0.020013 7.5811 0.000000
skew 0.921649 0.020699 44.5266 0.000000
shape 7.871186 0.855092 9.2051 0.000000
12 Plots – t dist
QQ-plot shows return distribution follows the Impact of negative news is
student distribution. more than positive news
Forecast
When we run the forecast of the volatility for the
next 20 days, we can observe that based on this
model, we expect the volatility of sensex to
potentially increase on the next 5 days and
remain at the same level for the remaining days
as shows the graph below.
f<-ugarchforecast(fitORspec = m,
[Link]=20)
plot(fitted(f))
plot(sigma(f))