Modeling non-stationary time series

Universidad Privada Boliviana / Universidad del Pacífico (Lima, Perú)

Author

Prof. J. Dávalos (Ph.D.)

SVAR and VECM


Stata application

  • Let’s assume that :
  • Investment shocks affects GDP growth only.
  • Consumption may increase given investment and gdp growth.
  • This is a recursive structure that must be reflected in the B matrix.

  • The macro data
use http://fmwww.bc.edu/cfb/stata/DelivS4/usmacro1.dta, clear
gen date = tq(1959q1) +_n-1
format %tq date
tsset date
Running /Users/jdavalos/Documents/Stata/ado/personal/profi> do ...






Time variable: date, 1959q1 to 2010q3
        Delta: 1 quarter

The order matters

  • Structural VAR constraints i.e. structure must be chosen
  • In STATA the matrix of contemporaneous relationships between endogenous variables is noted A while the matrix of residual shocks relationships is B.
  • We must impose the identity matrix and the lower triangular for either matrix (A or B). The OIRF does this by default, however the order matters…

  • \[\begin{eqnarray} \varepsilon_1 &=& b_{11} u_1 \\ \varepsilon_2 &=& b_{21} u_1 + b_{22} u_2 \\ \varepsilon_3 &=& b_{31} u_1 + b_{32} u_2 + b_{33} u_3 \end{eqnarray}\]

  • Shocks on the first innovation affect all outcomes. Shocks on the last one only affect the last outcome. The order matters.


  • \(B = I\) structure and \(A\) lower triangular :
* Lower triangular
matrix A1 = (1,0,0 \ .,1,0 \ .,.,1)

* Identity structure, frees the estimation of diagonal terms
matrix B1 = (.,0,0 \ 0,.,0 \ 0,0,.)

matlist A1
matlist B1
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...

             |        c1         c2         c3 
-------------+---------------------------------
          r1 |         1          0          0 
          r2 |         .          1          0 
          r3 |         .          .          1 

             |        c1         c2         c3 
-------------+---------------------------------
          r1 |         .                       
          r2 |         0          .            
          r3 |         0          0          . 

  • ORDER1:
    1. Investment
    1. GDP
    1. Consumption
matlist B1
matlist A1
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...

             |        c1         c2         c3 
-------------+---------------------------------
          r1 |         .                       
          r2 |         0          .            
          r3 |         0          0          . 

             |        c1         c2         c3 
-------------+---------------------------------
          r1 |         1          0          0 
          r2 |         .          1          0 
          r3 |         .          .          1 

  • ORDER2:
    1. GDP
    1. Consumption
    1. Investment
  • Given our A matrix, this means that gdp shocks inmediatly affect all outcomes and that Investment can only be shocked by itself.
  • This new structure implies a new \(A\) matrix or a different ordering. It is just easier to change the order than to change the matrix.

  • lags’ choice and stability
varsoc D.lrgrossinv D.lrgdp D.lrconsump ,maxlag(10)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



Lag-order selection criteria

   Sample: 1961q4 thru 2010q3                              Nu
> mber of obs = 196
  +----------------------------------------------------------
> -----------------+
  | Lag |    LL      LR      df    p     FPE       AIC      H
> QIC                                                        
>          SBIC                                              
>                  |
  |-----+----------------------------------------------------
> -----------------|
  |   0 |  1970.71                     3.8e-13  -20.0787  -20
> .0584                                                      
>        -20.0285                                            
>                  |
  |   1 |  2017.39  93.362    9  0.000 2.6e-13  -20.4632  -20
> .3819                                                      
>      *                                                     
>        -20.2625                                            
>                *                                           
>                  |
  |   2 |  2024.15  13.516    9  0.141 2.7e-13  -20.4403  -20
> .2981                                                      
>        -20.0891                                            
>                  |
  |   3 |  2031.54  14.778    9  0.097 2.7e-13  -20.4239  -20
> .2207                                                      
>        -19.9221                                            
>                  |
  |   4 |   2038.3  13.519    9  0.141 2.8e-13   -20.401  -20
> .1369                                                      
>        -19.7487                                            
>                  |
  |   5 |  2048.03  19.465    9  0.022 2.8e-13  -20.4085  -20
> .0835                                                      
>        -19.6057                                            
>                  |
  |   6 |  2062.81  29.567*   9  0.001 2.6e-13* -20.4675* -20
> .0815                                                      
>        -19.5142                                            
>                  |
  |   7 |  2065.54  5.4529    9  0.793 2.8e-13  -20.4035  -19
> .9566                                                      
>        -19.2996                                            
>                  |
  |   8 |  2073.19  15.302    9  0.083 2.8e-13  -20.3897  -19
> .8819                                                      
>        -19.1353                                            
>                  |
  |   9 |   2078.5  10.619    9  0.303 2.9e-13   -20.352  -19
> .7833                                                      
>        -18.9471                                            
>                  |
  |  10 |  2082.78  8.5505    9  0.480 3.1e-13  -20.3038  -19
