Time Series Analysis
Time Series Analysis
Introduction
STEP 1: Unit Root Tests
STEP 2: Estimate the Multivariate VECM Model
STEP 2.1: Select the Optimum Lag Length
STEP 2.2: Johansen Co-integration Test
STEP 2.3: VECM Model
STEP 2.4: Granger causality test
STEP 2.5: Variance decomposition (VDC)
STEP 2.6: Impulse response functions (IRFs)
Prof.Dr.Nabeel Aljanabi
University of Al-Qadisiyah -Iraq
1
Introduction
This workshop explains the steps to carry out Unit Root tests, Johansen co-integration test,
Granger Causality, variance decomposition and Impulse response functions.
This example analyzes the importance of the monetary policy and its transmission mechanism in
the fast-growing Bahrain economy. The monetary model is:
M3 = f(Y, R, P) (1)
where M2 is money supply; Y is oil production index, R is Interest Rate, and P is Consumer
Price Index (CPI).
Year M3 R P Y
1980M1 26281.8 3.49 46.1 12.54
1980M2 27301 3.59 46.21 12.61
1980M3 27926 3.66 46.28 13.22
1980M4 28721.9 3.75 46.13 13.56
1980M5 29483 4.1 46.49 13.72
1980M6 30130 4.17 46.86 12.93
1980M7 30747.6 4.14 47.36 14.06
1980M8 31157.6 4.14 47.78 13.29
1980M9 30864 4.26 47.62 13.95
1980M10 31272.7 4.33 47.89 13.83
1980M11 31906.4 4.47 48.54 13.56
1980M12 32687.6 4.46 48.94 13.39
1981M1 34458.1 4.42 49.78 13.06
: : : : :
: : : : :
: : : : :
2008M9 912780 3.56 114.73 105.04
2008M10 900443 3.55 114.23 104.35
2008M11 909231 3.38 112.93 100.38
2008M12 931656 3.02 111.83 95.92
2
1. Open E-view 9 – File – New -- Work file
2. Choose the frequency as Monthly – from 1980 M1 to 2008 M12 and then Click “OK”
3
Place your cursor to the left of the first row (obs)
4
5. Paste the data to E-view worksheet
6. Transform the variables into logarithm from [Type the following generate (genr)
command]:
5
genr lm3 = log(m3)
genr lp = log(p)
genr lr = log(r)
genr ly = log(y)
7. Checking for Unit Root – For example: lm3. Double click on “lm3”, click “View” and
choose the Unit Root Test.
6
8. We can choose Augmented Dickey Fuller (ADF) test and the optimal lag length is
selected by Akaike Information Criteria (large sample size).
i) First, we perform the unit root test of “lm3”: level model with constant but
without trend model (let say the maximum lag is 16) .
ii) Second, we perform the Unit root test again for the level model but now with
constant with trend model.
7
t-Statistic Prob.*
t-Statistic Prob.*
8
Lag Length: 14 (Automatic based on AIC, MAXLAG=16)
t-Statistic Prob.*
t-Statistic Prob.*
E-views Output:
9
Adj. t-Stat Prob.*
10
LM3 -1.1667 -1.5593 -2.4695 -1.0419
(16) (15) [9] [9]
LP
LR
LY
First Difference
LM3 -2.866** -3.0513 -16.6246*** -16.7362***
(14) (15) [9] [8]
LP
LR
LY
Note: *** and ** denotes significant at 1%, and 5% significance level, respectively. The figure in
parenthesis (…) represents optimum lag length selected based on Akaike Info Critirion. The figure in
bracket […] represents the Bandwidth used in the KPSS test selected based on Newey-West
Bandwidth critirion.
10. After testing the variables are stationary at first order or I(1), then the step is to estimate
the Vector Error-correction Model (VECM). Firstly, we need to select an optimum lag of
VECM model before performing the Johansen cointegration test.
11
Then click “Quick” – “Estimate VAR” – “Vector Error Correction”
12
11. From equation (1), the VECM model can be written as:
(2)
(3)
(4)
(5)
13
STEP 2.1: Select the Optimum Lag Length
LM3 LY LR LP
Change 2 to 1
(b) Make residuals for the VECM models, click “Proc” – “Make Residuals”
EViews will show 4 residuals in the EViews Workfile – resid01 (residual in Equation 1),
resid02 (residual in Equation 2), resid03 (residual in Equation 3), and resid04 (residual in
Equation 4).
14
(c) Now, the autocorrelation of the error terms in each regression is checked by using the
Ljung-Box Q-statistic.
15
E-Views Output:
The Q-statistic shows that the error terms are statistically significant from lag 12 for
“resid01”. This indicates that the model with lag 1 has autocorrelation problem. Hence,
we need to re-estimate the VECM model by increasing one lag (repeat the same process
but now with lag 2).
This process will continue until each of the regression error terms is free from
autocorrelation problem (where the p-values of Q-statistic are greater than 0.05).
In this case, we repeat the same process and the optimum lag is 12.
16
12. The E-Views output with 12 lag is as follows:
Long-run
Equation
Error
correction
terms
(ECT)
13. After obtaining the optimum lag, the next step is to estimate the Johansen Co-integration
Test. Click “View” – “Co-integration Test” – “OK”.
17
0.05 represent 5%
significance level.
E-Views Output:
18
Max-eigenvalue test indicates 1 co-integrating eqn(s) at the 0.05 level
* denotes rejection of the hypothesis at the 0.05 level
**MacKinnon-Haug-Michelis (1999) p-values
Table 2 presents the Johansen-Juselius Co-integration test. The result shows that both
Trace test and Max-Eigen test are statistically significant to reject the null hypothesis of r
= 0 at 5% significance level. Therefore, only one long run co-integration relationship
between M3 and it determinants.
If the model contains co-integration relationship among the variables, then we can
proceed to VECM and the long run equation is:
19
STEP 2.4: Granger causality test
14. After estimating the long-run VECM model, then we proceed to the short run Granger
causality test. Click “View” – “Lag Structure” – “Granger Causality/Block Exogeneity
Tests”.
E-Views Output:
20
Dependent variable: D(LP)
With Co-integration, the dynamic causal interactions among the variables should be
phrased in a vector error correction form. This allows us to assess both long-run and
short-run causality, respectively, on the 2 -test of the lagged first differenced terms for
each right-hand-side variable and the t-test of the error correction term. The results of the
test are presented in Table 3.
21
Table 3: Granger Causality Results based on VECM
Independent Variables
Dependent 2 -statistics of lagged 1st differenced term ECTt-1
coefficient
[p-value]
Variable ΔLM3 ΔLP ΔLR ΔLY (t-ratio)
ΔLM3 30.23*** 14.72 21.51** -0.028**
-- [0.003] [0.257] [0.043] (-3.533)
LM3 LP
LY LR
22
STEP 2.5: Variance decomposition (VDC)
15. The result of VECM indicates the erogeneity or endogeneity of a variable in the system
and the direction of Granger-causality within the sample period. However, it does not
provide us with the dynamic properties of the system. The analysis of the dynamic
interactions among the variables in the post-sample period is conducted through variance
decompositions (VDCs) and impulse response functions (IRFs).
E-Views Output:
Variance Decomposition of
LM3:
Period S.E. LM3 LP LR LY
23
1 0.003904 0.057833 99.94217 0.000000 0.000000
2 0.006102 0.232518 99.30812 0.034317 0.425045
3 0.007787 0.493569 99.04644 0.076551 0.383441
4 0.009032 0.723986 98.88313 0.067843 0.325045
5 0.010067 1.013711 98.49578 0.206479 0.284028
6 0.010816 2.379293 96.86372 0.504991 0.251992
7 0.011544 4.710690 94.19444 0.867165 0.227708
8 0.012314 6.518148 91.82371 1.438480 0.219661
9 0.012968 7.566270 90.49069 1.743578 0.199466
10 0.013545 8.302143 89.10389 2.390148 0.203815
24
STEP 2.6: Impulse response functions (IRFs)
16. Estimate the impulse response functions (IRFs), click “Estimate” and change the “Vector
Error Correction” to “Unrestricted VAR” and increase one more lag for the model from
lag 12 to lag 13.
Select “Impulse”
25
Response to Cholesky One S.D. Innovations ± 2 S.E.
Response of LM3 to LM3 Response of LM3 to LP Response of LM3 to LR Response of LM3 to LY
.015 .015 .015 .015
26