Financial Time Series Notes
Financial Time Series Notes
MANAGEMENT
Mr. Mutua
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:
Pt
rt = ln(1 + Rt ) = ln( ) (3)
Pt−1
1.2 Returns in R
Using the data called MSFT in R we illustrate how to perform returns in R.
3
Task
Discuss the features of the above plots.
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 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:
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).
7
2 ARIMA Models
2.1 Autoregressive Model (AR Model)
It is defined as follows:
An AR model is simply a linear regression of the current value of the series against one or more
prior values of the series.
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
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
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.
9
For a negative φ1 , the plot consists of two alternating exponential decays with rate φ21 .
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.
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
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
12
acf(continuousreturns)
pacf(continuousreturns)
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
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.
Xt = µ + At − θAt−1 (7)
Taking the expectation of the model we have E(Xt ) = µ which is time invariant.
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):
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
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;
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.
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:
Xt = φ1 Xt−1 + At − φ1 At−1 and taking the variance of the prior equation we have.
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:
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 .
γ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.
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. 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
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.
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.
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:
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 .
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.
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
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.
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.
2. The dependence of at can be described by a simple quadratic function of its lagged values.
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.
at = σt et
1. Unconditional mean of at
2. Unconditional Variance
V ar(at ) = E(a2t )
21
= E[E(a2t |Ft−1 )]
= E[α0 + α1 a2t−1 ]
= α0 + α1 E(a2t−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
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 .
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.
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.
getResponse
Coefficients:
ma1
0.1526
s.e. 0.0649
23
From the R output above we can deduce that the optima model for the MSFT data is an MA of order 1.
We shall illustrate how to test for the ARCH effects using the two tests discussed above.
Box-Ljung test
data: squaredresi
X-squared = 0.00087858, df = 1, p-value = 0.9764
#Lagrange multiplier
library(FinTS)
Loading required package: zoo
time<-
as.Date, as.Date.numeric
Acf
ArchTest(squaredresi)
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)
decluster
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
Box-Ljung test
data: squareresi
X-squared = 156.76, df = 1, p-value < 2.2e-16
library(FinTS)
ArchTest(squareresi)
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)
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
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.
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.
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.
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.
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 .
28
σt2 = α0 + α1 a2t + β1 σt−1
2
, 0 ≤ α1 , β1 ≤ 1, (α1 + β1 ) < 1 (18)
Consider a GARCH(1,1) model:
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)
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
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.
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.
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