0% found this document useful (0 votes)
104 views31 pages

Financial Time Series Notes

This document discusses financial time series analysis and risk management. It covers topics like features of financial time series including returns, stationarity and properties of returns. It also discusses ARIMA models, modeling volatility using ARCH and GARCH models, and implementing these techniques in R.

Uploaded by

Bev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views31 pages

Financial Time Series Notes

This document discusses financial time series analysis and risk management. It covers topics like features of financial time series including returns, stationarity and properties of returns. It also discusses ARIMA models, modeling volatility using ARCH and GARCH models, and implementing these techniques in R.

Uploaded by

Bev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

FINANCIAL TIME SERIES AND RISK

MANAGEMENT
Mr. Mutua

January 15, 2018

1
Contents
1 Introduction 3
1.1 Features of Financial time series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Returns in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Empirical Properties of Returns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Stationarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 ARIMA Models 8
2.1 Autoregressive Model (AR Model) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Properties of AR model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 AR 1 model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Autocorrelation function of an AR(1) model . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Identifying AR Models in Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.6 Parameter Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7 AR in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.8 Partial Autocorrelation Coefficient(PACF) . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.9 Moving Average(MA models) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.10 Properties of MA models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.11 Identifying MA Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.12 Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.13 MA in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.14 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.15 Autoregressive Moving Average Models(ARMA) models . . . . . . . . . . . . . . . . . 16
2.16 Properties of ARMA(1,1) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.17 Identifying ARMA Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.18 Box-Ljung Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.19 Procedure of B-L test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.20 B-L in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3 Modelling Volatility 19
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Model Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Model Building . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4 Testing for ARCH Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.5 Ljung Box Statistic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.6 Lagrange Multiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.7 The ARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.8 Properties of ARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.9 Order Determination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.10 Estimation of Model Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.11 Model Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.12 ARCH IN R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.13 Weaknesses of the ARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.14 The GARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.15 Properties of GARCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.16 GARCH IN R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.17 Integrated GARCH Model(IGARCH) . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.18 ASSIGNMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.19 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

2
1 Introduction
1.1 Features of Financial time series
1. Returns
Let Pt denote the price at time t of an asset that pays no dividends and let Pt−1 denote the
price at time t − 1 then we define the following:

(a) Simple Returns


It is defined as follows:
Pt − Pt−1
Rt = (1)
Pt−1
Pt
Equation 1 above can be written as follows −1
Pt−1
so that
Pt
Rt+1 = (2)
Pt−1

Equation 2 is referred to as simple gross returns.


(b) Continuously compounded Returns
It is defined as follows

Pt
rt = ln(1 + Rt ) = ln( ) (3)
Pt−1

From equation 3 above we have:


Pt
ert = 1 + Rt =
Pt−1
Pt = Pt−1 ert (ert is the compounding factor)

1.2 Returns in R
Using the data called MSFT in R we illustrate how to perform returns in R.

library(timeSeries) #loading the package


data(MSFT) #Data is on daily microsoft OHLC prices and volumes
attach(MSFT)
#Plotting the series
ts.plot(Close)
#Getting the continous and simple returns
simplereturns<-returns(Close, method="simple")
ts.plot(simplereturns)
continuousreturns<-returns(Close, method="continuous")[2:length(Close)]
ts.plot(continuousreturns)

3
Task
Discuss the features of the above plots.

1.3 Empirical Properties of Returns


1. The mean of the return series is close to zero.

4
5
The series tend to have excess kurtosis

basicStats(continuousreturns)
continuousreturns
nobs 248.000000
NAs 0.000000
Minimum -0.125740
Maximum 0.178692
1. Quartile -0.018711
3. Quartile 0.017074
Mean -0.000780
Median -0.002936
Sum -0.193485
SE Mean 0.002170
LCL Mean -0.005054
UCL Mean 0.003494
Variance 0.001168
Stdev 0.034171
Skewness 0.403374
Kurtosis 3.746345

The plot below provides a proof further of excess kurtosis.

The returns seem to be asymmetric that is skewness 6=0. From the output above it is clear that
the value for skewness is not 0.

There is volatility clustering that is long spikes follow long spikes and short spikes follow short

6
spikes.

1.4 Stationarity
Let Yt denote a sequence of random variables indexed by some time subscript t, we say that time
series Yt is stationary if:

1. E[Yt ] = µ for all t and

2. Cov(Yt , Yt−j )=E[(Yt − µ)(Yt−j − µ)] = γj for all t and any j.

The parameter γj is called the j th order or lag j. A plot of γj against j is called the autocovariance
function.
The autocorrelations of Yt are defined by:
Cov(Yt , Yt−j ) γj
ρj = p =
V ar(Yt )V ar(Yt−j ) γ0
A plot of ρj against j is called the autocorrelation function(acf).

A stationary time series is defined by it’s mean, variance and acf.

7
2 ARIMA Models
2.1 Autoregressive Model (AR Model)
It is defined as follows:

rt = σ + φ1 rt−1 + φ2 rt−2 + ... + φp rt−p + at


Pp
where σ = (1 − i=1 φi )µ, µ represents the process mean.

An AR model is simply a linear regression of the current value of the series against one or more
prior values of the series.

The value of p is called the order of the AR model.

2.2 Properties of AR model


For effective use of AR models it pays to study their basic properties. We discuss the properties of
AR(1) details and give the results for general AR(p) model.

2.3 AR 1 model
AR of order 1 is given as:
rt = φ0 + φ1 rt−1 + at (4)
We begin with the necessary and sufficient condition for weak stationarity of the AR(1) model in
equation 4.
Assuming that the series is weakly stationary we have E(rt ) = µ, V ar(rt ) = γ0 , and Cov(rt rt−j ) = γj
where µ, γ0 are constants and γj is a function of j not t.