> .6741                                                      
>        -18.7484                                            
>                  |
  +----------------------------------------------------------
> -----------------+
   * optimal lag
   Endogenous: D.lrgrossinv D.lrgdp D.lrconsump
    Exogenous: _cons

Order 1

  • SVAR
svar D.lrgrossinv D.lrgdp D.lrconsump   if tin(,2005q4) , lags(1/6) aeq(A1) beq(B1)
varstable  

matlist e(A)
matlist e(B)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...


Estimating short-run parameters

Iteration 0:   log likelihood = -570.00307  
Iteration 1:   log likelihood =  909.01375  
Iteration 2:   log likelihood =   1333.108  
Iteration 3:   log likelihood =  1549.5574  
Iteration 4:   log likelihood =  1734.9215  
Iteration 5:   log likelihood =   1861.614  
Iteration 6:   log likelihood =  1898.4525  
Iteration 7:   log likelihood =  1905.4639  
Iteration 8:   log likelihood =  1905.5032  
Iteration 9:   log likelihood =  1905.5033  

Structural vector autoregression

 ( 1)  [/A]1_1 = 1
 ( 2)  [/A]1_2 = 0
 ( 3)  [/A]1_3 = 0
 ( 4)  [/A]2_2 = 1
 ( 5)  [/A]2_3 = 0
 ( 6)  [/A]3_3 = 1
 ( 7)  [/B]1_2 = 0
 ( 8)  [/B]1_3 = 0
 ( 9)  [/B]2_1 = 0
 (10)  [/B]2_3 = 0
 (11)  [/B]3_1 = 0
 (12)  [/B]3_2 = 0

Sample: 1960q4 thru 2005q4                      Number of obs
>      =        181
Exactly identified model                        Log likelihoo
> d                                                          
>      =   1905.503

-------------------------------------------------------------
> -----------------
             | Coefficient  Std. err.      z    P>|z|     [95
> % con                                                      
>      f. interval]
-------------+-----------------------------------------------
> -----------------
/A           |
         1_1 |          1  (constrained)
         2_1 |  -.2868243   .0255565   -11.22   0.000    -.33
> 69142                                                      
>         -.2367345
         3_1 |  -.0629795   .0276076    -2.28   0.023    -.11
> 70894                                                      
>         -.0088696
         1_2 |          0  (constrained)
         2_2 |          1  (constrained)
         3_2 |  -.5181778   .0616576    -8.40   0.000    -.63
> 90246                                                      
>         -.3973311
         1_3 |          0  (constrained)
         2_3 |          0  (constrained)
         3_3 |          1  (constrained)
-------------+-----------------------------------------------
> -----------------
/B           |
         1_1 |   .0156998   .0008252    19.03   0.000     .01
> 40825                                                      
>          .0173171
         2_1 |          0  (constrained)
         3_1 |          0  (constrained)
         1_2 |          0  (constrained)
         2_2 |    .005398   .0002837    19.03   0.000      .0
> 04842                                                      
>          .0059541
         3_2 |          0  (constrained)
         1_3 |          0  (constrained)
         2_3 |          0  (constrained)
         3_3 |   .0044778   .0002353    19.03   0.000     .00
> 40165                                                      
>           .004939
-------------------------------------------------------------
> -----------------


   Eigenvalue stability condition
  +----------------------------------------+
  |        Eigenvalue        |   Modulus   |
  |--------------------------+-------------|
  |    .248937 +  .8044677i  |   .842103   |
  |    .248937 -  .8044677i  |   .842103   |
  |  -.8084417 +   .212449i  |    .83589   |
  |  -.8084417 -   .212449i  |    .83589   |
  |   .8230763               |   .823076   |
  |   .6688889 +  .4619981i  |    .81293   |
  |   .6688889 -  .4619981i  |    .81293   |
  |  -.5301508 +  .5674439i  |   .776564   |
  |  -.5301508 -  .5674439i  |   .776564   |
  |  -.3426573 +  .6505764i  |   .735298   |
  |  -.3426573 -  .6505764i  |   .735298   |
  |  -.6572227               |   .657223   |
  |  -.1209678 +  .6020865i  |   .614118   |
  |  -.1209678 -  .6020865i  |   .614118   |
  |   .5611682 +  .0556144i  |   .563917   |
  |   .5611682 -  .0556144i  |   .563917   |
  |   .2425612 +  .4141435i  |   .479949   |
  |   .2425612 -  .4141435i  |   .479949   |
  +----------------------------------------+
   All the eigenvalues lie inside the unit circle.
   VAR satisfies stability condition.

             | D_lrgro~v    D_lrgdp  D_lrcon~p 
-------------+---------------------------------
D_lrgrossinv |         1          0          0 
     D_lrgdp | -.2868243          1          0 
 D_lrconsump | -.0629795  -.5181778          1 

             | D_lrgro~v    D_lrgdp  D_lrcon~p 
