Modeling Risk Factors (20 Points)
In this task, you will need to download daily data for the S&P 500 index (not the ETF). The data
should date between to Jan 1960 and Feb 2019. Given this time series, compute the daily returns
using the adjusted prices and address the following:
1. Your first task to compute the realized volatility. To do so, for each week in the time series, compute
the realized variance as the average squared return and scale it by 5. Hence, the realized volatility
is given by the squared root of the realized variance. For instance, if you have Dw days in week w,
then the realized volatility of that week is given by
v
u
Dw
u
1 X
σw = t5 ×
Rd2
Dw
(1)
d=1
with Rd denoting the daily return. As a summary provide a plot of the realized volatility over time
(5 Points).
2. Your second task is to construct a forward estimate (forecast) for the realized volatility. You will
need convert the returns from daily to weekly. Given the weekly returns, you are required to use
two models: a 50-week moving average (MA) and an EWMA model with λ = 90%. In the former
case, the w + 1 week volatility forecast is given by
v
u
u 1
σ̂w+1 = t
W
w
X
Rt2
(2)
t=w−W +1
with W = 50 weeks and Rt is the return in week w. For the EWMA, the forecast is given by
σ̃w+1 =
q
2 + λσ̃ 2
(1 − λ)Rw
w
(3)
with λ = 0.9 and σ̃w denotes the former estimate. Note that in the EWMA case, you need start
with an initial volatility. I suggest using the sample estimate using the first 50 weeks as an initial
estimate. Hence, the EWMA model will require an initial sample of 50 weeks to derive the first
forecast. After deriving a time series forecast using each model merge the two altogether and
provide a figure summarizing both on the same plot over the whole sample (5 Points). In addition,
provide a summary statistics in a well-organized table (5 Points). Note that the sample period in
this case should start from late Dec 1960, and the frequency is weekly.
3. Finally, merge the realized volatility along with the forecast of each model. As a summary of performance, plot the realized against the forecast (1 Points). Moreover, regress the realized volatility
on the each of the forecasts and report the following measures: coefficient of determination R2 ,
mean-squared error (MSE), the intercept, and the slope. How do you compare between the two
models? Which one provides a better approach to model risk? (4 Points)
6
Agenda
A quick recap from last week
Model Risk
I
I
Model Error
Case Study
Violation of Normality
I
I
iid Assumption
Fat Tails
Intro to time-varying volatility
I
I
I
Moving Average
Exponentially Weighted Moving Average (EWMA)
Intro GARCH Model
2/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
2 / 25
Last Week
Last week we talked about random number generators (RNG) and their
use in MC methods
3/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
3 / 25
Last Week
Last week we talked about random number generators (RNG) and their
use in MC methods
We spoke about Brownian Motion (geometric) and its relevance to
simulating stock prices
3/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
3 / 25
Last Week
Last week we talked about random number generators (RNG) and their
use in MC methods
We spoke about Brownian Motion (geometric) and its relevance to
simulating stock prices
Finally, we discussed the application of MC to portfolio risk management
I
I
Value at Risk (VaR)
Sensitivity to model specification, i.e. volatility
3/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
3 / 25
Model Risk I
Models are approximations to reality.
They are necessary for determining the price at which an instrument
should be traded
They are also necessary for valuing and hedging a financial institution’s
position in an instrument once it has been traded.
4/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
4 / 25
Model Risk I
Models are approximations to reality.
They are necessary for determining the price at which an instrument
should be traded
They are also necessary for valuing and hedging a financial institution’s
position in an instrument once it has been traded.
There are two main types of model risk:
I
I
Model returning wrong price at the time a product is bought/sold
Wrong hedging model, e.g. wrong Greeks
4/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
4 / 25
Model Risk II
Physics Vs. Finance
The differential equation such as the GBM is the heat-exchange equation that has been used by physicists for many years.
The main difference is that the models of physics describe physical
processes and are highly accurate.
The models of finance describe the behavior of market variables
I
which are the result of human interactions and behavior
At best the finance models can give us an approximation of reality
I
For this reason, Model Risk is inevitable in Finance
5/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
5 / 25
Model Risk II
Physics Vs. Finance
The differential equation such as the GBM is the heat-exchange equation that has been used by physicists for many years.
The main difference is that the models of physics describe physical
processes and are highly accurate.
The models of finance describe the behavior of market variables
I
which are the result of human interactions and behavior
At best the finance models can give us an approximation of reality
I
For this reason, Model Risk is inevitable in Finance
One major concern in Finance is model parameters
The parameters of models in Physics generally do not change
Whereas in parameters in Finance change daily
5/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
5 / 25
Model Risk III
Model risk can refer to
I
I
Model error
Implementing a model incorrectly
Model Error
For instance, the pricing of derivatives relies heavily on mathematical
and simulation models
I
I
error model calibration
error in deriving solution
A more common and dangerous risk relates to assumption errors on
the underlying stock process
I
I
does GBM process fully reflect stock prices?
in other words, do returns follow iid normal?
6/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
6 / 25
Niederhoffer’s Case Study1
A well-established hedge fund ran by Victor Niederhoffer
I
I
a star on Wall Street
his fund was wiped out in November 1997
What happened?
1
See Box 14.1 from this chapter.
Spring 2019 (Stevens)
Financial Risk Management
7/25
FE535
7 / 25
Niederhoffer’s Case Study1
A well-established hedge fund ran by Victor Niederhoffer
I
I
a star on Wall Street
his fund was wiped out in November 1997
What happened?
Victor wrote (sold) “naked” options on the S&P 500 index
His strategy was the following
I
I
1
collect many put option premiums for a small price
the chances of losses were small
See Box 14.1 from this chapter.
Spring 2019 (Stevens)
Financial Risk Management
7/25
FE535
7 / 25
Niederhoffer’s Case Study1
A well-established hedge fund ran by Victor Niederhoffer
I
I
a star on Wall Street
his fund was wiped out in November 1997
What happened?
Victor wrote (sold) “naked” options on the S&P 500 index
His strategy was the following
I
I
collect many put option premiums for a small price
the chances of losses were small
Nonetheless, his main assumption was that the market won’t drop more than 5%
percent in a day
During the Asian market crisis, the S&P 500 dropped more than 7% in a single day
To meet margin calls, Victor had to liquidate his position in a fire-sale
1
See Box 14.1 from this chapter.
Spring 2019 (Stevens)
Financial Risk Management
7/25
FE535
7 / 25
Let’s take a closer look at what happened
If Rd denotes the return on the S&P 500 in a single day d and Rd ∼ N(µd , σd2 ) then
P (Rd < −0.05) = P
−0.05 − µd
σd
(1)
The probability should be small as long as σd (µd ) is small (large) enough
8/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
8 / 25
Let’s take a closer look at what happened
If Rd denotes the return on the S&P 500 in a single day d and Rd ∼ N(µd , σd2 ) then
P (Rd < −0.05) = P
−0.05 − µd
σd
(1)
The probability should be small as long as σd (µd ) is small (large) enough
However, in October 1997, the market exhibited a sudden increase in volatility due
to worries about possible spillovers from Asian Financial Crisis
For instance, compared to Sep, 1997, the S&P 500 volatility more than doubled in
Oct, 1997
Probability of 5% drop
I
which, as a result, significantly
increased the probability
1997−01−02 / 1997−12−31
0.010
0.010
0.008
0.008
0.006
0.006
0.004
0.004
0.002
0.002
Jan 02
1997
Mar 03
1997
May 01
1997
Jul 01
1997
Sep 02
1997
Nov 03
1997
Dec 31
1997
8/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
8 / 25
Why Normal?
If daily returns follow an iid normal distribution, i.e. Rd ∼ N(µ, σ) ∀d = 1, ..., T ,
then we know that
V[
D
X
Rd ] = D × σ 2
(2)
d=1
This is the result of an iid assumption for time aggregation (see Section 5.1.2 of the
Jorion)
9/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
9 / 25
Why Normal?
If daily returns follow an iid normal distribution, i.e. Rd ∼ N(µ, σ) ∀d = 1, ..., T ,
then we know that
V[
D
X
Rd ] = D × σ 2
(2)
d=1
This is the result of an iid assumption for time aggregation (see Section 5.1.2 of the
Jorion)
In terms of VaR, under normal distribution, it follows that
VaR(Rd , c) = E[Rd ] − Q(Rd , c) = µ − Q(Rd , c)
(3)
Under normal distribution the c quantile of Rd
Q(Rd , c) = µ + σZc
(4)
VaR(Rd , c) = µ − [µ + σZc ] = −σZc = σZ1−c
(5)
such that
where Z1−c is the 1 − c percentile of the standard normal distribution, i.e.
P(Z < Z1−c ) = 1 − c with Z ∼ N(0, 1)
(6)
9/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
9 / 25
Equation (5) indicates that the daily VaR at the 1−c level of confidence
is mainly determined by the assessment of the daily volatility
Obviously, a daily monitoring of the VaR requires a daily monitoring of
the volatility
If returns were iid, then the D multiple periods VaR is given by
VaR
D
X
√
!
Rd , c
=
D × σ × Z1−c
(7)
d=1
The above results are relevant if returns were normal and iid.
See examples 5.1 through 5.5 from Jorion’s for further discussion on
this
10/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
10 / 25
Normal Assumption
So far, we have assumed that stock returns exhibit normal distribution
Normality assumption greatly simplifies computations and pricing, especially for derivatives
However, there is also trade-off between simplicity and accuracy
11/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
11 / 25
Normal Assumption
So far, we have assumed that stock returns exhibit normal distribution
Normality assumption greatly simplifies computations and pricing, especially for derivatives
However, there is also trade-off between simplicity and accuracy
In practice, the behavior of stock returns tends to contradict normal
distribution
In particular, the empirical distribution tends to
I
I
have heavier tails than the normal distribution
be more peaked than the normal distribution
11/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
11 / 25
Normal Assumption
So far, we have assumed that stock returns exhibit normal distribution
Normality assumption greatly simplifies computations and pricing, especially for derivatives
However, there is also trade-off between simplicity and accuracy
In practice, the behavior of stock returns tends to contradict normal
distribution
In particular, the empirical distribution tends to
I
I
have heavier tails than the normal distribution
be more peaked than the normal distribution
This means that small changes and large changes are more likely than
the normal distribution would suggest
Many market variables have this property, known as excess kurtosis
11/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
11 / 25
Let’s consider the monthly returns of the SPY since 2000
10
8
Density
6
4
plot(density(R), main = v)
m
>
>
+
>
empirical
normal
0
library(quantmod)
library(lubridate)
library(moments)
v
>
>
>
SPY.Adjusted
-0.7482973
−0.20
−0.15
−0.10
−0.05
0.00
0.05
0.10
N = 224 Bandwidth = 0.01049
> kurtosis(R)
SPY.Adjusted
4.664545
> shapiro.test(as.numeric(R))
Shapiro-Wilk normality test
data: as.numeric(R)
W = 0.96368, p-value = 1.744e-05
Spring 2019 (Stevens)
12/25
Financial Risk Management
FE535
12 / 25
Let’s repeat the same for Google
GOOG
>
+
>
plot(density(R), main = v)
m
>
0
GOOG.Adjusted
0.4964426
> kurtosis(R)
−0.2
GOOG.Adjusted
4.79023
0.0
0.2
0.4
N = 169 Bandwidth = 0.02291
> shapiro.test(as.numeric(R))
Shapiro-Wilk normality test
data: as.numeric(R)
W = 0.97167, p-value = 0.001562
13/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
13 / 25
Apple
"AAPL"
get(getSymbols(v,from = "2000-01-01"))
P[,6]
apply.monthly(P,function(x) x[nrow(x),] )
na.omit(log(P/lag(P)))
3
plot(density(R), main = v)
m
>
>
+
>
empirical
normal
Density
0
AAPL.Adjusted
-1.93906
> kurtosis(R)
−1.0
−0.8
GOOG.Adjusted
4.79023
−0.6
−0.4
−0.2
0.0
0.2
0.4
N = 224 Bandwidth = 0.02949
> shapiro.test(as.numeric(R))
Shapiro-Wilk normality test
data: as.numeric(R)
W = 0.97167, p-value = 0.001562
14/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
14 / 25
Stationarity
The most common error assumes that the return process is stationary
I
I
such as the case for σ constant over time
whereas, derivatives traders know very well that volatility is not constant
In fact, fat tails can occur when returns are drawn from a distribution
with a time varying volatility
A more realistic case, therefore, is to assume that the volatility is
stochastic and, hence, develop a relevant return distribution (price
path)
15/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
15 / 25
Time Variation in Risk
16/25
Moving Average (MA)
To model time-varying volatility in a very simple way is to consider the moving
average (MA) of squared returns over D periods
For instance, let Ri denote the return on a stock in day i, for i = d, d −1.., d −D +1,
then the next day variance can be modeled as
2
σd+1
=
D
1 X 2
Rd−i+1
D
(8)
i=1
Note that above is a similar expression to the variance of returns, however, assuming
an average daily return of zero
16/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
16 / 25
Moving Average (MA)
To model time-varying volatility in a very simple way is to consider the moving
average (MA) of squared returns over D periods
For instance, let Ri denote the return on a stock in day i, for i = d, d −1.., d −D +1,
then the next day variance can be modeled as
2
σd+1
=
D
1 X 2
Rd−i+1
D
(8)
i=1
Note that above is a similar expression to the variance of returns, however, assuming
an average daily return of zero
After realizing the returns for day d + 1, the window is rolled over, and the variance
for d + 2 is given by
2
σd+2
=
D
1 X 2
Rd−i+2
D
(9)
i=1
For this reason, it is referred to as MA
16/25
Spring 2019 (Stevens)
Financial Risk Management
FE535
16 / 25
In R, this can be achieved in the long way or the short way
In either case, we to start with a window of D days and roll it on a daily basis
>
>
>
>
>
v
P
P
R
D
>
var_MA
+
2007−01−03 / 2009−12−31
RM
Purchase answer to see full
attachment