We can easily obtain the mean, variance and autocorrelations of the series as follows. Taking ex-
pectation of equation 4 and using E(at ) = 0, we obtain:

E(rt ) = φ0 + φ1 E(rt−1 ).

φ0
Under the stationarity condition, E(rt ) = E(rt−1 ) = µ and hence E(rt ) = µ = .
1 − φ1
This results has two implications for rt . First the mean of rt exists if φ1 6= 1. Second, the mean
of rt is 0 if and only if φ0 = 0. Thus for stationary AR(1) process, the constant term φ0 is related to
the mean of rt via φ0 = (1 − φ1 )µ, and φ0 = 0 implies that E(rt ) = 0
Next using (1 − φ1 )µ, the AR(1) model can be written as:

rt − µ = φ1 (rt−1 − µ) + at (5)
By repeated substitutions, the prior equation implies that:

X
rt − µ = at + φ1 at−1 + φ21 at−2 + ... = φi1 at−i (6)
i=0

Taking the square and expectation of equation 5, we obtain:

V ar(rt ) = φ21 V ar(rt−1 ) + σa2

where σa2 is the variance of at , and we make use of the fact that the covariance between rt and
σa2
at is 0. Under the stationarity assumption, Var(rt )=Var(rt−1 ), so that Var(rt )= , provided that
1 − φ21

8
φ21 < 1. The requirement of φ21 < 1 results from the fact that the variance of a random variable is
nonnegative and rt is weakly stationary.

Consequently the weak stationarity of an AR(1) implies that −1 < φ1 < 1 that is |φ1 |< 1

2.4 Autocorrelation function of an AR(1) model


Multiplying equation 5 by at , using independence between at and rt−1 and taking expectation we
obtain:

E[at (rt − µ)] = φ1 E[at (rt−1 − µ)] + E(at ) = E(at ) = σa2 ,

where σa2 is the variance of at . Multiplying equation 5 by rt−l − µ, taking expectation and using
the prior result, we have:

γl = φ1 γ1 + σa2 if l=0 and φ1 γl−1 if l > 0 where we use γl = γ−l . Consequently, for weak sta-
tionary AR(1) model in equation 4 we have

σ2
var(rt ) = γ0 = and γl = φ1 γl−1 for l >1.
1 − φ21
From the latter equation, the ACF rt satisfies ρl = φ1 ρl−1 for l > 0. Because ρ0 is 1, we have
ρl = φl1 . This result says that the ACF of a weak stationary AR(1) series decays exponentially with
rate φ1 and starting value ρ0 = 1

For a positive φ1 , the plot of ACF of an AR(1) model shows a nice exponential decay.

#Simulating an AR 1 with a positive phi


y <- arima.sim(n = 100, list(ar = 0.9), innov=rnorm(100))
y
#plotting the acf
acf(y)

9
For a negative φ1 , the plot consists of two alternating exponential decays with rate φ21 .

#Simulating an AR 1 with a negative phi


y <- arima.sim(n = 100, list(ar =-0.9), innov=rnorm(100))
y
#plotting the acf
acf(y)

10
AR(p) model. The results of an AR(1) models can be generalized to the general AR(p) model
model. The mean of the stationary series is:

φ0
E(rt ) = provided the denominator is not 0. The associated characteristic equa-
1 − φ1 − ... − φp
tion of the model is 1 − φ1 B − φ2 B 2 − ... − φp B p = 0

If all the solutions of this equation are greater than 1 in modulus, then the series rt is stationary.
Again, inverses of the solutions are the characteristics roots of the model. Thus a stationarity requires
that all characteristics roots to be less than 1 in modulus.

For a stationary AR(p) series the ACF satisfies the difference equation:
(1 − φ1 B − φ2 B 2 − ... − φp B p )φl = 0, for l > 0

The plot of ACF of a stationary AR(p) model would then show a mixture of damping sine and
cosine patterns and exponential decays depending on the nature of its characteristic roots.

2.5 Identifying AR Models in Practice


In application, the order p of an AR time series is unknown. It must be specified empirically. This is
referred to as the order determination (or order specification) of AR models, and it has been exten-
sively studied in the time series literature. Two general approaches are available for determining the
value of p. The first approach is to use the partial autocorrelation function (PACF), and the second
approach uses some information criteria.

Partial Autocorrelation Function (PACF). The PACF of a stationary time series is a func-
tion of its ACF and is a useful tool for determining the order p of an AR model. For an AR(p) series,
the sample PACF cuts off at lag p.

11
2.6 Parameter Estimation
For a specified AR(p) model in Equation (4), the conditional LS method, which starts with the
(p + 1)th observation, is often used to estimate the parameters. Specifically, conditioning on the first
p observations, we have

rt = φ0 + φ1 rt−1 + ... + φp rt−p + at , t = p + 1, ..., T ,

which is in the form of a multiple linear regression and can be estimated by the Least Square method.
Denote the estimate of φ1 by φ̂i . The fitted model becomes.
rˆt =φˆ0 + φˆ1 rt−1 + ... + φˆp rt−p and the associated residual is aˆt = rt − rˆt .

The series aˆt is called the residual series from which we obtain
PT ˆ2
t=p+1 at
σˆa2 = .
T − 2p − 1
If the conditional Gaussian likelihood method is used, the estimates of φi remain unchanged, but
the estimates of σa2 becomes σ˜a2 = σˆa2 × (T − 2p − 1)/(T − p).

2.7 AR in R
We would like to fit an AR(2) model for the MSFT data.

The acf plot is commonly used to check for randomnesss in a data set. This randomness is ascer-
tained by computing autocorrelations for data values at varying time lags.

If random, such autocorrelations should be near zero for any and all time lags operations. If non-
random, then one or more of the autocorrelations will be significantly non-zero.