-------------+---------------------------------
D_lrgrossinv |  .0156998                       
     D_lrgdp |         0    .005398            
 D_lrconsump |         0          0   .0044778 

irf create order1, set(SVAR1.irf) replace step(8)
irf table oirf sirf,  irf(order1) ///
  impulse(D.lrgrossinv) response(D.lrconsump)  noci stderror
irf graph sirf, impulse(D.lrgrossinv) response(D.lrconsump) irf(order1) 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...


(file SVAR1.irf now active)
(file SVAR1.irf updated)


Results from order1

--------------------------------------------------------
         |      (1)         (1)         (1)         (1)  
    Step |     oirf        S.E.        sirf        S.E.  
---------+----------------------------------------------
       0 |  .003322      .00043     .003322      .00043
       1 |  .000846     .000449     .000846     .000449
       2 |   .00084     .000457      .00084     .000457
       3 |  3.0e-06     .000462     3.0e-06     .000462
       4 |  .000355     .000455     .000355     .000455
       5 |  .000385     .000451     .000385     .000451
       6 | -.000078     .000418    -.000078     .000418
       7 | -.000038     .000309    -.000038     .000309
       8 | -3.3e-06     .000281    -3.3e-06     .000281
--------------------------------------------------------
(1) irfname = order1, impulse = D.lrgrossinv, and
    response = D.lrconsump.

irf graph sirf, impulse(D.lrgrossinv) response(D.lrconsump) irf(order1) 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...

irf table sirf oirf,  irf(order1)  noci 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



Results from order1

------------------------------------------------------
         |      (1)         (1)         (2)         (2)  
    Step |     sirf        oirf        sirf        oirf  
---------+--------------------------------------------
       0 |    .0157       .0157     .004503     .004503
       1 |  .005394     .005394      .00271      .00271
       2 |  .003948     .003948     .001625     .001625
       3 |  .000394     .000394    -.000698    -.000698
       4 |  .001814     .001814     .000782     .000782
       5 |    .0021       .0021     -.00073     -.00073
       6 |  .000348     .000348     .000626     .000626
       7 | -.000887    -.000887    -.000392    -.000392
       8 | -.000523    -.000523     -.00008     -.00008
------------------------------------------------------

------------------------------------------------------
         |      (3)         (3)         (4)         (4)  
    Step |     sirf        oirf        sirf        oirf  
---------+--------------------------------------------
       0 |  .003322     .003322           0           0
       1 |  .000846     .000846     .002041     .002041
       2 |   .00084      .00084     .001606     .001606
       3 |  3.0e-06     3.0e-06     .002243     .002243
       4 |  .000355     .000355    -.000153    -.000153
       5 |  .000385     .000385    -.001773    -.001773
       6 | -.000078    -.000078     -.00362     -.00362
       7 | -.000038    -.000038    -.000526    -.000526
       8 | -3.3e-06    -3.3e-06    -.000486    -.000486
------------------------------------------------------

------------------------------------------------------
         |      (5)         (5)         (6)         (6)  
    Step |     sirf        oirf        sirf        oirf  
---------+--------------------------------------------
       0 |  .005398     .005398     .002797     .002797
       1 |  7.1e-07     7.1e-07     .000764     .000764
       2 |  .000737     .000737     .001052     .001052
       3 |   .00079      .00079     .000152     .000152
       4 |  .000315     .000315    -.000378    -.000378
       5 | -.000498    -.000498    -.000015    -.000015
       6 | -.000852    -.000852    -.000263    -.000263
       7 |  -.00046     -.00046    -.000211    -.000211
       8 |  -.00023     -.00023      .00008      .00008
------------------------------------------------------

------------------------------------------------------
         |      (7)         (7)         (8)         (8)  
    Step |     sirf        oirf        sirf        oirf  
---------+--------------------------------------------
       0 |        0           0           0           0
       1 |  .002045     .002045     .001581     .001581
       2 |  .000677     .000677     .000736     .000736
       3 |  .002444     .002444     .001067     .001067
       4 |  .002178     .002178     .001368     .001368
       5 |  .001338     .001338     .000718     .000718
       6 |  .002245     .002245     .000392     .000392
       7 | -.000175    -.000175     .000262     .000262
       8 |  -.00007     -.00007    -.000223    -.000223
------------------------------------------------------

--------------------------------
         |      (9)         (9)  
    Step |     sirf        oirf  
---------+----------------------
       0 |  .004478     .004478
       1 | -.000085    -.000085
       2 |  .001021     .001021
       3 |  .001141     .001141
       4 |  .000331     .000331
       5 |  .000114     .000114
       6 |  .000624     .000624
       7 | -.000185    -.000185
       8 | -.000026    -.000026
--------------------------------
(1) irfname = order1, impulse = D.lrgrossinv, and
    response = D.lrgrossinv.
(2) irfname = order1, impulse = D.lrgrossinv, and
    response = D.lrgdp.
(3) irfname = order1, impulse = D.lrgrossinv, and
    response = D.lrconsump.
