Extreme values in volatile time series
When you take a long series of iid data, such as several thousand observations, and select a small subset of the most extreme observations, like less than 100, then these extremes appear at random and the spaces or gaps between the extremes follow a distribution that is very close to exponential. When we carry out the same exercise for a volatile financial log-return series then the extremes appear in clusters during periods of high volatility. This is another feature of real log-return data that we need to take account of when building models.
In this exercise, you will investigate the irregular time series djx_extremes
which contains the 100 most extreme negative log-returns of the Dow Jones index between 1985 and 2015. You will compare it with iid_extremes
which contains the 100 most extreme values in an iid series of the same length as djx_extremes
. To do this, you will use the object exp_quantiles
, which contains 100 theoretical quantiles of the standard exponential distribution. These can be used to construct a Q-Q plot of each dataset against the exponential reference distribution.
The djx_extremes
, iid_extremes
, and exp_quantiles
objects are available in your workspace.
This exercise is part of the course
Quantitative Risk Management in R
Exercise instructions
- Partition the plotting area into a row of 3 panels (this has been done for you)
- Use
plot()
andtype = "h"
to plotdjx_extremes
. - Use
time()
anddiff()
in succession to compute the spaces between the dates of the extremes and assign them todjx_spaces
. - Use
hist()
andas.numeric()
in succession to make a histogram ofdjx_spaces
after coercing the data to numeric values. - Use the appropriate function to make a Q-Q plot of
djx_spaces
against the exponential quantiles inexp_quantiles
. - Carry out the previous 4 steps for
iid_extremes
: plot the raw data with sametype
parameter, compute the spaces asiid_spaces
, make a histogram, and make a Q-Q plot.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Partition plotting area into 3 pieces
par(mfrow = c(1, 3))
# Plot djx_extremes
___(___)
# Compute the spaces between the times of the extremes
djx_spaces <- ___
# Make a histogram of these spaces
___(___)
# Make a Q-Q plot of djx_spaces against exp_quantiles
___(exp_quantiles, djx_spaces)
# Carry out the previous 4 steps for iid_extremes
___(___, ___)
iid_spaces <-
___(___(___))
___(exp_quantiles, iid_spaces)