library(timeSeries)
attach(MSFT)
The following objects are masked from MSFT (pos = 3):
Close, High, Low, Open, Volume
#getting the continous returns to remove trend and seasonality
continuousreturns<-returns(Close,method="continuous")[2:length(Close)]
#Fitting an AR model of order 2
model22<-arima(continuousreturns,order=c(2,0,0))
model22

Call:
arima(x = continuousreturns, order = c(2, 0, 0))

Coefficients:
ar1 ar2 intercept
0.1462 -0.0898 -0.0008
s.e. 0.0631 0.0631 0.0023

sigma^2 estimated as 0.001133: log likelihood = 489.21, aic = -970.41


par(mfrow=c(2,1))
acf(continuousreturns)
pacf(continuousreturns)
par(mfrow=c(2,1))

12
acf(continuousreturns)
pacf(continuousreturns)

ACF plots can be used in model identification for ARIMA models.

2.8 Partial Autocorrelation Coefficient(PACF)


The PACF plots are commonly used for model identification in Box-Jenkins Models. (ARIMA models)

The PACF at lag k is that autocorrelation between Xt and Xt−k that is not accounted for by lags 1
through k-1.

Specifically, Partial autocorrelation are useful in identifying the order of AR model. The PACF
on AR(p) process is 0 at p+1.

If the sample acf plot indicate that an AR would be appropriate then the sample PACF is exam-
ined to help identify the order.

We look for the point on the plot where the PACF’s essentially becomes zero,at 95 percent C.I.

FRom the pacf plot above of the log returns we can say that an AR of order 9 fits the data well
and we use that to illustrate the Box-Ljung Test in section 2.17

2.9 Moving Average(MA models)


The moving average model is defined as:
Xt = µ + At − θ1 At−1 − ... − θq At−q
The µ is the mean of the series, At−i are white noise and θ1 ...θq are model parameters.

13
2.10 Properties of MA models
Again we focus on MA(1) and MA(2) models. The results of an MA(q) can easily be obtained by the
same techniques.

Stationarity
MA models are always weakly stationary because they are finite linear combinations of a white noise
sequence for which the first two moments are time invariant.

For example, consider an MA(1) process:

Xt = µ + At − θAt−1 (7)

Taking the expectation of the model we have E(Xt ) = µ which is time invariant.

Taking the variance of equation 7, we have

2 + θ 2 σ 2 = (1 + θ 2 )σ 2
Var(Xt )=σA 1 A 1 A

where we use the fact that At and At−1 are uncorrelated. Again Var(Xt ) is time invariant.

The prior discussion applies to general MA(q) models, and we obtain two general properties. First,
the constant term of an MA model is the mean of the series(i.e E(Xt ) = µ). Second the variance of
an MA(q) model is Var(Xt )=(1 + θ12 + ... + θq2 )σA
2

Autocorrelation function
Assume for simplicity that µ = 0 for an MA(1) model. Multiplying the model by Xt−l , we have
Xt Xt−l = Xt−l At − θXt−l At−1 .
2 and γ = 0 for l > 1
Taking expectation, we obtain γ1 = −θσA l

2,
Using the prior results and the fact that Var(Xt )=(1 + θ12 )σA

we have

−θ
ρ0 = 1, ρ1 = , ρl = 0 for l > 1
1 + θ2
Thus for for an MA(1) model, the lag-1 ACF is not 0, but all higher-order ACFs are 0. In other
words, the ACF of an MA(1) model cuts off at lag 1. This property generalizes to other MA models.
For an MA(q) model, the lag-q ACF is not 0,but ρl = 0 for l > q

Consequently, an MA(q) series is only linearly related to its first q lagged values and hence is a
finite memory model.

Invertibility
Rewriting a zero mean MA(1) model as At = Xt + θ1 At−1 , one can use repeated substitutions to
obtain: At = Xt + θ1 Xt−1 + θ12 Xt−2 + ...

This equation expresses the current shock At as a linear combination of the present and past val-
ues of Xt . Intuitively, θ1j should go 0 as j increases because the return Xt−j should have very little
impact on the current shock, if any.

14
2.11 Identifying MA Order
The ACF is useful in identifying the order of an MA model. For a time series Xt with ACF ρl if ρq 6= 0
but ρl = 0 for l > q, then Xt follows an MA(q)

2.12 Estimation
Maximum likelihood estimation is commonly used to estimate MA models. There are two approaches
for evaluating the likelihood function of an MA model. The first approach assumes that the initial
shocks are 0.

As such, the shocks needed in likelihood function calculation are obtained recursively from the model,
starting with A1 = X1 − µ and A2 = X2 − µ + θ1 A1 . This approach is referred to as the conditional
likelihood method and the resulting estimates the conditional maximum likelihood estimates.

The second approach treats the initial shocks At , t ≤ 0,as additional parameters of the model and
estimate them jointly with other parameters. This approach is referred to as the exact likelihood
method. The exact likelihood estimates are preferred over the conditional ones, especially when the
MA model is close to being noninvertible. The exact method, however, requires more intensive com-
putation. If the sample size is large, then the two types of maximum likelihood estimates are close to
each other.

2.13 MA in R

library(timeSeries)
attach(MSFT)
The following objects are masked from MSFT (pos = 3):

Close, High, Low, Open, Volume

The following objects are masked from MSFT (pos = 4):

Close, High, Low, Open, Volume

The following objects are masked from MSFT (pos = 5):

Close, High, Low, Open, Volume

#getting the continous returns to remove trend and seasonality


continuousreturns<-returns(Close,method="continuous")[2:length(Close)]
#An MA of order 2
model4<-arima(continuousreturns,order=c(0,0,2))
model4

Call:
arima(x = continuousreturns, order = c(0, 0, 2))