(4) irfname = order1, impulse = D.lrgdp, and response =
    D.lrgrossinv.
(5) irfname = order1, impulse = D.lrgdp, and response =
    D.lrgdp.
(6) irfname = order1, impulse = D.lrgdp, and response =
    D.lrconsump.
(7) irfname = order1, impulse = D.lrconsump, and response
    = D.lrgrossinv.
(8) irfname = order1, impulse = D.lrconsump, and response
    = D.lrgdp.
(9) irfname = order1, impulse = D.lrconsump, and response
    = D.lrconsump.

Order 2

svar D.lrgdp D.lrconsump D.lrgrossinv   if tin(,2005q4) , lags(1/6) aeq(A1) beq(B1)

irf create order2, set(SVAR2.irf) replace step(8)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...


Estimating short-run parameters

Iteration 0:   log likelihood = -569.96644  
Iteration 1:   log likelihood =  919.35502  
Iteration 2:   log likelihood =    1410.43  
Iteration 3:   log likelihood =   1667.579  
Iteration 4:   log likelihood =  1788.5653  
Iteration 5:   log likelihood =   1894.333  
Iteration 6:   log likelihood =  1905.0019  
Iteration 7:   log likelihood =  1905.5025  
Iteration 8:   log likelihood =  1905.5033  
Iteration 9:   log likelihood =  1905.5033  

Structural vector autoregression

 ( 1)  [/A]1_1 = 1
 ( 2)  [/A]1_2 = 0
 ( 3)  [/A]1_3 = 0
 ( 4)  [/A]2_2 = 1
 ( 5)  [/A]2_3 = 0
 ( 6)  [/A]3_3 = 1
 ( 7)  [/B]1_2 = 0
 ( 8)  [/B]1_3 = 0
 ( 9)  [/B]2_1 = 0
 (10)  [/B]2_3 = 0
 (11)  [/B]3_1 = 0
 (12)  [/B]3_2 = 0

Sample: 1960q4 thru 2005q4                      Number of obs
>      =        181
Exactly identified model                        Log likelihoo
> d                                                          
>      =   1905.503

-------------------------------------------------------------
> -----------------
             | Coefficient  Std. err.      z    P>|z|     [95
> % con                                                      
>      f. interval]
-------------+-----------------------------------------------
> -----------------
/A           |
         1_1 |          1  (constrained)
         2_1 |  -.6082792   .0480221   -12.67   0.000    -.70
> 24008                                                      
>         -.5141576
         3_1 |  -1.160714   .1726169    -6.72   0.000    -1.4
> 99037                                                      
>         -.8223915
         1_2 |          0  (constrained)
         2_2 |          1  (constrained)
         3_2 |  -.4437645   .1945281    -2.28   0.023    -.82
> 50325                                                      
>         -.0624965
         1_3 |          0  (constrained)
         2_3 |          0  (constrained)
         3_3 |          1  (constrained)
-------------+-----------------------------------------------
> -----------------
/B           |
         1_1 |   .0070297   .0003695    19.03   0.000     .00
> 63055                                                      
>          .0077538
         2_1 |          0  (constrained)
         3_1 |          0  (constrained)
         1_2 |          0  (constrained)
         2_2 |   .0045417   .0002387    19.03   0.000     .00
> 40738                                                      
>          .0050095
         3_2 |          0  (constrained)
         1_3 |          0  (constrained)
         2_3 |          0  (constrained)
         3_3 |   .0118861   .0006247    19.03   0.000     .01
> 06616                                                      
>          .0131105
-------------------------------------------------------------
> -----------------

(file SVAR2.irf now active)
(file SVAR2.irf updated)

irf table oirf sirf,  irf(order2) ///
  impulse(D.lrgrossinv) response(D.lrconsump)  noci stderror
irf graph sirf, impulse(D.lrgrossinv) response(D.lrconsump) irf(order2) 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



Results from order2

--------------------------------------------------------
         |      (1)         (1)         (1)         (1)  
    Step |     oirf        S.E.        sirf        S.E.  
---------+----------------------------------------------
       0 |        0           0           0           0
       1 |  .000172     .000443     .000172     .000443
       2 | -.000199     .000442    -.000199     .000442
       3 | -.000284     .000459    -.000284     .000459
       4 |  .000452     .000461     .000452     .000461
       5 |  .000282     .000459     .000282     .000459
       6 |  2.3e-06     .000443     2.3e-06     .000443
       7 |  .000135     .000289     .000135     .000289
       8 | -.000049     .000269    -.000049     .000269
--------------------------------------------------------
(1) irfname = order2, impulse = D.lrgrossinv, and
    response = D.lrconsump.

