Analyzing volatility

GARCH Models in R

Kris Boudt

Professor of finance and econometrics

About the instructor

  • Kris Boudt
    • PhD in financial risk forecasting
    • Use GARCH models to win by not losing (much)
  • R package rugarch of Alexios Ghalanos.

Kris Boudt

GARCH Models in R

Calculating returns

  • Relative financial gains and losses, expressed in terms of returns

$$ R_{t} = \frac{P_{t} - P_{t-1}}{P_{t-1}} $$

  • Function CalculateReturns in PerformanceAnalytics
# Example in R for daily S&P 500 prices (xts object)
library(PerformanceAnalytics)
SP500returns <- CalculateReturns(SP500prices)
GARCH Models in R

Daily S&P 500 returns

Daily S&P 500 returns

Properties of daily returns:

  • The average return is zero
  • Return variability changes through time

Standard deviation = measure of return variability.

Synonym: Return volatility.

Greek letter $\sigma_t$.

GARCH Models in R

Distribution of daily returns per year

GARCH Models in R

How to estimate return volatility

  • Function sd() computes the (daily) standard deviation:
sd(sp500ret)
0.01099357
  • Corresponding formula for $\hat \sigma$ computed using $T$ daily returns:

$$ \hat \sigma = \sqrt{\frac{1}{T-1} \sum_{t=1}^T (R_t - \hat \mu )^2},$$

  • where $\hat \mu$ is the mean return.
GARCH Models in R

Annualized volatility

  • sd(sp500ret) is daily volatility
  • Annualized volatility = $\sqrt{252}$ $\times$ daily volatility
# Compute annualized standard deviation
sqrt(252) * sd(sp500ret)
0.1745175
GARCH Models in R

Distribution of daily returns per year

GARCH Models in R

Rolling volatility estimation

  • Rolling estimation windows : Rollingwindows
  • Window width? Multiple of 22 (trading days).
GARCH Models in R

Function chart.RollingPerformance()

library(PerformanceAnalytics)

chart.RollingPerformance(R = sp500ret,
                         width = 22,
                         FUN = "sd.annualized",
                         scale = 252, 
                         main = "Rolling 1 month volatility")
GARCH Models in R

Rolling window volatility

GARCH Models in R

About GARCH models in R

  • Estimation of $\sigma_t$ requires time series models, like GARCH.
GARCH Models in R

Let's refresh the basics of computing rolling standard deviations in R

GARCH Models in R

Preparing Video For Download...