Coefficients:
ma1 ma2 intercept
0.1357 -0.0584 -0.0008
s.e. 0.0654 0.0721 0.0023

sigma^2 estimated as 0.001136: log likelihood = 488.87, aic = -969.73


#B-L test

15
Box.test(model4$residuals,lag=2,type=c("Ljung-Box"))

Box-Ljung test

data: model4$residuals
X-squared = 0.018014, df = 2, p-value = 0.991

2.14 Summary
A brief summary of AR and MA models is in order. We have discussed the following properties:

1. for MA models, ACF is useful in specifying the order because ACF cuts off at lag q for an MA(q)
series;

2. for AR models, PACF is useful in order determination because PACF cuts off at lag p for an
AR(p) process;

3. an MA series is always stationary, but for an AR series to be stationary, all of its characteristic
roots must be less than 1 in modulus;

2.15 Autoregressive Moving Average Models(ARMA) models


In some applications, the AR or MA models discussed in the previous sections become cumbersome
because one may need a high order model with many parameters to adequately describe the dynamic
structure of the data. To overcome this difficulty, the ARMA models are introduced (Box et al.,1994).

Basically, an ARMA model combines the ideas of AR and MA models into a compact form so that
the number of parameters used is kept small, achieving parsimony in parameterization.

The model is useful in modeling business, economic, and engineering time series. For the return
series in finance, the chance of using ARMA models is low. However, the concept of ARMA models
is highly relevant in volatility modeling.

The ARMA(p,q) model is defined as:

Xt = σ + φ1 Xt−1 + φ2 Xt−2 + ... + φp Xt−p + et + At − θ1 At−1 − ... − θq At−q

where σ is defined as in the AR(p) model.

2.16 Properties of ARMA(1,1) Model


A time series Xt follows an ARMA(1,1) model if it satisfies:

Xt − θ1 Xt−1 = φ0 + At − θ1 At−1 (8)

Where At is a white noise series. The left handside of equation 8 is the AR component of the model
and the right handside gives the MA component. The constant term is φ0

Properties of ARMA(1,1) models are generalizations of those of AR(1) models with some minor
modifications to handle the impact of the MA(1) component. We start with the stationarity condition.

Taking the expectation of equation Equation 8, we have: E(Xt )−φ1 E(Xt−1 ) = φ0 +E(At )−φ1 E(At−1 )
φ0
Because At = 0 for all i, the mean of Xt is: E(Xt ) = µ = provided that the series is weakly
1 − φ1
stationary.

16
Next assuming for simplicity that φ0 , we consider the autocovariance function of Xt . First, mul-
tiplying the model At and taking the expectation, we have:

E(Xt At ) = E(A2t ) − φ1 E(At At−1 ) = E(A2t ) = σA


2
(9)

Rewriting the model as:

Xt = φ1 Xt−1 + At − φ1 At−1 and taking the variance of the prior equation we have.

V ar(Xt ) = φ21 V ar(Xt−1 ) + σA


2 + θ 2 σ 2 − 2φ θ E(X
1 A 1 1 t−1 At−1 )

Here we make use of the fact that Xt−1 and At are uncorrelated. Using equation 9, we obtain:
V ar(Xt ) − φ21 V ar(Xt−1 ) = (1 − 2φ1 θ1 + θ12 )σA
2.

Therefore, if the series Xt is weakly stationary, then Var(Xt )=Var(Xt−1 ), and we have:

(1 − 2φ1 θ1 + θ12 )σA


2
Var(Xt = 2 ).
1 − θA
Because the variance is positive, we need φ21 < 1. Again, this is precisely the same stationary condition
as that of the AR(1) model.

To obtain the autocovariance function of Xt , we assume that φ0 = 0 and multiply the model in
equation 8 by Xt−l to obtain: Xt Xt−l − φ1 Xt−1 Xt−l = At Xt−l − θ1 At−1 Xt−l .

For l = 1, taking expectation and using equation 9 for t − 1, we have:

γ1 − θ1 γ0 = −θ1 σA 2 , where γ =Cov(X X


l t t−l ). This result is different from that of the AR(1) case
for which γ1 − θ1 γ0 = 0. However, l = 2 and taking expectation, we have γ2 − θ1 γ1 = 0, which is
identical to that of AR(1) case. In fact, the same techniques yields:

γl − θ1 γl−1 = 0 (10)
2
θ1 σ A
In terms of ACF, the previous results show that for a stationary ARMA(1,1) model:ρ1 = φ1 − ,
γ0
ρl = φ1 ρl−1 for l > 1

Thus, the ACF of an ARMA(1,1) model behaves very much similar to that of an AR(1) model except
that the exponential decay starts with lag 2. Consequently, the ACF of an ARMA(1,1) model does
not cut off at any finite lag.

Turning to PACF, one can show that the PACF of an ARMA(1,1) model does not cut off at any
finite lag either. It behaves very much similar to that of an MA(1) model except that the exponential
decay starts with lag 2 instead of lag 1.

In summary, the stationarity condition of an ARMA(1,1) model is the same as that of an AR(1)
model, and the ACF of an ARMA(1,1) exhibits a pattern similar to that of an AR(1) model except
that the pattern starts at lag 2.

2.17 Identifying ARMA Models


The ACF and PACF are not informative in determining the order of an ARMA model. Tsay and Tiao
(1984) propose a new approach that uses the extended autocorrelation function (EACF) to specify the
order of an ARMA process. The basic idea of EACF is relatively simple. If we can obtain a consistent
estimate of the AR component of an ARMA model, then we can derive the MA component. From
the derived MA series,we can use ACF to identify the order of the MA component.

17
2.18 Box-Ljung Test
The Box-Ljung Box test is a diagnostic tool used to test the lack of fit of a time series model.