irf graph sirf, impulse(D.lrgrossinv) response(D.lrconsump) irf(order2) 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...
  • very different trajectory, the SIRFs and OIRFs are sensitive to the ordering

  • If a triangular structure works for your variables of interest then stay with the OIRF obtained from the svar model.
  • If you are not sure, try several orderings and provide a robustness analysis that compare candidate orderings, this for the impulses and responses of interest.
  • In our case we provided 2 ordering for the effects of investment shocks on consumption trajectories. We find similar results from trimesters +3 onwards. - The first ordering seems to be more in tune with economic theory. Positive consumption effects are expected: around 0.3% and 0.1% statistically significant consumption growth attributed to a 1 standard deviation shock on investment. (Check the diagonal at B for the size of the st. dev.)

Forecast error variance decomposition FEVD

  • Is the fraction of the forecast error of an endogenous variable that can be attributed to orthogonalized innovations of

  • Itself

  • Other variables

  • By analogy to a R-squared, it shows the share of the predicted variability that could be atributed to a specific impulse


  • FEVD from the order1 SVAR model:
irf set SVAR1.irf // loading the IRF (order1)
irf table fevd , irf(order1) impulse(D.lrgrossinv) response(D.lrconsump) noci stderror
irf graph fevd , irf(order1) impulse(D.lrgrossinv) response(D.lrconsump) 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...


(file SVAR1.irf now active)


Results from order1

---------------------------------
         |      (1)         (1)  
    Step |     fevd        S.E.  
---------+-----------------------
       0 |        0           0
       1 |   .28364     .056716
       2 |  .292216      .05747
       3 |   .28924     .059394
       4 |   .28061     .058789
       5 |  .281056     .059104
       6 |  .283339     .059525
       7 |  .280571     .059056
       8 |  .280108     .058909
---------------------------------
(1) irfname = order1, impulse = D.lrgrossinv, and
    response = D.lrconsump.



  • Full decomposition (all impulses participation shares must add up to 1)
irf table fevd ,     response(D.lrconsump) noci 
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



Results from order1

-------------------------------------------
         |      (1)         (2)         (3)  
    Step |     fevd        fevd        fevd  
---------+---------------------------------
       0 |        0           0           0
       1 |   .28364     .201073     .515286
       2 |  .292216     .209062     .498722
       3 |   .28924     .220892     .489868
       4 |   .28061     .214821     .504569
       5 |  .281056     .216198     .502747
       6 |  .283339     .215427     .501234
       7 |  .280571     .214741     .504688
       8 |  .280108     .215346     .504546
-------------------------------------------
(1) irfname = order1, impulse = D.lrgrossinv, and
    response = D.lrconsump.
(2) irfname = order1, impulse = D.lrgdp, and response =
    D.lrconsump.
(3) irfname = order1, impulse = D.lrconsump, and response
    = D.lrconsump.
  • This is informative to identify the relative importance of past shocks. Again, it is sensitive to the ordering.

Vector Error Correction Model

  • As seen previously, a cointegrated set of variables may be better represented by a VEC model.
  • This implies adding an error correction term to the VAR of the I(0) variables
  • In our example, the first difference I(0) VAR of our I(1) variables would add an error correction term I(0) to their VAR, thus becoming a VEC.
  • All previous IRF, OIRF and FEVD analysis apply to the VEC as well.

  • We assume we know that our variables are I(1) so we omit doing any unit-root test (ADF). So now we must check for cointegration: Johansen rank test
  • We specify the VEC in the same way as we did the VAR
  • We required 6 lags for the VAR (varsoc command)
varsoc  D.lrgrossinv D.lrgdp D.lrconsump, maxlag(10)
vecrank lrgrossinv lrgdp lrconsump , lags(6)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



Lag-order selection criteria

   Sample: 1961q4 thru 2010q3                              Nu
> mber of obs = 196
  +----------------------------------------------------------
> -----------------+
  | Lag |    LL      LR      df    p     FPE       AIC      H
> QIC                                                        
>          SBIC                                              
>                  |
  |-----+----------------------------------------------------
> -----------------|
  |   0 |  1970.71                     3.8e-13  -20.0787  -20
> .0584                                                      
>        -20.0285                                            
>                  |
  |   1 |  2017.39  93.362    9  0.000 2.6e-13  -20.4632  -20
> .3819                                                      
>      *                                                     
>        -20.2625                                            
>                *                                           
>                  |
  |   2 |  2024.15  13.516    9  0.141 2.7e-13  -20.4403  -20
> .2981                                                      
>        -20.0891                                            
>                  |
  |   3 |  2031.54  14.778    9  0.097 2.7e-13  -20.4239  -20
> .2207                                                      
>        -19.9221                                            
>                  |
  |   4 |   2038.3  13.519    9  0.141 2.8e-13   -20.401  -20
> .1369                                                      
>        -19.7487                                            
>                  |
  |   5 |  2048.03  19.465    9  0.022 2.8e-13  -20.4085  -20
> .0835                                                      
>        -19.6057                                            
>                  |
  |   6 |  2062.81  29.567*   9  0.001 2.6e-13* -20.4675* -20
> .0815                                                      
>        -19.5142                                            
>                  |
  |   7 |  2065.54  5.4529    9  0.793 2.8e-13  -20.4035  -19
