Professional Documents
Culture Documents
Time Series Analysis Exercises: Universität Potsdam
Time Series Analysis Exercises: Universität Potsdam
Potsdam 2005
1
I Typical exercises and solutions
a. Yt = Yt-1 + at
2
Answer:
3
2 The variable l (=labour) in the file employees.dat denotes the quantity of labour
force, i. e. the number of employees, in a big German company from January 1995
till December 2004.
ii. What are the characteristics of a stationary time series? Is the time series lt likely
to be stationary? Check it first by the naked eye.
iv. Estimate the correlation and the partial correlation function of the process. Give
a description and an interpretation.
v. What type of basic model could fit the time series lt. Why?
4
ix. A particular analysis method of time series lt results in the following graph.
1.6
Bartlett
1.4
1.2
Tukey
1.0
0.8
Parzen
0.6
0 1 2 3 4
Circular frequency
What is the name of this particular analysis method? What can you derive from the curve.
What should be the typical shape of the function estimated for a process type assumed in
question v?
5
Answers:
6000
5600
5200
4800
4400
4000
95 96 97 98 99 00 01 02 03 04
ii. The main characteristics of a stationary time series are that the mean µ t and the variance
of the stochastic process generating this special time series are independent from time t,
µ t = µ = const
σ t2 = σ 2 = const,
γ t , t = γ t - t = γ τ with τ = t 1 – t 2 (Lag)
1 2 1 2
A check of the graph by the naked eye gives no reason to assume the time series not to be
stationary. At the first glance there does not appear any trend or relevant development of the
variance.
6
iii. Test of stationarity by DF Test.
The following Dickey Fuller regression of ∆l on lt-1 produces a t-value – 3,63. Application of
an augmented Dickey-Fuller regression is not necessary because the augmented model would
have higher values of the Schwarz criterion (SIC, version on the base of the error variance).
Table 1:
Dickey-Fuller Test Equation
Dependent Variable: ∆lt
Method: Least Squares
Sample (adjusted): 1995M02 2004M12; observations: 119
The critical value of the t-statistic for a model with intercept c is -2,89 on the 5 % level:
Table 2:
Null Hypothesis: l has a unit root
Exogenous: Constant
Lag Length: 0 (Automatic based on SIC, MAXLAG=12)
t-Statistic
The t-value measured exceeds the critical value downwards. That means that the null hypothesis
of nonstationarity or a unit root can be rejected on the 5 % level. The time series is stationary at
least with a probability of 95 %. As lt is stationary its degree of integration is 0 ( I(0)).
7
iv. Sample correlation and partial correlation functions of the process.
The sample autocorrelation function (AC) for a short series can be calculated using the formulae
for the sample autocovariance (9.7)
T −τ
∑ ( xt − x )( xt +τ − x )
cτ = t =1
T − τ
The partial sample autocorrelation function (PAC) can be obtained by linear OLS regression of xt
on xt-1, xt-2,…, xt-τ corresponding to formula (9.9):
The partial correlation coefficient ρpart(τ) is the coefficient φττ of the highest order lagged variable
xt-τ.
By calculating the first 5 regressions this way we obtain the following highest order coefficients
for each of them, respectively:
ф11= 0,799532; ф22= -0,037588; ф33= 0,075722; ф44= 0,008910; ф55= 0,115970
We can compare these „manually“ calculated coefficient with the partial autocorrelation
functions displayed in the following table and figure together with the sample autocorrelation
function delivered as a whole in one step by eViews. The differences between the regression
results and the eViews output probably are caused by different estimation methods.
8
Table 3:
Correlogram
1,2
1
0,8
0,6
AC
0,4
PAC
0,2
0
-0,2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
-0,4
Fig. 3: Correlogram
The bold curve shows the sample autocorrelation function. The thin one displays the partial
autocorrelation, both depending on the lag τ. While the smooth autocorrelation continuously
decreases from 1 towards zero and below to a limit of about 0,1 the partial autocorrelation starts
as well at the value 1 and has the same value as the autocorrelation for τ=1 but then drops down
to zero and remains there oscillating between -0,1 and 0,1.
9
v. Possible type of basic model fitting the time series l.
The basic model could be a first order autoregressive process , because AC is exponentially
decreasing and PAC is dropping down after τ=1. The shape of the AC is typical for the
autocorrelation of an AR process with positive coefficients. The partial autocorrelation drops
down to and remains close to zero after the lag τ=1 what indicates an AR(1) process.
Table 4:
Dependent Variable: lt
Method: Least Squares
Sample 1995M02 2004M12, observations: 119
Because the t-statistic of both exceeds the 5-% critical value 1,96, both coefficients are
significant on this level, at least. The prob. values behind indicate that the even are on the 1 %
level.
10
Another way of estimation is to take advantage of the special ARMA estimation procedure of
eViews. Here first the mean of the variable is estimated and then the AR(1) coefficient of an AR
model of the deviations from the mean:
Table 5:
Dependent Variable: l
Method: Least Squares
Sample: 1995M02 2004M12; observations: 119
Convergence achieved after 3 iterations
11
vii. As an alternative, an ARMA(2,1) model would fit the data. It can be found by trial and
error via several different models and the aim of obtaining significant coefficients and
compared by Schwarz criterion.
As the model contains an MA term ordinary least squares is not practicable for estimating the
coefficients. Therefore again the iterative nonlinear least squares procedure by eViews is used:
Table 6:
Dependent Variable: l
Method: Least Squares
Sample 1995M03 2004M12; observations: 118
Convergence achieved after 7 iterations
Backcast: 1994M12
Again here is to be considered that the “constant” is the mean and the coefficients belong to a
model of derivations from it.
Thus the ARMA(2,1) model is to be written:
(lt - 5469,2) = 0,6002 ( lt-2 - 5469.5) + 0,8563 at + at
In order to have the model in the explicit form, the mean is subtracted:
lt = 5469,2 + 0,6002 ( lt-2 - 5469.2) + 0,8563 at + at
= 5469,2 - 5469.2 × 0,6002 .+ 0,6002 lt-2 + 0,8563 at + at
and at last
lt = 2186,6 .+ 0,6002 lt-2 + 0,8563 at + at
This model does not show an improvement compared by Akaike and Schwarz criteria with the
AR(1) estimated earlier. It has slightly higher values. EViews provides these criteria on the base
of the error variance which is to be minimised (in contrast to those on likelihood base such as in
Microfit that are to be maximised).
12
viii. Forecast of the number of employees for 2005:
give us the advantage of easily forecasting the process in the long run because the stochastic
limes for time tending to infinity is given by what we called the means 5469,5 and 5469,2,
respectively:
13
5800
5700
5600
5500
5400
5300
5200
5100
5000
2004M01 2004M07 2005M01 2005M07
Fig. 4: Forecast
Basically, the main peaks of spectral density occur at the circular frequencies
ω1= 0,71 ω2 = 1,86.
These correspond to frequencies
f1 = 0,114 f2 = 0,295
and to periods of average length
p1 = 8,8 p2 = 3,4 month, respectively.
But these periodicities are not of any practical importance. They superimpose to the point of
being unrecognizable. They are not visible in the original time series and the correlogram. Taking
standard errors of the spectral estimates into consideration, peaks and troughs of the spectral
density curve does not significantly differ.
The typical shape of the spectral density function for an AR(1) process is similar to the
following
14
Estimates of spectral density of an AR(1) process
8
Bartlett
4
Tukey
Parzen
0
0 1 2 3 4
Circular frequency
In case of an additional seasonal component the spectral density would show a peak over the
frequency f = 1/12 or the circular frequency ω = 2π/12 = 0,52.
15
3 The file dax_j95_a04.txt contains the daily closing data of the main German stock
price index DAX from January 1995 by August 2004, i.e. 2498 values.
iii. Generate the series of the growth rate or rate of return r in the direct way and in
the logarithmic way. Display both graphs of r.
iv. Compare the r data. Characterize the general patterns of both graphs of r
vi. Estimate the correlation function and the partial correlation function till a lag of
20. Characterize generally the extent of correlation in this series.
vii. Estimate an AR(8) model to r that contains only coefficients significant at least on
the five percent level
ix. Test the residuals of this model for autoregressive conditional heteroscedasticity
by a rough elementary procedure
xi. Estimate an ARCH(1) model on the base of the ARIMA(8,d,8) model estimated in
viii. You can change the ARMA part in order to keep only coefficients significant
on the one percent level.
xii. Estimate a GARCH(1,1) model on the base of the simple model r=const.
16
Answers:
9000
8000
7000
6000
5000
4000
3000
2000
1000
0
500 1000 1500 2000
DAX
17
ii. The order of integration of dax.
For testing whether or not dax is stationary first the original date are tested by the Dickey-Fuller
test of the levels. The following table shows the estimation of the coefficient of the Dickey-
Fuller Test regression of ∆daxt on daxt-1 :
Table 7:
Dickey-Fuller Test Equation
Dependent Variable: ∆daxt
Method: Least Squares
Sample (adjusted): 2 2498; observations: 2497
The t-value of the slope coefficient is -1.580936. As the following table demonstrates it is not
less than the 5%-critical t-value for a model with a constant, i.e. -2.862497.
Table 8:
Null Hypothesis: DAX has a unit root
Exogenous: Constant
Lag Length: 0 (Automatic based on SIC, MAXLAG=26)
t-Statistic Prob.*
That means that dax is on the 5% level not stationary. The next step is to check the first
differences of dax in the same way.
18
The Dickey-Fuller test equation of the first differences is a regression of the second differences
∆2daxt on the lagged first differences ∆daxt-1 .
Table 9:
Augmented Dickey-Fuller Test Equation
Dependent Variable: D(DAX,2) = ∆2daxt
Method: Least Squares
Sample: 3 2498; observations: 2496
iii. The growth rate or rate of return r can be generated as the ratio
( dax t − dax t − 1 )
rt =
dax t − 1
19
.08
.04
.00
-.04
-.08
-.12
500 1000 1500 2000
R _ R A T IO
Another way of calculating the rate of return mostly used in financial market analysis is the
logarithmic way:
rt = ln dax t − ln dax t −1
The next figure shows the graph of this logarithmically generated rate of return r.
.08
.04
.00
-.04
-.08
-.12
500 1000 1500 2000
R _ LO G
20
iv. Both curves are very similar to each other and can hardly be distinguished by the naked
eye. An enlarged display of the differences as shown in the next figure demonstrates that
the ratio always slightly exceeds the logarithmic approximation. In the following analysis
the latter will be used.
.005
.004
.003
.002
.001
.000
500 1000 1500 2000
D IF F _ R
Fig. 9: Graph of the differences between both ways of calculating return rates
Both graphs of r show certain common general patterns. These are significant clusters of high
variability or volatility separated by quieter periods. This changing behaviour of variance is
typical for ARCH or GARCH processes.
Particularly for later fitting an ARCH or GARCH model, the time series should be stationary.
The following Dickey Fuller Regression of ∆rt on rt-1 produces a negative t-value of -50.377
that lies below of all possible critical values: The return rate r proves stationary.
21
Table 10:
Dickey-Fuller Test Equation
Dependent Variable: ∆rt
Method: Least Squares
Sample (adjusted): 3 2498; observations: 2496
Correlogram
1,2
0,8
0,6 AC
0,4 PAC
0,2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
-0,2
22
Table 11:
vii. Example: AR(8) model coefficients significant on the five percent level.
Several trials with AR coefficient up to the order 8 finally resulted in three significant
coefficients and a missing constant. The criterion for rejecting other variants was non-
significance of coefficients.
Table 12:
Dependent Variable: r
Method: Least Squares
Sample (adjusted): 10 2498; observations: 2489
23
Thus we obtain by OLS regression the AR(8) model
We get exactly the same results, if we consider this AR model as a special case of an ARMA
model estimated by iterative nonlinear least squares
Table 13:
Dependent Variable: r
Method: Least Squares
Sample (adjusted): 10 2498; observations: 2489
Convergence achieved after 3 iterations
viii. Example: ARIMA(8,d,8) model for r that contains only coefficients significant at least on
the one percent level.
Now we try to improve the model by including a moving average term. In this case we must use
the iterative nonlinear least squares method. Now the aim is to obtain coefficients, significant on
the 1% level. Again after a series of trials with varying ARMA(8,8) models we got finally the
following results by omitting non significant coefficients:
24
Table 14:
Dependent Variable: r
Method: Least Squares
Sample (adjusted): 10 2498; observations: 2489
Convergence achieved after 15 iterations
rt = - 0.339 rt-3 - 0.614 rt-8 + et + 0.296 et-3 - 0.076 et-6 + 0.655 et-8
Now the goodness of fit of both models should be compared. Besides considering the
significance level of the coefficients in both models a powerful mean of comparison are the
Akaike and Schwarz criteria, which are to be minimised.
Here both criteria are very close to each other. But the slightly smaller (negative!) values of
both criteria in the second case give a certain preference to the ARMA model.
Because we know from v. that r is stationary, that means integrated of order 0, this model is an
ARIMA(1,0,1) for r at the same time.
25
ix. Rough and preliminary test of the residuals for autoregressive conditional
heteroscedasticity by OLS regression
A rough check for first order autoregressive conditional heteroscedasticity (ARCH(1)) is the
estimation of a regression of the squared residuals et2 on et-12 :
Table 15:
Dependent Variable: et2
Method: Least Squares
Sample (adjusted): 11 2498; observations: 2488
For testing this dependence we cannot simply use the usual t-test because the t-values estimated
do not meet an exact student distribution. Anyway, because here the t-values immensely exceed
the 5-percent and 1-percent critical values, we can with great practical confidence assume, that
there exist a highly significant relationship between et2 and et-12 i.e. high conditional
heteroscedasticity.
26
.004
.003
.002
.001
.000
500 1000 1500 2000
5 -d a y m o v in g re s id u a l v a ria n c e
Fig. 11:
At the figure, you can see typical clusters of higher variance, i.e. volatility, changing with
intervals of lower variance. The similarity of neighbouring variances is one more indicator for
conditional heteroscedasticity: On the base of knowing the variance at time t (i. e. conditionally)
you can forecast the variance at time t+1.
Because of the latter analytical results it would be worthwhile to estimate an ARCH(1) model.
Then the conditional variance of the error et is
In the software used this is a special case of the more general GARCH model. An ARCH(1)
there corresponds to a GARCH(0,1) model. We assume here the time series to follow an AR(8)
process as estimated earlier without ARCH:
27
Table 16:
Dependent Variable: r
Method: ML – ARCH
Sample (adjusted): 10 2498; observations: 2489
Included after adjustments
GARCH = C(4) + C(5)*RESID(-1)^2
Variance Equation
The coefficients differ from the earlier estimated ones because here they are estimated
simultaneously with the ARCH term. The newly estimated model is:
where at should be a pure random series. The AR representation of the error process gives
the opportunity to forecast the volatility.
28
xii. GARCH(1,1) model on the base of the simple model r=const.
Here you should model the return rate as a real GARCH process.
Table 17:
Dependent Variable: r
Method: ML - ARCH (Marquardt) - Normal distribution
Sample (adjusted): 10 2498; observations: 2489
Convergence achieved after 12 iterations
GARCH = C(5) + C(6)*RESID(-1)^2 + C(7)*GARCH(-1)
Variance Equation
While in the original AR(8) model the constant could be omitted here the constant is the only
significant term in the regression part of the model. Therefore all lagged r terms can be omitted
now:
29
Table 18:
Dependent Variable: r
Method: ML – ARCH
Sample (adjusted): 2 2498; observations: 2497
Convergence achieved after 12 iterations
GARCH = C(2) + C(3)*RESID(-1)^2 + C(4)*GARCH(-1)
Variance Equation
The model proves very simple: DAX return equals the constant 0,00066 (i.e. 0,06 % per day on
an average) with sort of an ARMA(1,1) conditional variance that describes the development of
volatility or risk:
2
with ht being the conditional variance of rt on base of the information by time t, and et being
the deviation of r from its mean in this model.
In the meaning of Akaike and Schwarz criteria, the model fits better than all considered before:
The values of these criteria are the lower ones despite the model is extremely simple. The model
shows that conditional variance as a measure of volatility and investment risk is highly
determined by the variance of the last day, i.e. rather by the more theoretical conditional variance
ht-12 than by the directly measurable deviation et-1.
30