The test is applied to the residuals of a time series after fitting an ARMA(p,q) model to the data.

The test examines m autocorrelations of the residuals if the autocorrelations are very small we con-
clude that the model does not exhibit a significant lack of fit.

2.19 Procedure of B-L test


1. Hypothesis
H0 : The model fits the data well.
vs
Ha : The model does not fit the data well.

2. Test Statistic
Given a time series yt of length n the test statistic is defined as follows:
γˆk2
Q = n(n + 2) m
P
k=1
n−k
where γˆk is the estimated autocorrelation of the series at lag k and m is the number of lags being
tested.

3. Critical Value
We reject the null hypothesis iff Q > χ2h,(1−α) h is the degrees of freedom defined as h = m−p−q

2.20 B-L in R
model33<-arima(continuousreturns,order=c(9,0,0))
model33

Call:
arima(x = continuousreturns, order = c(9, 0, 0))

Coefficients:
ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8
0.1434 -0.0695 -0.0663 -0.0894 0.0688 0.1018 0.0814 -0.1235
s.e. 0.0628 0.0629 0.0627 0.0632 0.0630 0.0631 0.0631 0.0634
ar9 intercept
0.1335 -0.0010
s.e. 0.0641 0.0025

sigma^2 estimated as 0.001062: log likelihood = 496.95, aic = -971.89


#Box-Ljung test for model adequacy
Box.test(model33$residuals,lag=9,type=c("Ljung-Box"))

Box-Ljung test

data: model33$residuals
X-squared = 0.33309, df = 9, p-value = 1

From the above output is clear that the p-value is one and thus we fail to reject the null hypothesis
and conclude that an AR model of order 9 fits the data well.

18
3 Modelling Volatility
3.1 Introduction
A special feature of stock volatility is that it is not directly observable, however it has the same features
that are commonly seen in asset returns:

1. Volatility clustering i.e volatility may be high for some time periods and low for other periods.

2. Volatility evolves over time in a continuous manner i.e volatility jumps are rare.

3. Volatility does not diverge to infinity i.e volatility varies within some fixed range. Statistically
this means that volatility is oftenly stationary.

4. Volatility seems to react differently to a big price increase or a big price drop referred to as
leverage.

These properties play an important role in the development of volatility models.

Some volatility models were proposed specifically to correct the weaknesses of existing ones for their
inability to capture the characteristics mentioned earlier. Example the EGARCH model was devel-
oped to capture the asymmetry in volatility induced by big positive and negative asset returns.

3.2 Model Structure


Let rt be the log returns of an asset at time t, the basic idea behind volatility modelling is that
the series rt is either serially correlated but is a dependent series i.e volatility models seek to model
dependence.
Consider the conditional mean and variance of rt given Ft−1

µt = E[rt |Ft−1 ] (11)


σt2 = var[rt |Ft−1 ] = E[(rt − µt )|Ft−1 ] (12)
Where Ft−1 is the information set available at time t-1, typically Ft−1 consists of all linear functions
of the past returns.

It is assumed that rt follows a stationary ARMA(p,q) model with possible explanatory variables
i.e
rt = µt + at (13)
k
X p
X q
X
µt = φ 0 + βi Xit + φi rt−i − θi ai−1 (14)
i=1 i=1 i=1

Where k,p and q are non-negative integers and Xit are explanatory variables. Combining equations
4,5,6, and 7 we have:
σt2 = var[rt |Ft−1 ] (15)
The conditional heteroscedastic model (volatility model) are concerned with the evolution of σt2 . The
manner under which σt2 evolves over time distinguishes one volatility model from another.
Volatility models can be classified into two general categories:

1. Those that use an exact function to govern the evolution of σt2

2. Those that use a stochastic equation to describe σt2

19
The GARCH models belongs to the first category whereas the stochastic volatility model belongs to
the first category.

at is referred to as the shock or innovation of an asset return at time t and σt is the positive square
root of σt2

The model for µt in equation 4 is referred to as the mean equation for rt and the model for σt2 is
called the volatility equation for rt .

3.3 Model Building


The procedure for model building include:

1. Specify a mean equation by testing for serial dependence for the data and if necessary build an
ARMA model to remove any linear dependence

2. Use the residuals of the mean equation to test for ARCH effects.

3. Specify a volatility model if ARCH effects are statistically significant and perform a joint estimate
of the mean and volatility equation.

4. Check the fitted model carefully and refine it if necessary.

3.4 Testing for ARCH Effects


The squared residuals a2t are used to check for conditional heteroscdasticity which is also known as
the ARCH effects.

3.5 Ljung Box Statistic


The test involves applying the Ljung-Box statistic Q(m) to a2t series.The null hypothesis is that the
first m lags of acf are zeros. (or no dependence).

1. Hypothesis
H0 : The model fits the data well.
vs
Ha : The model does not fit the data well.

2. Test Statistic
Given a time series yt of length n the test statistic is defined as follows:
γˆk2
Q = n(n + 2) m
P
k=1
n−k
where γˆk is the estimated autocorrelation of the series at lag k and m is the number of lags being
tested.

3. Critical Value
We reject the null hypothesis iff Q > χ2h,(1−α) h is the degrees of freedom defined as h = m−p−q

3.6 Lagrange Multiplier


This test was developed by Engle(1982). The test is equivalent to the usual F-statistic for testing
αi (i=1,2,...,m) in linear regression.

Let a2t = α0 + α1 a2t−1 + ... + αm a2t−m + e2t t=m+1...T, where et denotes the error term, m is a
specified positive integer and T is the sample size.

The null hypothesis is

20
H0 : α0 = α1 = ... = αm = 0
T
PT 2 ¯ 1X 2
Let SSR0 = t=m+1 (at − (w)) where w̄ = at is the sample mean of a2t
T
t=1
SSR1 = t=m+1 eˆ2t is the sum of squared residuals. Where eˆt is the least squares residuals of the
PT
prior linear regression.