> .9566                                                      
>        -19.2996                                            
>                  |
  |   8 |  2073.19  15.302    9  0.083 2.8e-13  -20.3897  -19
> .8819                                                      
>        -19.1353                                            
>                  |
  |   9 |   2078.5  10.619    9  0.303 2.9e-13   -20.352  -19
> .7833                                                      
>        -18.9471                                            
>                  |
  |  10 |  2082.78  8.5505    9  0.480 3.1e-13  -20.3038  -19
> .6741                                                      
>        -18.7484                                            
>                  |
  +----------------------------------------------------------
> -----------------+
   * optimal lag
   Endogenous: D.lrgrossinv D.lrgdp D.lrconsump
    Exogenous: _cons


Johansen tests for cointegration
Trend: Constant                           Number of obs  = 20
> 1
Sample: 1960q3 thru 2010q3                Number of lags =   
> 6
-------------------------------------------------------------
> -
                                                      Critica
> l
Maximum                                        Trace     valu
> e
   rank  Params           LL  Eigenvalue   statistic        5
> %
      0      48    2093.7669           .     28.7358*    29.6
> 8
      1      53    2101.3395     0.07258     13.5907     15.4
> 1
      2      56    2107.2146     0.05678      1.8404      3.7
> 6
      3      57    2108.1348     0.00911
-------------------------------------------------------------
> -
* selected rank
  • We cannot reject the presence of at least one cointegration vector.

  • Note that we must introduce the variables in levels I(1) to the VEC command:
vec lrgrossinv lrgdp lrconsump if tin(,2005q4),lags(6)
vecstable
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



Vector error-correction model

Sample: 1960q3 thru 2005q4                      Number of obs
>      =        182
                                                AIC          
>      =  -20.43171
Log likelihood =  1912.285                      HQIC         
>      =  -20.05347
Det(Sigma_ml)  =  1.50e-13                      SBIC         
>      =  -19.49867

Equation           Parms      RMSE     R-sq      chi2     P>c
> hi2
-------------------------------------------------------------
> ---
D_lrgrossinv         17     .017071   0.3919    106.335   0.0
> 000
D_lrgdp              17     .007208   0.6648    327.242   0.0
> 000
D_lrconsump          17     .006582   0.6832   355.9122   0.0
> 000
-------------------------------------------------------------
> ---

-------------------------------------------------------------
> -----------------
             | Coefficient  Std. err.      z    P>|z|     [95
> % con                                                      
>      f. interval]
-------------+-----------------------------------------------
> -----------------
D_lrgrossinv |
        _ce1 |
         L1. |   .0041668   .0025084     1.66   0.097    -.00
> 07496                                                      
>          .0090832
             |
  lrgrossinv |
         LD. |   .2235061   .0999994     2.24   0.025      .0
> 27511                                                      
>          .4195012
        L2D. |   .0691747   .1054804     0.66   0.512     -.1
> 37563                                                      
>          .2759124
        L3D. |  -.2036485   .1069445    -1.90   0.057    -.41
> 32558                                                      
>          .0059588
        L4D. |   .2008672   .1074676     1.87   0.062    -.00
> 97655                                                      
>          .4114998
        L5D. |   .1949447   .1055139     1.85   0.065    -.01
> 18587                                                      
>          .4017482
             |
       lrgdp |
         LD. |   .3100635   .2618283     1.18   0.236    -.20
> 31106                                                      
>          .8232375
        L2D. |   .1024374   .2688125     0.38   0.703    -.42
> 44255                                                      
>          .6293002
        L3D. |   .0316294   .2648082     0.12   0.905     -.4
> 87385                                                      
>          .5506439
        L4D. |  -.2207856   .2624132    -0.84   0.400    -.73
> 51061                                                      
>          .2935348
        L5D. |  -.2918077   .2451076    -1.19   0.234    -.77
> 22098                                                      
>          .1885944
             |
   lrconsump |
         LD. |   .2667532    .274807     0.97   0.332    -.27
> 18586                                                      
>          .8053649
        L2D. |    .065759   .2808354     0.23   0.815    -.48
> 46683                                                      
>          .6161863
        L3D. |   .3917822   .2806811     1.40   0.163    -.15
> 83427                                                      
>          .9419071
        L4D. |   .0758759   .2786244     0.27   0.785    -.47
> 02178                                                      
>          .6219697
        L5D. |  -.2944805   .2641615    -1.11   0.265    -.81
> 22274                                                      
>          .2232665
             |
       _cons |  -.0029159   .0040103    -0.73   0.467    -.01
> 07761                                                      
>          .0049442
-------------+-----------------------------------------------
> -----------------
D_lrgdp      |
        _ce1 |
         L1. |   .0035394   .0010591     3.34   0.001     .00
> 14636                                                      
>          .0056153
             |
  lrgrossinv |
         LD. |   .1621089    .042222     3.84   0.000     .07