(SSR0 − SSR1 )/m


Then F =
(SSR1 )/T − 2m − 1
F is asymptotically distributed as a chisquare with m degrees of freedom under the null hypothe-
sis. We reject the null hypothesis if F > χ2m (α)

3.7 The ARCH Model


The ARCH model was developed by Engle(1982). The basic idea of ARCH models is:

1. The shock at of an asset return is serially uncorrelated but dependent.

2. The dependence of at can be described by a simple quadratic function of its lagged values.

Specifically an ARCH(m) is defined as follows:

at = σt et

σt2 = α0 + α1 a2t−1 + ... + αm a2t−m + e2t where et is a sequence of iid random variables with mean
o and variance 1, α0 > 0 and αi ≥ 0

The coefficients αi must satisfy some regularity conditions to ensure that the unconditional vari-
ance of at is finite.

et is assumed to follow the standard normal or a standardized student t distribution or a general-


ized error distribution.

3.8 Properties of ARCH Model


Consider an ARCH(1) model

at = σt et

σt2 = α0 + α1 a2t−1 Where α0 > 0 and αi ≥ 0

1. Unconditional mean of at

E(a2t ) = E[E(at |Ft−1 )] = E[E(σt t )] = E[σt E(t )] = 0

2. Unconditional Variance

V ar(at ) = E(a2t )

21
= E[E(a2t |Ft−1 )]

= E[α0 + α1 a2t−1 ]

= α0 + α1 E(a2t−1 )

Because at is a stationary process with E(at ) = 0, V ar(at ) = V ar(at−1 )

Therefore we have

V ar(at ) = α0 + α1 V ar(at )
α0
V ar(at ) =
1 − α1
Since the variance of at must be positive we require 0 ≤ α1 < 1 and α0 > 0

3.9 Order Determination


If an ARCH effect to is found to be significant, one can use the pacf of a2t to determine the ARCH
order.[pacf of squared residuals cuts off at lag m-order].

3.10 Estimation of Model Parameters


The method used is maximum likelihood estimation.

The ARCH(m) model is given by:

at = σt t

σt2 = α0 + α1 a2t−1 + α2 a2t−2 + ... + αm a2t−m where α0 > 0 and αi ≥ 0 and t is a sequence of iid
random variables with mean 0 and variance σ 2 .

The likelihood function of an ARCH(m) model is given by:

f (a1 , ..., aT |α)=f (aT |Ft−1 )f (aT −1 |Ft−2 ),...,f (am+1 |Fm )× f (a1 , ..., am |α)

QT 1 a2
= t=m+1 p exp( t2 ) × f (a1 , ..., am |α)
2πσt2 2σt
Where α = (α1 , ..., αm )0 and f (a1 , ..., am |α) is the joint probability density function of α1 , ..., αm .
As the exact form of of f (a1 , ..., am |α) is complicated it is usually dropped from the prior likelihood
function,especially when the sample size is sufficiently large. This results in using the conditional
likelihood function:

1 a2
f (am+1 , ..., aT |α, a1 , a2 ...am )= Tt=m+1 p exp( t2 )
Q
2πσt2 2σt
Where σt2 can be solved recursively. The estimates obtained by maximizing the prior likelihood
function are called the conditional maximum likelihood estimates under normality.

Maximizing the conditional likelihood is equivalent to maximizing its logarithm and hence the condi-
tional log likelihood function is given by:

22
PT 1 1 2 1 a2t
l(am+1 , ..., aT |α, a1 , ..., am ) = t=m+1 [− ln(2π) − ln(σt ) − ]
2 2 2 σt2
Where σt2 = α0 + α1 a2t−1 + α2 a2t−2 + ... + αm a2t−m can be evaluated recursively.

The maximization of the log likelihood function with respect to α is a non-linear optimization problem,
which can be solved numerically.

The score algorithm is used empirically in ARCH models. In order to implement this approach
the first and second derivatives of the conditional likelihood with respect to the parameters need to
be formed.

3.11 Model Checking


For a properly specified ARCH model the standardized residuals:
at
a˜t = form a sequence of iid random variables.
σt
Therefore one can check the adequacy of a fitted ARCH model by examining the series a˜t . In partic-
ular the Ljung-Box statistics of a˜t can be used to check the adequacy of the mean equation and that
of a˜2t can be used to test the validity of the volatility equation.

The skewness, kurtosis and acf plot of a˜t can be used to check the validity of the distribution as-
sumptions.

3.12 ARCH IN R
We will first begin by demonstrating the Model Building process discussed above with two sets of data.

Step 1: Specifying mean equation

library(forecast)#loading the required package

Attaching package: ?forecast?

The following object is masked from ?package:nlme?:

getResponse

#Getting the optimal model


auto.arima(continuousreturns)
Series: continuousreturns
ARIMA(0,0,1) with zero mean

Coefficients:
ma1
0.1526
s.e. 0.0649

sigma^2 estimated as 0.001144: log likelihood=488.49


AIC=-972.99 AICc=-972.94 BIC=-965.96

23
From the R output above we can deduce that the optima model for the MSFT data is an MA of order 1.

Step 2: Testing for ARCH Effects

We shall illustrate how to test for the ARCH effects using the two tests discussed above.

#fitting the mean equation


model5<-arima(continuousreturns,order=c(0,0,1))
#Obtaining the residuals
residualss<-model5$residuals
#Obtaining the squared residuals
squaredresi<-(residualss)^2
#The Ljung-Box statistics
Box.test(squaredresi,lag=1,type=c("Ljung-Box"))

Box-Ljung test

data: squaredresi
X-squared = 0.00087858, df = 1, p-value = 0.9764
#Lagrange multiplier
library(FinTS)
Loading required package: zoo

Attaching package: ?zoo?

The following object is masked from ?package:timeSeries?:

time<-

The following objects are masked from ?package:base?:

as.Date, as.Date.numeric

Attaching package: ?FinTS?

The following object is masked from ?package:forecast?:

Acf

ArchTest(squaredresi)

ARCH LM-test; Null hypothesis: no ARCH effects

data: squaredresi
Chi-squared = 0.85245, df = 12, p-value = 1
Discussions

From the above R-output it is evident that both the Ljung-Box statistic and the Lagrange multi-
plier give the same conclusion that is since the p-value of both tests are greater that alpha =0.05 we
fail to reject the null hypothesis and conclude that there are no ARCH effects present and thus we
can not proceed and model volatility.

24
We now turn to a data that has ARCH effects present.

Example 2

library(evir)

Attaching package: ?evir?

The following object is masked from ?package:extRemes?:

decluster

The following objects are masked from ?package:fExtremes?:

dgev, dgpd, pgev, pgpd, qgev, qgpd, rgev, rgpd

data(siemens)
#Identifying the optimal mean equation
library(forecast)
auto.arima(siemens)
Series: siemens
ARIMA(2,0,2) with zero mean

Coefficients:
ar1 ar2 ma1 ma2
0.2302 0.6445 -0.1680 -0.6680
s.e. 0.0984 0.0845 0.0942 0.0776

sigma^2 estimated as 0.0001291: log likelihood=18800.55


AIC=-37591.09 AICc=-37591.08 BIC=-37557.47

#Fitting the model


model6<-arima(siemens,order=c(2,0,2))
#Extracting the residuals
resi<-model6$residuals
#The Squared residuals
squareresi<-(resi)^2
#Testing for ARCH effects using both Ljung-Box Statistic and Lagrange Multiplier
Box.test(squareresi,lag=1,type=c("Ljung-Box"))

Box-Ljung test

data: squareresi
X-squared = 156.76, df = 1, p-value < 2.2e-16

library(FinTS)
ArchTest(squareresi)

ARCH LM-test; Null hypothesis: no ARCH effects

data: squareresi

25
Chi-squared = 30.914, df = 12, p-value = 0.00203
Discussion
From the R-output of example two both the lagrange multiplier and the Ljung-Box statistic give a
conclusion that there are ARCH effects present and thus we can go ahead and model volatility using
the ARCH model discussed earlier.

Once the ARCH effects are found to be present one can use the pacf of the squared residuals to
determine the order of the ARCH model.

From the pacf plot above we can fit an ARCH model of order 5 as follows:

library(fGarch)
model7<-garchFit(~1+garch(5,0),trace=F,data=resi)
summary(model7)

Title:
GARCH Modelling

Call:
garchFit(formula = ~1 + garch(5, 0), data = resi, trace = F)

Mean and Variance Equation:


data ~ 1 + garch(5, 0)
<environment: 0x000000001e85f798>
[data = resi]

Conditional Distribution:
norm

Coefficient(s):
mu omega alpha1 alpha2 alpha3 alpha4
7.6107e-05 5.5851e-05 1.2490e-01 8.1676e-02 1.6696e-01 1.2233e-01

26
alpha5
1.0813e-01

Std. Errors:
based on Hessian

Error Analysis:
Estimate Std. Error t value Pr(>|t|)
mu 7.611e-05 1.232e-04 0.618 0.537
omega 5.585e-05 2.448e-06 22.816 < 2e-16 ***
alpha1 1.249e-01 1.626e-02 7.679 1.60e-14 ***
alpha2 8.168e-02 1.455e-02 5.613 1.99e-08 ***
alpha3 1.670e-01 1.853e-02 9.012 < 2e-16 ***
alpha4 1.223e-01 1.938e-02 6.312 2.75e-10 ***
alpha5 1.081e-01 1.738e-02 6.221 4.93e-10 ***
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Log Likelihood:
19260.39 normalized: 3.133808

Description:
Tue May 16 08:53:05 2017

Standardised Residuals Tests:


Statistic p-Value
Jarque-Bera Test R Chi^2 8434.383 0
Shapiro-Wilk Test R W NA NA
Ljung-Box Test R Q(10) 12.53903 0.2505987
Ljung-Box Test R Q(15) 15.74907 0.3989221
Ljung-Box Test R Q(20) 26.07532 0.1633387
Ljung-Box Test R^2 Q(10) 11.5332 0.3175114
Ljung-Box Test R^2 Q(15) 26.14071 0.03656946
Ljung-Box Test R^2 Q(20) 34.99759 0.02011711
LM Arch Test R TR^2 13.12981 0.3596765

Information Criterion Statistics:


AIC BIC SIC HQIC
-6.265339 -6.257681 -6.265342 -6.262683

Discussion

From the Output above the Lagrange Multiplier has a p-value of 0.3596765 which is greater than
0.05 and we conclude that the mean equation we fitted for the data is significant. From the LM test
we also deduce that there are no ARCH effects present after fitting a ARCH(5) model.

3.13 Weaknesses of the ARCH Model


1. The model assumes that positive and negative shocks have the same effect on volatility because
it depends on the square of the previous shocks. In practice it is well known that price of a
financial asset respond differently to positive and negative shocks.

27
2. The ARCH model is rather restrictive example α12 of an ARCH(1) model must be in the interval
1
[0, ] if the series has a finite fourth moment. The constraint becomes complicated for higher
3
order ARCH models. In practice it limits the ability of ARCH models with Gaussian innovation
to capture excess kurtosis.

3. The ARCH model does not provide any new insight for understanding the source of variations
of a financial time series. It merely provides a mechanical way to describe the behaviour of the
conditional variance. It gives no indication about causes such behaviour to occur.