> 93552                                                      
>          .2448625
        L2D. |   .0556612   .0445363     1.25   0.211    -.03
> 16282                                                      
>          .1429507
        L3D. |  -.0844526   .0451544    -1.87   0.061    -.17
> 29536                                                      
>          .0040485
        L4D. |   .0825145   .0453753     1.82   0.069    -.00
> 64195                                                      
>          .1714485
        L5D. |  -.0067743   .0445504    -0.15   0.879    -.09
> 40915                                                      
>          .0805429
             |
       lrgdp |
         LD. |  -.1453666     .11055    -1.31   0.189    -.36
> 20406                                                      
>          .0713074
        L2D. |  -.1057584   .1134989    -0.93   0.351    -.32
> 82121                                                      
>          .1166953
        L3D. |  -.1374735   .1118082    -1.23   0.219    -.35
> 66135                                                      
>          .0816664
        L4D. |  -.1331868   .1107969    -1.20   0.229    -.35
> 03448                                                      
>          .0839712
        L5D. |  -.1414019   .1034901    -1.37   0.172    -.34
> 42389                                                      
>           .061435
             |
   lrconsump |
         LD. |   .2672358   .1160299     2.30   0.021     .03
> 98214                                                      
>          .4946502
        L2D. |    .185395   .1185752     1.56   0.118    -.04
> 70082                                                      
>          .4177981
        L3D. |   .2148529   .1185101     1.81   0.070    -.01
> 74226                                                      
>          .4471284
        L4D. |    .184136   .1176417     1.57   0.118    -.04
> 64375                                                      
>          .4147094
        L5D. |  -.0033763   .1115351    -0.03   0.976    -.22
> 19811                                                      
>          .2152285
             |
       _cons |   .0015564   .0016933     0.92   0.358    -.00
> 17623                                                      
>          .0048752
-------------+-----------------------------------------------
> -----------------
D_lrconsump  |
        _ce1 |
         L1. |   .0012383   .0009672     1.28   0.200    -.00
> 06574                                                      
>          .0031339
             |
  lrgrossinv |
         LD. |   .0160051   .0385576     0.42   0.678    -.05
> 95665                                                      
>          .0915768
        L2D. |  -.0470433    .040671    -1.16   0.247     -.1
> 26757                                                      
>          .0326704
        L3D. |   -.029462   .0412355    -0.71   0.475    -.11
> 02821                                                      
>          .0513582
        L4D. |   .0896745   .0414373     2.16   0.030      .0
> 08459                                                      
>            .17089
        L5D. |    .056708   .0406839     1.39   0.163    -.02
> 30311                                                      
>           .136447
             |
       lrgdp |
         LD. |   .2082728   .1009555     2.06   0.039     .01
> 04037                                                      
>           .406142
        L2D. |   .0838558   .1036485     0.81   0.418    -.11
> 92915                                                      
>           .287003
        L3D. |  -.1202079   .1021045    -1.18   0.239     -.3
> 20329                                                      
>          .0799131
        L4D. |  -.1630575    .101181    -1.61   0.107    -.36
> 13687                                                      
>          .0352536
        L5D. |  -.0474864   .0945083    -0.50   0.615    -.23
> 27194                                                      
>          .1377465
             |
   lrconsump |
         LD. |  -.0878808   .1059598    -0.83   0.407    -.29
> 55582                                                      
>          .1197966
        L2D. |   .1706172   .1082842     1.58   0.115     -.0
> 41616                                                      
>          .3828504
        L3D. |   .2348784   .1082247     2.17   0.030     .02
> 27618                                                      
>          .4469951
        L4D. |   .0281578   .1074317     0.26   0.793    -.18
> 24045                                                      
>            .23872
        L5D. |  -.1118205   .1018551    -1.10   0.272    -.31
> 14529                                                      
>          .0878119
             |
       _cons |   .0053633   .0015463     3.47   0.001     .00
> 23326                                                      
>           .008394
-------------------------------------------------------------
> -----------------

Cointegrating equations

Equation           Parms    chi2     P>chi2
-------------------------------------------
_ce1                  2   35.15779   0.0000
-------------------------------------------

Identification:  beta is exactly identified

                 Johansen normalization restriction imposed
-------------------------------------------------------------
> -----------------
        beta | Coefficient  Std. err.      z    P>|z|     [95
> % con                                                      
>      f. interval]
-------------+-----------------------------------------------
> -----------------
_ce1         |
  lrgrossinv |          1          .        .       .        
>     .                                                      
>                 .
       lrgdp |  -27.17311   9.173304    -2.96   0.003    -45.
> 15245                                                      
>         -9.193763
   lrconsump |   23.20065   8.393034     2.76   0.006     6.7
> 50602                                                      
>          39.65069
       _cons |   38.61175          .        .       .        