4. ARCH models are likely to over predict the volatility because they respond slowly to large
isolated shocks to the return series.

3.14 The GARCH Model


Although the ARCH del is simple it often requires many parameters to adequately describe the volatil-
ity process of an asset return.

For a log return series rt , let at = rt − µt be the innovation at time t. Then at follows a GARCH(m,s)
model if:

m
X s
X
at = σt t , σt2 = α0 + αi a2t−i + σj2 (16)
i=1 j=1

Where t is a sequence of iid random variables with mean 0 and variance 1,α0 > 0,αi ≥ 0,βj ≥ 0 and
Pmax(m,s)
i=1 (αi + βi ) < 1.The latter condition of αi + βi implies that the unconditional variance of at is
finite whereas its conditional variance a2t evolves over time.

As before t is often assumed to be standard normal or standardized student t distribution or Gener-


alized Error Distribution.

Equation 9 reduces to a pure ARCH(m) model if s=0.The αi and βi are referred to as ARCH and
GARCH parameter respectively.

3.15 Properties of GARCH


Let ηt = a2t − σt2 note σt−i − ηt−i , (i = 0, 1, ..., s) Using equation 9 we can rewrite GARCH model as:

max(m,s) s
X X
a2t = α0 + (αi + βi )a2t−i + ηt − βj ηt−j (17)
i=1 j=1

It is clear that ηt is a martingale difference series i.e E(ηt ) = 0 and Cov(ηt , ηt−j ) = 0.

However ηt in general is not an iid sequence. Equation 10 is an ARMA form for the squared se-
ries a2t therefore a GARCH model can be regarded as an application of the ARMA idea to the squared
series a2t .

Using the unconditional mean of an ARMA model we have:


α0
E(a2t ) = Pmax(m,s) , provided the denominator is positive.
1− i=1 (αi + βi )
Consider a GARCH(1,1) model:

28
σt2 = α0 + α1 a2t + β1 σt−1
2
, 0 ≤ α1 , β1 ≤ 1, (α1 + β1 ) < 1 (18)
Consider a GARCH(1,1) model:

at = σt t σt2 = α0 + α1 a2t−1 + β1 σt−1


2 , 0 ≤ α , β ≤ 1, (α + β ) < 1 A large a2
1 1 1 1
2
t−1 or σt−1 gives
2 2 2
rise to a large σt . This means that a large σt−1 tends to be followed by another large σt , generating
the well known behaviour of volatility clustering in financial time series.

It can be shown that if 1 − 2α12 − (α1 + β1 )2 > 0 then:

E(a4t ) 3[1 − (α1 + β1 )2 ]


= >3
(E[a2t ])2 1 − 2α12 − (α1 + β1 )2
Consequently similar to ARCH model, the tail distribution of GARCH(1,1) process is heavier than
that of a normal distribution.

A GARCH model provides a simple parametric function that can be used to describe the volatil-
ity equation.

3.16 GARCH IN R
We are using the preceding data we have been using to fit a GARCH(1,1) model.

Title:
GARCH Modelling

Call:
garchFit(formula = ~garch(1, 1), data = resi, trace = F)

Mean and Variance Equation:


data ~ garch(1, 1)
<environment: 0x00000000147c47f8>
[data = resi]

Conditional Distribution:
norm

Coefficient(s):
mu omega alpha1 beta1
3.1931e-05 1.0851e-06 4.6369e-02 9.4617e-01

Std. Errors:
based on Hessian

Error Analysis:
Estimate Std. Error t value Pr(>|t|)
mu 3.193e-05 1.202e-04 0.266 0.79
omega 1.085e-06 2.618e-07 4.146 3.39e-05 ***
alpha1 4.637e-02 6.337e-03 7.318 2.53e-13 ***
beta1 9.462e-01 7.476e-03 126.564 < 2e-16 ***
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

29
Log Likelihood:
19402.17 normalized: 3.156877

Description:
Wed May 24 13:52:17 2017

Standardised Residuals Tests:


Statistic p-Value
Jarque-Bera Test R Chi^2 13933.62 0
Shapiro-Wilk Test R W NA NA
Ljung-Box Test R Q(10) 11.88382 0.2929072
Ljung-Box Test R Q(15) 15.07524 0.4460111
Ljung-Box Test R Q(20) 22.87492 0.294978
Ljung-Box Test R^2 Q(10) 3.174946 0.9770019
Ljung-Box Test R^2 Q(15) 5.970364 0.9802413
Ljung-Box Test R^2 Q(20) 8.361715 0.9891912
LM Arch Test R TR^2 5.191153 0.9512875

Information Criterion Statistics:


AIC BIC SIC HQIC
-6.312453 -6.308077 -6.312453 -6.310935

From the output above it is very clear that the mean equation fits the data well and there no ARCH
effects present after fitting a GARCH(1,1) model.

3.17 Integrated GARCH Model(IGARCH)


If the AR polynomial of the GARCH representation in equation 10 has a unit root then we have an
IGARCH Model. Therefore an IGARCH model are unit root GARCH Models.

Similar to ARMA models a key feature of IGARCH models is that the impact of past squared shocks
ηt−i = a2t−i − σt−i 62 is persistent.

An IGARCH(1,1) model can be written as:

at = σt t σt2 = α0 + β1 σt−1
2
+ (1 − β1 )a2t−1 (19)
Where t is defined as before and 0 < β1 < 1

3.18 ASSIGNMENT
Discuss the GARCH in mean model and EGARCH under the following guidelines:
1. Introduction
2. The model
3. Properties of the model
4. Estimation in R
5. Examples with Interpretation.

30
3.19 References
1. An Introduction to Analysis of Financial Data with R Ruey S. Tsay

31

You might also like