>     .                                                      
>                 .
-------------------------------------------------------------
> -----------------


   Eigenvalue stability condition
  +----------------------------------------+
  |        Eigenvalue        |   Modulus   |
  |--------------------------+-------------|
  |          1               |         1   |
  |          1               |         1   |
  |   .9422579               |   .942258   |
  |   .7919846               |   .791985   |
  |   .6081071 +  .4216824i  |   .740007   |
  |   .6081071 -  .4216824i  |   .740007   |
  |   .2430664 +  .6879285i  |   .729607   |
  |   .2430664 -  .6879285i  |   .729607   |
  |  -.3317703 +  .6373744i  |   .718552   |
  |  -.3317703 -  .6373744i  |   .718552   |
  |  -.6705013 + .00806783i  |    .67055   |
  |  -.6705013 - .00806783i  |    .67055   |
  |   -.577996 +  .3371597i  |   .669146   |
  |   -.577996 -  .3371597i  |   .669146   |
  |  -.0368057 +   .573215i  |   .574395   |
  |  -.0368057 -   .573215i  |   .574395   |
  |   .4820929               |   .482093   |
  |   .2424413               |   .242441   |
  +----------------------------------------+
   The VECM specification imposes 2 unit moduli.

  • Check each equation to better grasp the similarity between the VEC and VAR representations.
  • Pay attention to the error correction terms and their coefficients. They inform about the short term effects of deviations from the long term equilibrium on each endogeneous variable.
  • Within the long term cointegration relationship, variables are normalized (all of them are on the same side except for investment) so the signs should be switched to make long run interpretations. We see + relationship between investment and GDP and negative between investment and consumption (okey).

  • We must verify that the VEC process is stable (vecstable)

  • all modules must be lower than one… only 3 - 1 = 2 (#equations - # cointegrating vectors found in the Johansen test) can be set to 1.


  • Now we can create, tabulate, graph the IRFs, OIRFs, FEVD just like with an standard VAR model.

  • The inclusion of the error correction term will enhance the statistical properties of the predicted responses


qui:vec lrgrossinv lrgdp lrconsump if tin(,2005q4),lags(6)

irf create orderv1, set(vec.irf) replace step(8)
irf table irf oirf , irf(orderv1) impulse(lrgrossinv) response(lrconsump) noci 
irf graph oirf , irf(orderv1) impulse(lrgrossinv) response(lrconsump)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...



(file vec.irf now active)
(file vec.irf updated)


Results from orderv1

--------------------------------
         |      (1)         (1)  
    Step |      irf        oirf  
---------+----------------------
       0 |        0     .003449
       1 |  .017243     .004339
       2 |  .003271     .005037
       3 | -.008984     .005118
       4 |   .03021     .005452
       5 |   .06202     .005747
       6 |   .08001     .005882
       7 |  .095976     .005923
       8 |  .107378     .006034
--------------------------------
(1) irfname = orderv1, impulse = lrgrossinv, and response
    = lrconsump.

  • As you can notice, the responses gathered from the VECM are larger than the ones from the VAR. The long run behavior is informative.


Forecasting

  • Both a VAR and a VEC can produce forecast for your variables of interest.
  • If your original variables are I(0) like an uneployment rate or inflation, the forecast will be retrieved for those I(0) variables.
  • If your variables are I(1) and enter the VAR as I(0) (first-diff.) or the VEC as I(1) (in levels) the forecast are retrieved for the original variables in levels.

  • Let’s predict the error correction term. We know is I(0), however a visual inspection may help identify some breaks. We see that it might be wise to drop the 60’s from our time series.
predict ce1 if e(sample), ce equ(#1)
tsline ce1 if e(sample)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...

  • From the Johansen rank test we know this is stationary, yet, you may visually identify some periods that may threat stationarity.


  • LEt’s forecast consumption for 8 quarters:
fcast compute future_ , step(8)
tsline lrconsump future_lrconsump_lb ///
  future_lrconsump_ub future_lrconsump ///
if tin(2004q4,2007q4)
Running /Users/jdavalos/Documents/Slides/X_SVARVEC/profile>  ...

  • The forecast fits the observed consumption (log) relatively well. Observed series stays within the confidence interval

Exercise

  • If you prepared a bonus midterm application pick a country from any team member to answer the following questions:

    -1 Chose a set of 3 to 5 cointegrated variables among which consumption and one that could be considered a policy instrument or exogenous variable (Central bank reference rate, public investment, government expenditure, international prices, etc.). Choosing a set means that you must test for cointegration and find at least one cointegration vector.


-2 Estimate a VAR (using the first difference variables).

  • Is it stable?

  • Show how a shock on the potential exogenous variable affects consumption in 3 years. Employ the IRF and OIRF for this purpose and provide an interpretation to their differences.

  • Provide a FEVD analysis. What are the most (and least) main drivers of consumption?


-3 Estimate a VECM,

  • Is it stable?

  • Show how a shock on the potential exogenous variable affects consumption in 3 years. Employ the IRF and OIRF for this purpose and provide an interpretation to their differences.

  • Compare the OIRFs from the VAR and VEC models, which one is more informative?