Essentials of Time Series Modeling s1

Total Page:16

File Type:pdf, Size:1020Kb

Essentials of Time Series Modeling s1

Essentials of Time Series Modeling

Chapter 6 in The Essentials of Time Series Modeling: An Applied Treatment with Emphasis on Topics Relevant to Financial Analysis © by Houston H. Stokes 20xx. All rights reserved. Preliminary Draft 11 July 2013 Chapter 6

Filtering and Cointegration Tests of Economic series...... 1 6.0 Chapter Overview...... 1 6.1 Cointegration...... 1 6.2 Engle-Granger (1987) Cointegration Testing...... 6 6.3 The ADL Cointegration Test variant...... 26 6.4 A Digression on Unit Root Tests...... 28 Table 6.1 Selected Values from Empirical Cumulative Distribution of t ...... 30 6.5 Further Discussion of the Unit Root Tests used with the Cointegration Example...... 34 6.6 Cointegration Tests using the Stock-Watson Approach...... 49 6.7 Cointegration Tests using the Johansen Approach...... 53 6.8 Tests on the Johansen and Engle-Granger Procedures...... 66 6.9 Conclusions...... 73

Filtering and Cointegration Tests of Economic series

6.0 Chapter Overview

The Hodrick-Prescott and Baxter-King filters are alternative ways to decompose a series into its trend and deviations from the trend. Study of these decompositions provides insight into many economic models. An advantage of this modeling strategy is that both high frequency and low frequency information in each filtered series has been removed and analysis is confined to the middle frequencies. Unit root complications have been removed by assumption. However removal of the low frequency information of the series rules out the study of long-run adjustment. To handle such unit root issues, cointegration analysis is required. Cointegration refers to the study of the possible dynamic relationship between n series where one or more have unit roots of order k (i. e. are I(k)). For added detail see Enders (1995, 2004, 2010) or Hamilton (1994, 19) from which much of this discussion has been taken. The purpose of this chapter is to outline a number of techniques suggested to study cointegration and illustrate their application using the B34S matrix command subroutines. After a brief discussion of cointegration, the Engle-Granger method, the Stock-Watson method, the ADL method and the Johansen method will be discussed and illustrated.

6.1 Cointegration

Cointegration analysis tests whether a linear combination of variables having unit roots (I(1)) is in fact stationary. Whether or not this is true has major implications on whether a proposed model could possibly be correct.

A model involving a linear combination of variables where one or more series have unit roots must produce a stationary error process. Given that i =interest rate on t bills and M = the

1 Essentials of Time Series Modeling

M2 money supply it is logically not possible that models of the form i f( M ) and i  f* (  M ) could both be true.

Equilibrium theories involving nonstationary variables require the existence of a combination of the variables that are stationary. If this condition is not met, the theory cannot be correct. Prior to Grangers work on cointegration, this was not widely appreciated.

Example 1. Friedman asserts a relationship between consumption (C), permanent income (Y p ) and transitory income (Y t ) .

C f( Yp , Y t ) (6.1-1) where C and Y p are I(1) while Y t is I(0). Permanent income theory requires that C  Y p be stationary.

Example 2. The unbiased forward market hypothesis suggests that in equilibrium

Et S t1  F t (6.1-2)

where S = spot exchange rate and F = the forward exchange rate and Et S t1 is the expectation of the spot rate in period t+1 in period t. We assume St1 and Ft are I(1). If the unbiased forward market hypothesis is true, a linear combination of the nonstationary spot and forward exchange rates must be stationary.

Example 3. Purchasing Power Parity theory postulates a pattern between the three I(1) series

 t = log exchange rate d pt = log domestic prices f pt = log foreign prices

d f PPP theory requires that a linear combination of  tp t  p t must be stationary.

In general case, long run equilibrium between series x1t,⋯ , x k t implies

1x 1t  2 x 2 t ⋯   k x k t  0 (6.1-3)

Define ( 1 ,⋯ , k ) and X t  ( x 1 t  , ⋯ ,  x k t ) .

The equilibrium error et  X t must be stationary for there to be long run equilibrium.

X t is cointegrated of order d, b ( X t ~ CI(d,b)) if:

2 Essentials of Time Series Modeling

- All components of X t are integrated of order d.

- There exists a vector  such that  X t is integrated of order (d-b) where b > 0.  is the cointegrating vector.

Cointegration implies a linear combination of nonstationary series. Nonlinear relationships can not be tested at this time but MARS models that have nonstationary inputs and a stationary output are actually testing such models.

The cointegrating vector that makes a linear combination of n I(1) series stationary is not unique. It could be multiplied by a scalar or normalized.

All variables in the model must be integrated of the same order. Not all I(d) variables are cointegrated.

A finding that n series are not cointegrated implies that there is no long run relationship or equilibrium between such variables.

If all series are not integrated of the same order, then there cannot be a long run relationship between these series.

If X t has n components or series there can be as many as n-1 linear independent cointegrating vectors. The number of cointegrating vectors is the cointegrating rank of X t

A series may have more than one cointegrating vector. Enders asserts money demand can be estimated from

mt0   1 p t   2 y t   3 r t  e t (6.1-4) model feedback can be estimated as

mt0   1( y t  p t )  e t (6.1-5)

This implies two cointegrating vectors

1 0   1   2   3      (6.1-6) 10  1  1 0 

Most economic series are I(1). Stock-Watson (1988) observed that cointegreated variables share common stochastic trends. Assume two series. Xt [ y t z t ]' . Define it  random walk process representing trend in variable i in period t.

3 Essentials of Time Series Modeling

yt yt  e yt (6.1-7) zt zt  e zt

If yt and zt are CI(1,1) this implies that 1yt  2 z t must be stationary.

1yt  2 z t   1(  yt  e yt )   2 (  zt  e zt ) (6.1-8) (1 yt   2  zt )  (  1e yt   2 e zt )

From equation (6.1-8) (1 yt  2  zt ) must vanish or

(1 yt  2  zt )  0 (6.1-9) from equation (6.1-9) we know that

myt= - b2 m zt / b 1 (6.1-10)

The importance of (6.1-10) is that two I(1) stochastic process must have the same stochastic trend (up to a scaler 2/  1 ) if they are to be CI(1,1). The parameters of the cointegrating vector must be such that they purge or remove the trend from the linear combination. In general, cointegration will occur whenever the trend in one variable can be expressed as a linear combination of the trends in the other variables.

If variables are cointegrated, their time paths are influenced by the extent of any deviation from long-run equilibrium. For example, if long run and short run interest rates are cointegrated and long rates move up for some reason, the short term rate must ultimately rise relative to the long rate.

An error correction model is implied if the short-run dynamics of variables are influenced by the deviation from equilibrium. Assume rst and rlt are the short run and long term interest rates. A simple error correction model is

rst  s( r1 t 1   r st  1 )  e st

rl t   l( r l t1)   r st  1 )  e l t (6.1-11)

wheres 0,  l  0

Long run equilibrium implies that

E( rlt-1-b r st - 1 ) = 0 (6.1-12)

If rst and rl t are stationary then the two interest rates must be cointegrated with cointegrating vector (1 , -  ). A more general model useful in testing is

4 Essentials of Time Series Modeling

m n

Drst =a10 + a s( r lt- 1 - b r st - 1 ) +邋 d 11 i D r st - i + d 12 j D r lt - j + e st i=1 j = 1 m n (6.1-13)

Drl t =a20 - a l( r l t- 1 - b r st - 1 ) +邋 d 21 i D r st - i + d 22 j D r l t - j + e l t i=1 j = 1

Equation (6.1-13) is a VAR model with added error correction terms s(r l t1  r st  1 ) and

l(r lt1   r st  1 ) which are estimated as the residuals of a first pass equation where rl t= f( r s t ) and the residuals are retained. s and l are speed of adjustment terms. If the speed of adjustment terms are significant, it suggests that the short-tem dynamics of the variables in the system are influenced by the deviation from equilibrium of the I(1) variables. In such models (where the inputs are I(1)) the absence of Granger causality for cointegrated variables requires the additional condition that the speed of adjustment coefficients and  l be equal to zero.

For cointegration to be found, at least one of speed of adjustment coefficients must be non zero.

In the general case define X ( x1t , x 2 t ,⋯ , x k t )', 0 = k by 1 intercept vector,1 = k by 1 speed of adjustment vector,  i = k by m polynomial matrix in the lag B for lag i m

DXt =a0 + a 1 X t- 1 + p i D X t - 1 + e t (6.1-14) i=1

Assuming all variables in X are I(1), solving (6.1-14) yields

m 1Xt 1  X t   0   i  X t  1  e t (6.1-15) i1

Since every term on the right is stationary, then1X t 1 must be stationary. Each row in 1 is a cointegrating vector of X. If all elements of the speed of adjustment vector 1 are zero there is no error correction representation and the usual VAR representation can be used. If some elements in 1 are not equal zero, the usual VAR model is not correct.

It can be shown1 that “the restrictions necessary to ensure that the variables are CI(1,1 guarantee that an error-correction model exists.” A more comprehensive proof is given in Wei (2006). This analysis is based on the Granger representation theorem that states that for any set of I(1) variables, error correction and cointegration are equivalent representations.

Cointegration necessitates coefficient restrictions in a VAR Model. One cannot just put first differences on right. One needs to place the residuals from the first stage equation on the levels on the right of the VAR model in addition to the differences. By using the residuals in all VAR equations, we are implicitly placing a restriction. It is not clear what variable to place on the left 1 See Enders (1995,371). Enders (2004, 329) restated "The essential point to note is that the error-correction representation necessitates that the two variables be cointegrated of order CI(1,1). This result is unaltered if we formulate a more general model.." that contained lags of the right hand side variables.

5 Essentials of Time Series Modeling in (6.12). There is some evidence that it might make a difference in small samples which variable is placed on the left.

In general both variables in a cointegreated system may respond to a deviation from long-run adjustment, but this may not be the case. Moving cointegration models test if this occurs the same over time.

In a cointegrated system, a variable zt does not Granger cause yt if lagged values zt i do not enter the yt equation and if yt does not respond to the deviation from long-run equilibrium.

The Stock-Watson (1993) and Johansen(1988, 1991) testing methods are complex and will be discussed in sections 6.6 and 6.7. The Engle-Granger approach is substantially easier to use and is discussed next and in section 6.5. Section 6.3 discusses the ADL variant.

6.2 Engle-Granger (1987) Cointegration Testing

The Engle-Granger (1987) method of testing for cointegration is relatively easy to implement and understand. Using data on long and short interest rates from Enders (2004) first proceed to test rst and rl t to see if they are integrated to the same level. The Phillips-Perron or Dickey Fuller Tests are used first to see if the series have unit roots and if so if they are integrated to the same degree. If so proceed.

2. Estimate the long run relationship

rst0   1 r l t  u t (6.2-1)

If uˆt is stationary while both rst and rl t are I(1) then the two series are cointegrated of order (1,1).

Following Engle-Granger (1987) as discussed in Enders (2004), the simplest way to test if ut has a unit root is to proceed to estimate the Dickey- Fuller equation (1-B ) uˆt =a1 u ˆ t- 1 + e t . However the usual Dickey Fuller tables cannot be used since the sequence uˆt was generated from a regression and as a result the actual population error is not known. Engle-Granger (1987) have provided alternative tables which are given in Enders (2004) table C. If uˆt shows autocorrelation, use the augmented Dickey Fuller Equation.

3. In the augmented VAR model use of uˆt1 in place of rl t1  r st  1 will avoid the constrained estimation problem. Greene (1997 page 857) indicates that the fact that uˆt was estimated in a two step manner is not a problem. In a model of the form of m m rst 1   s u t 1  A 11( i )  r st  i   A 12 ( i )  r l t  1  e st i1 i  1 m m (6.2-2) rl t 1   l u t 1  A 21( i )  r st  i   A 22 ( i )  r lt  1  e lt i1 i  1

6 Essentials of Time Series Modeling

the usual tests can be applied. The s and l measure the speed of adjustment.

The B34S matrix command has a number of subroutines that can be used to study cointegration and how the adjustment might change over time. Problems using these routines are discussed next.

Routine Task coint2 Cointegration Tests of Two Series coint2lm Cointegration Tests of Two Series, OLS, L1, MM coint2m Moving Cointegration of Two Series coint2me Moving Cointegration of Two Series - Extended Args. coint2m2 Moving Cointegration of Two Series OLS, L1, MM coint3 Cointegration Tests of Three Series coint3me Moving Cointegration of Three Series – Extended Args.

The routine coint2, which is listed next, implements (6.2-2) where OLS, MARS, GAM and PPREG models are allowed for the EC equation estimation depending on the setting of the method switch. While most estimation is done using OLS and the residual of the error correction equation tested to see if it has a unit root. It is possible that if a unit root is found, use of a nonlinear procedure to test

7 Essentials of Time Series Modeling

subroutine coint2(method,m,alpha,deg,mi,nk,x,y,xname,yname, dfx,dfy,adfx,adfy, lagx,lagy,speedx,speedy,tspeedx,tspeedy, dfx2,dfy2,adfx2,adfy2,dflag,resid0,resid1,resid2,iprint );

/; ******************************************************************* /; Tests for Cointegration using Engle Procedure and two series /; allows for OLS, MARS, GAM and ppreg models /; Method = 0 => OLS, =1 => MARS, =2 => GAM, =3 => PPREG /; m = # of trees for PPREG (method =3) /; alpha = smoothing coef for ppreg usually = 0.0 /; deg = degree for gam estimation. Usually = 3. /; mi = maximum number of interactions for mars. -n range 1-3 /; nk = number of knots for mars /; x = first series /; y = second series /; xname = name of first series set with call character(xname,' ') /; yname = name of second series set with call character(yname,' ') /; dfx = Unit root test for x /; dfy = Unit root test for y /; adfx = Augmented DF test for x for lag=dflag /; adfy = Augmented DF test for y for lag=dflag /; lagx = Number of lags of x /; lagy = Number of lags of y /; speedx = Speed of adjustment of x /; speedy = Speed of adjustment of y /; tspeedx= t stat of speedx /; tspeedy= t stat of speedy /; dfx2 = Unit root test for x RES /; dfy2 = Unit root test for y RES /; adfx2 = Augmented DF test for x RES for lag=dflag /; adfy2 = Augmented DF test for y RES for lag=dflag /; dflag = Lag of DF test /; resid0 = Residual for Cointegrating Eq /; resid1 = Residual for Equation 1 /; resid2 = Residual for Equation 2 /; iprint = 0 no print, = 1 print /; ******************************************************************* /; /; Built 9 September 2012 /; if(iprint.ne.0)then; call print(' ':); call print('------':); if(method.eq.0) call print('Tests for Cointegration using OLS for EC Model':); if(method.eq.1) call print('Tests for Cointegration using MARS for EC Model':); if(method.eq.2) call print('Tests for Cointegration using GAM for EC Model':); if(method.eq.3) call print('Tests for Cointegration using PPREG for EC Model':); call print('------':); call print('X series was ',xname); call print('Y Series was ',yname); call print(' ':); call print('Unit root tests for Series x and y':); call df(x,dfx :print); call df(y,dfy :print); call df(x,adfx:adf dflag :print); call df(y,adfy:adf dflag :print); call olsq(x,y:print); call print(' ':); call print('DF and Augmented DF tests of Residual':); call df(%res,dd :print); call df(%res,dd2 :adf dflag :print); endif; if(iprint.eq.0)then; call df(x,dfx); call df(y,dfy); call df(x,adfx:adf dflag); call df(y,adfy:adf dflag); call olsq(x,y);

8 Essentials of Time Series Modeling endif resid0=%res; difx=dif(x); dify=dif(y); rres=goodrow(lag(%res,-1)); if(iprint.ne.0)then; if(method.eq.0) call olsq(difx rres{1} difx{1 to lagx} dify{1 to lagy}:print); if(method.eq.1) call marspline(difx rres{1} difx{1 to lagx} dify{1 to lagy} :mi mi :nk nk :print); if(method.eq.2) call gamfit(difx rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} :print); if(method.eq.3) call ppreg(difx rres{1} difx{1 to lagx} dify{1 to lagy} :m m :alpha alpha :print); endif; if(iprint.eq.0)then; if(method.eq.0) call olsq(difx rres{1} difx{1 to lagx} dify{1 to lagy}); if(method.eq.1) call marspline(difx rres{1} difx{1 to lagx} dify{1 to lagy} :mi mi :nk nk); if(method.eq.2) call gamfit(difx rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy}); if(method.eq.3) call ppreg(difx rres{1} difx{1 to lagx} dify{1 to lagy} :m m :alpha alpha); call df(%res,dfx2); call df(%res,adfx2 :adf dflag); endif; speedx=%coef(1); resid1=%res; tspeedx=%t(1); if(iprint.ne.0)then; if(method.eq.0) call olsq(dify rres{1} difx{1 to lagx} dify{1 to lagy} :print); if(method.eq.1) call marspline(dify rres{1} difx{1 to lagx} dify{1 to lagy} :print :mi mi :nk nk); if(method.eq.2) call gamfit(dify rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} :print); if(method.eq.3) call ppreg(dify rres{1} difx{1 to lagx} dify{1 to lagy} :m m :alpha alpha :print); endif; if(iprint.eq.0)then; if(method.eq.0)call olsq(dify rres{1} difx{1 to lagx} dify{1 to lagy}); if(method.eq.1) call marspline(dify rres{1} difx{1 to lagx} dify{1 to lagy} :mi mi :nk nk); if(method.eq.2) call gamfit(dify rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy}); if(method.eq.3) call ppreg(dify rres{1} difx{1 to lagx} dify{1 to lagy} :m m :alpha alpha); call df(%res,dfy2); call df(%res,adfy2 :adf dflag); endif; speedy=%coef(1); resid2=%res; tspeedy=%t(1);

9 Essentials of Time Series Modeling

if(iprint.ne.0)then; call print(' ':); call print('DF Tests on two equations ':); call df(resid1,adfx1 :print); call df(resid2,adfy1 :print); call print(' ':); call print('Augmented DF Tests on the Two Equations':); call df(resid1,adfx2 :adf dflag :print); call df(resid2,adfy2 :adf dflag :print); endif; return; end;

The user inputs the series x and y, their names (xname, yname), the number of lags on x and y (lagx, lagy) and the number of lags on the Dickey Fuller Test (dflag). The switch iprint controls output. The switches method, m, alpha, deg, mi and nk control the parameters of the various estimation methods used to estimate equation (6.2-2). The next example uses coint2 to test two of the Enders series and is listed next. b34sexec options ginclude('b34sdata.mac') noheader macro(coint6); b34srun; b34sexec matrix; call loaddata; call load(coint2); /; call print(coint2); call character(xname,'Enders y Series'); call character(yname,'Enders z Series'); call echooff; lagx=1; lagy=1; dflag=4; m=20; alpha=0.0; deg=3.; mi=2; nk=20; do method=0,3; call coint2(method,m,alpha,deg,mi,nk,y,z,xname,yname,dfx,dfy, adfx,adfy,lagx,lagy,speedx,speedy,tspeedx,tspeedy, dfx2,dfy2,adfx2,adfy2,dflag,resid0,resid1,resid2,1); call print(speedx,speedy,tspeedx,tspeedy); enddo; b34srun;

Edited output from running this test problem is given next. Estimation using OLS, MARS GAM and PPREG is shown for the 2 series model consisting of the y and z series. Analysis of the two series indicate a failure to reject a unit root. .

B34S Matrix Command. d/m/y 10/ 9/12. h:m:s 18:59:16.

------Tests for Cointegration using OLS for EC Model ------

X series was

XNAME = Enders y Series

Y Series was

YNAME = Enders z Series

10 Essentials of Time Series Modeling

Unit root tests for Series x and y Dickey-Fuller Test (I) lag 0 t -0.4148 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -1.047 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.144 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583 The next equation determines the shock RES used in the error correction equation.

Ordinary Least Squares Estimation Dependent variable X Centered R**2 2.526760578062570E-02 Adjusted R**2 1.532135686001984E-02 Residual Sum of Squares 193.1738163662790 Residual Variance 1.971161391492642 Standard Error 1.403980552391180 Total Sum of Squares 198.1813854878440 Log Likelihood -174.8148633480365 Mean of the Dependent Variable -4.281073400000000 Std. Error of Dependent Variable 1.414861186351823 Sum Absolute Residuals 120.1251092013808 F( 1, 98) 2.540415586048550 F Significance 0.8858141550104497 1/Condition XPX 3.871954710073255E-02 Maximum Absolute Residual 3.250509387003919 Number of Observations 100

Variable Lag Coefficient SE t Y 0 0.12528611 0.78605066E-01 1.5938681 CONSTANT 0 -4.0124933 0.21933234 -18.294126

DF and Augmented DF tests of Residual Dickey-Fuller Test (I) lag 0 t -0.5955 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -0.8157 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Ordinary Least Squares Estimation Dependent variable DIFX Centered R**2 2.082156749462871E-02 Adjusted R**2 -1.042880801086186E-02 Residual Sum of Squares 10.15769175608018 Residual Variance 0.1080605505965977 Standard Error 0.3287256463931552 Total Sum of Squares 10.37368820521326 Log Likelihood -27.98589992106000 Mean of the Dependent Variable 1.039561224489796E-02 Std. Error of Dependent Variable 0.3270248296827058 Sum Absolute Residuals 26.17694203416543 F( 3, 94) 0.6662821536646957 F Significance 0.4251711134241578 1/Condition XPX 5.998877450823421E-02 Maximum Absolute Residual 0.7447600555095943 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 0.51657578E-02 0.25295144E-01 0.20421935 DIFX 1 -0.13513949 0.10419843 -1.2969437 DIFY 1 -0.50305398E-01 0.90719833E-01 -0.55451379 CONSTANT 0 0.87394601E-02 0.33386696E-01 0.26176475

Ordinary Least Squares Estimation Dependent variable DIFY Centered R**2 4.334615855206347E-02 Adjusted R**2 1.281465297393784E-02 Residual Sum of Squares 12.74609034405948 Residual Variance 0.1355967057878668 Standard Error 0.3682345798371832 Total Sum of Squares 13.32361800248220 Log Likelihood -39.10857445926391 Mean of the Dependent Variable -3.832765306122449E-02 Std. Error of Dependent Variable 0.3706169000781371 Sum Absolute Residuals 29.51543527051404 F( 3, 94) 1.419718999482257 F Significance 0.7580798065685602 1/Condition XPX 5.998877450823421E-02 Maximum Absolute Residual 0.8042722745452708 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 0.52105250E-01 0.28335321E-01 1.8388798 DIFX 1 -0.14220226 0.11672184 -1.2183003 DIFY 1 -0.11811503E-01 0.10162328 -0.11622831 CONSTANT 0 -0.35912771E-01 0.37399382E-01 -0.96025037

11 Essentials of Time Series Modeling

Although the below listed tests indicate rejection of the unit root in the residuals of the error correction equation, the RES variable was not significant in the DIFX equation and had a low t of 1.84 in the DIFY equation.

DF Tests on two equations Dickey-Fuller Test (I) lag 0 t -9.626 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -9.933 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Augmented DF Tests on the Two Equations Dickey-Fuller Test (II) lag 4 t -3.208 prob reject I(i) < 0.99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -4.897 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

SPEEDX = 0.51657578E-02

SPEEDY = 0.52105250E-01

TSPEEDX = 0.20421935

TSPEEDY = 1.8388798 Now various nonlinear methods are tried on the EC equation.

------Tests for Cointegration using MARS for EC Model ------

X series was

XNAME = Enders y Series

Y Series was

YNAME = Enders z Series

Unit root tests for Series x and y Dickey-Fuller Test (I) lag 0 t -0.4148 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -1.047 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.144 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583 A MARS model is attempted that finds that a lag of shock variable RES is now significant by itself where the t was 2.94 and as an interaction with a lag of DIFY where the t was 2.77. For the second equation for DIFY, lag RES was significant three places. Recall that the OLS version of this equation had a t 1.84. The residual sum of squares fell from 12.75 to 10.37 in the MARS equation. These findings suggest nonlinear cointegration.

MARS Model Coefficients SE t Non Zero % Importance #

DIFX = -0.34164163E-01 0.41252272E-01 -0.828 98 100.000 1 + 1.0122093 * max( -1.4155377 - RRES{ 1} , 0.0) 0.34364181 2.94 13 13.265 100.000 2 -0.45008624 * max( DIFY{ 1} - 0.81830000E-01, 0.0) 0.20773109 -2.16 42 42.857 73.558 3 + 0.13965753 * max( RRES{ 1} - -1.4155377 , 0.0) 0.50310903E-01 2.77 60 61.224 94.241 4 * max( DIFY{ 1} - -0.27226000 , 0.0)

Multivariate Autoregressive Splines Analysis Model Estimated using Hastie-Tibshirani GPL routines in CRAN General Public License (GPL) Library. Version - 1 March 2006.

Left Hand Side Variable DIFY Penalty cost per degree of freedom 2.000 Threshold for Forward stepwise Stopping 0.1000E-03 Rank Test Tolerance 0.1000E-12 Max # of Knots (nk) 20 Max interaction (mi) 2

12 Essentials of Time Series Modeling

Number of Observations 98 Number of right hand Variables 3 tolbx set as 1.000000000000000E-09 stopfac gcv/gcvnull > stopfac => stop 10.00000000000000 prevcrit set as 10000000000.00000

Series Lag Mean Max Min RRES 1 -0.5636E-01 2.784 -1.911 DIFX 1 -0.5863E-03 0.6841 -0.7225 DIFY 1 -0.3713E-01 0.7269 -0.8248

GCV with only the constant 0.1387729370010900 Total sum of squares 13.32361800248220 Final gcv 0.1282633589959783 Variance of Y Variable 0.1373568866235279 R**2 (1 - (var(res)/var(y))) 0.2219018655153278 Residual Sum of Squares 10.36708231231779 Residual Variance 0.1068771372403896 Residual Standard Error 0.3269206895263584 Sum Absolute Residuals 26.09200381929774 Max Absolute Residual 0.8439826263792020 # of coefficients after last fwd step 5

MARS Model Coefficients SE t Non Zero % Importance #

DIFY = -0.78158079E-01 0.42725766E-01 -1.82 98 100.000 1 + 0.39895528 * max( RRES{ 1} - 1.7671263 , 0.0) 0.17051714 2.34 14 14.286 61.493 2 -3.9284012 * max( 1.7671263 - RRES{ 1} , 0.0) 1.0324923 -3.80 30 30.612 100.000 3 * max( DIFY{ 1} - 0.10542000 , 0.0) + 4.4657894 * max( DIFY{ 1} - 0.42337000 , 0.0) 1.3402350 3.33 14 14.286 87.577 4 + 2.9740872 * max( 1.7671263 - RRES{ 1} , 0.0) 0.87217972 3.41 35 35.714 89.623 5 * max( DIFY{ 1} - 0.53390000E-01, 0.0)

DF Tests on two equations Dickey-Fuller Test (I) lag 0 t -9.759 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -9.565 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Augmented DF Tests on the Two Equations Dickey-Fuller Test (II) lag 4 t -3.640 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -6.620 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

------Tests for Cointegration using GAM for EC Model ------Estimation by GAM indicates lag RES does not enter the model significantly.

Generalized Additive Models (GAM) Analysis Reference: Generalized Additive Models by Hastie and Tibshirani. Chapman (1990) Model estimated using CRAN General Public License (GPL) routines.

Gaussian additive model assumed Identity link - yhat = x*b + sum(splines)

Response variable .... DIFX Number of observations: 98 Residual Sum of Squares 9.180773760561541 # iterations 1 # smooths/variable 10 Mean Squared Residual 9.368136490368920E-02 df of deviance 88.00134472172297 Scale Estimate 0.1043253803631399 Primary tolerence 1.000000000000000E-09 Secondary tolerance 1.000000000000000E-09 R square 0.1149942451569181 Total sum of Squares 10.37368820521326

Model df coef st err z score nl pval lin_res Name Lag ------1. 0.815857E-02 0.3280E-01 0.2487 intcpt 3.00 -.171296E-02 0.2485E-01 -.6892E-01 0.7194 9.580 RRES 1 3.00 -.104641 0.1024 -1.022 0.6085 9.494 DIFX 1 3.00 -.559889E-01 0.8914E-01 -.6281 0.5734 9.471 DIFY 1 ----- 10.0

Generalized Additive Models (GAM) Analysis Reference: Generalized Additive Models by Hastie and Tibshirani. Chapman (1990) Model estimated using CRAN General Public License (GPL) routines.

Gaussian additive model assumed Identity link - yhat = x*b + sum(splines)

Response variable .... DIFY Number of observations: 98

13 Essentials of Time Series Modeling

Residual Sum of Squares 11.25536125665061 # iterations 1 # smooths/variable 10 Mean Squared Residual 0.1148506250678634 df of deviance 88.00134472172297 Scale Estimate 0.1278998780330256 Primary tolerence 1.000000000000000E-09 Secondary tolerance 1.000000000000000E-09 R square 0.1552323659719360 Total sum of Squares 13.32361800248220

Model df coef st err z score nl pval lin_res Name Lag ------1. -.364906E-01 0.3632E-01 -1.005 intcpt 3.00 0.472125E-01 0.2752E-01 1.716 0.8275 11.89 RRES 1 3.00 -.170787 0.1134 -1.507 0.6507 11.68 DIFX 1 3.00 -.194943E-01 0.9870E-01 -.1975 0.7379 11.77 DIFY 1 ----- 10.0

DF Tests on two equations Dickey-Fuller Test (I) lag 0 t -9.569 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -9.670 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Augmented DF Tests on the Two Equations Dickey-Fuller Test (II) lag 4 t -3.360 prob reject I(i) < 0.99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -5.444 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

SPEEDX = 0.81585739E-02

SPEEDY = -0.36490604E-01

TSPEEDX = 1.5938681

TSPEEDY = 1.5938681

------Tests for Cointegration using PPREG for EC Model ------PPREG estimation indicated that lag RES is the most important variable in the nonlinear system. These findings, together with what was found using the MARS technique, suggest that the cointegration process is more complex than would be possible to detect with OLS methods.

Projection Pursuit Regression

Number of Observations 98 Number of right hand side variables 4 Maximum number of trees 20 Minimum number of trees 20 Number of left hand side variables 1 Level of fit 2 Max number of Primary Iterations (maxit) 200 Max number of Secondary Iterations (mitone) 200 Number of cj Iterations (mitcj) 10 Smoother tone control (alpha) 0.000000000000000E+00 Span 0.000000000000000E+00 Convergence (CONV) set as 5.000000000000000E-03 Left Hand Side Variable DIFX

Series Mean Max Min DIFX 0.1040E-01 0.6841 -0.7225

Right Hand Side Variables

# Series Lag Mean Max Min 1 RRES 1 -0.5636E-01 2.784 -1.911 2 DIFX 1 -0.5863E-03 0.6841 -0.7225 3 DIFY 1 -0.3713E-01 0.7269 -0.8248 4 CONSTANT 0 1.000 1.000 1.000

Given # of trees 20 # primary iterations used 1 # secondary iterations used 7 # cj iterations used 2 Residual sum of squares 8.422284542797759E-02 Total sum of squares 10.37368820521326 Mean of the Dependent Variable 1.039561224489796E-02 Std. Error of Dependent Variable 0.3270248296827058 Sum Absolute Residuals 1.920695747868541 Maximum Absolute Residual 0.1208498527071811 Residual Variance 8.959877173189105E-04

14 Essentials of Time Series Modeling

Variable Importance for Model with # Trees 20 Series Number Importance 1 1.00000 3 0.915230 2 0.840682 4 0.102243E-15

Projection Pursuit Regression

Number of Observations 98 Number of right hand side variables 4 Maximum number of trees 20 Minimum number of trees 20 Number of left hand side variables 1 Level of fit 2 Max number of Primary Iterations (maxit) 200 Max number of Secondary Iterations (mitone) 200 Number of cj Iterations (mitcj) 10 Smoother tone control (alpha) 0.000000000000000E+00 Span 0.000000000000000E+00 Convergence (CONV) set as 5.000000000000000E-03 Left Hand Side Variable DIFY

Series Mean Max Min DIFY -0.3833E-01 0.7269 -0.8248

Right Hand Side Variables

# Series Lag Mean Max Min 1 RRES 1 -0.5636E-01 2.784 -1.911 2 DIFX 1 -0.5863E-03 0.6841 -0.7225 3 DIFY 1 -0.3713E-01 0.7269 -0.8248 4 CONSTANT 0 1.000 1.000 1.000

Given # of trees 20 # primary iterations used 2 # secondary iterations used 6 # cj iterations used 2 Residual sum of squares 8.675762356694526E-02 Total sum of squares 13.32361800248220 Mean of the Dependent Variable -3.832765306122449E-02 Std. Error of Dependent Variable 0.3706169000781371 Sum Absolute Residuals 2.085691497464224 Maximum Absolute Residual 0.1040189617682347 Residual Variance 9.229534422015454E-04

Variable Importance for Model with # Trees 20 Series Number Importance 1 1.00000 3 0.614878 2 0.527330 4 0.100867E-15

DF Tests on two equations Dickey-Fuller Test (I) lag 0 t -9.456 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -9.982 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Augmented DF Tests on the Two Equations Dickey-Fuller Test (II) lag 4 t -5.604 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -4.497 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

The below listed routine will run the three series Enders model. b34sexec options ginclude('b34sdata.mac') noheader macro(coint6); b34srun; b34sexec matrix; call loaddata; call load(coint3); /; call print(coint3); call character(xname,'Enders w Series'); call character(yname,'Enders y Series'); call character(zname,'Enders z Series'); call echooff; lagx=1; lagy=1; lagz=1; dflag=4;

15 Essentials of Time Series Modeling m=20; alpha=0.0; deg=3.; mi=2; nk=20; do method=0,3; call coint3(method,m,alpha,deg,mi,nk,w,y,z,xname,yname,zname, dfx,dfy,dfz,adfx,adfy,adfz,lagx,lagy,lagz,speedx,speedy,speedz, tspeedx,tspeedy,tspeedz,dfx2,dfy2,dfz2,adfx2,adfy2, adfz2,dflag,resid0,resid1,resid2,resid3,1); call print(speedx,speedy,speedz); call print(tspeedx,tspeedy,tspeedz); enddo; b34srun;

Edited output for the Enders (2010, Pages 377-380) are shown next.

X series was

XNAME = Enders w Series

Y Series was

YNAME = Enders y Series

Z Series was

ZNAME = Enders z Series

Dickey Fuller Tests on raw series Dickey-Fuller Test (I) lag 0 t 0.1404 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -0.4148 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Augmented DF Tests on Raw Series Dickey-Fuller Test (II) lag 4 t -1.934 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.047 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.144 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583 The next OLS shock equation replicates Enders (2010, page 379) for the last equation.

Ordinary Least Squares Estimation Dependent variable X Centered R**2 0.9886499177668914 Adjusted R**2 0.9884158954528066 Residual Sum of Squares 6.426172569828230 Residual Variance 6.624920175080649E-02 Standard Error 0.2573892028636914 Total Sum of Squares 566.1785031903000 Log Likelihood -4.654299784590544 Mean of the Dependent Variable -6.367795000000000 Std. Error of Dependent Variable 2.391437805944366 Sum Absolute Residuals 19.57804603387277 F( 2, 97) 4224.596793829707 F Significance 1.000000000000000 1/Condition XPX 2.577407832621021E-03 Maximum Absolute Residual 0.6229903380686537 Number of Observations 100

Variable Lag Coefficient SE t Y 0 0.99007092 0.18518943E-01 53.462604 Z 0 0.95347038 0.14596108E-01 65.323604 CONSTANT 0 -0.85242017E-01 0.84488924E-01 -1.0089135

16 Essentials of Time Series Modeling

DF tests on the level equation Dickey-Fuller Test (I) lag 0 t -5.390 prob reject I(i) > .99% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.199 prob reject I(i) > .99% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

The next three error correction equations replicate Enders (2010, page 380). Note that the lag of RES is only significant in the second equation that replicates Enders (2010, page 380 equation 6.37).

Ordinary Least Squares Estimation Dependent variable DIFX Centered R**2 6.646191941440926E-02 Adjusted R**2 2.630974390535160E-02 Residual Sum of Squares 17.62909569895712 Residual Variance 0.1895601688059905 Standard Error 0.4353850810558287 Total Sum of Squares 18.88417416020000 Log Likelihood -55.00055418666179 Mean of the Dependent Variable -3.262714285714285E-02 Std. Error of Dependent Variable 0.4412280678256013 Sum Absolute Residuals 33.33645224286305 F( 4, 93) 1.655250769648000 F Significance 0.8329240371055623 1/Condition XPX 1.297537266431191E-02 Maximum Absolute Residual 0.8956717505432853 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 -0.69075517E-01 0.20731201 -0.33319593 DIFX 1 -0.41953191 0.22378199 -1.8747349 DIFY 1 0.15576594 0.22754186 0.68455947 DIFZ 1 0.30122136 0.22258660 1.3532772 CONSTANT 0 -0.39800989E-01 0.44321192E-01 -0.89801261

DF & Augmented DF Tests series on x of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.334 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -3.020 prob reject I(i) < 0.97% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Ordinary Least Squares Estimation Dependent variable DIFY Centered R**2 0.1097689626772339 Adjusted R**2 7.147945569560955E-02 Residual Sum of Squares 9.234979211789948 Residual Variance 9.930085173967686E-02 Standard Error 0.3151203765859594 Total Sum of Squares 10.37368820521326 Log Likelihood -23.31948956779062 Mean of the Dependent Variable 1.039561224489796E-02 Std. Error of Dependent Variable 0.3270248296827058 Sum Absolute Residuals 25.60432801623568 F( 4, 93) 2.866815776184152 F Significance 0.9726151849158927 1/Condition XPX 1.297537266431191E-02 Maximum Absolute Residual 0.7736027909104686 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 0.41797376 0.15004703 2.7856184 DIFX 1 -0.36771979 0.16196757 -2.2703297 DIFY 1 0.17827619 0.16468887 1.0825030 DIFZ 1 0.31299454 0.16110238 1.9428301 CONSTANT 0 0.60650236E-02 0.32078524E-01 0.18906804

DF & Augmented DF Tests series on y of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.379 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -2.813 prob reject I(i) < 0.95% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Ordinary Least Squares Estimation Dependent variable DIFZ Centered R**2 3.740855743610405E-02 Adjusted R**2 -3.993225039762446E-03 Residual Sum of Squares 12.82520067317964 Residual Variance 0.1379053835825767 Standard Error 0.3713561411671776

17 Essentials of Time Series Modeling

Total Sum of Squares 13.32361800248220 Log Likelihood -39.41175965953244 Mean of the Dependent Variable -3.832765306122449E-02 Std. Error of Dependent Variable 0.3706169000781371 Sum Absolute Residuals 29.74041957877599 F( 4, 93) 0.9035494415707794 F Significance 0.5347099006345157 1/Condition XPX 1.297537266431191E-02 Maximum Absolute Residual 0.8097385891116423 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 0.74097565E-01 0.17682413 0.41904669 DIFX 1 -0.31262802 0.19087199 -1.6378937 DIFY 1 0.14593871 0.19407892 0.75195549 DIFZ 1 0.26246359 0.18985239 1.3824613 CONSTANT 0 -0.42214941E-01 0.37803194E-01 -1.1167030

DF & Augmented DF Tests series on z of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.669 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.838 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

SPEEDX = -0.69075517E-01

SPEEDY = 0.41797376

SPEEDZ = 0.74097565E-01

TSPEEDX = -0.33319593

TSPEEDY = 2.7856184

TSPEEDZ = 0.41904669 MARS methods are now tried.

------Tests for Cointegration using MARS for EC Model ------

X series was

XNAME = Enders w Series

Y Series was

YNAME = Enders y Series

Z Series was

ZNAME = Enders z Series

Dickey Fuller Tests on raw series Dickey-Fuller Test (I) lag 0 t 0.1404 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -0.4148 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Augmented DF Tests on Raw Series Dickey-Fuller Test (II) lag 4 t -1.934 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.047 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.144 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Ordinary Least Squares Estimation Dependent variable X Centered R**2 0.9886499177668914 Adjusted R**2 0.9884158954528066 Residual Sum of Squares 6.426172569828230 Residual Variance 6.624920175080649E-02 Standard Error 0.2573892028636914 Total Sum of Squares 566.1785031903000 Log Likelihood -4.654299784590544

18 Essentials of Time Series Modeling

Mean of the Dependent Variable -6.367795000000000 Std. Error of Dependent Variable 2.391437805944366 Sum Absolute Residuals 19.57804603387277 F( 2, 97) 4224.596793829707 F Significance 1.000000000000000 1/Condition XPX 2.577407832621021E-03 Maximum Absolute Residual 0.6229903380686537 Number of Observations 100

Variable Lag Coefficient SE t Y 0 0.99007092 0.18518943E-01 53.462604 Z 0 0.95347038 0.14596108E-01 65.323604 CONSTANT 0 -0.85242017E-01 0.84488924E-01 -1.0089135

DF tests on the level equation Dickey-Fuller Test (I) lag 0 t -5.390 prob reject I(i) > .99% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.199 prob reject I(i) > .99% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583 In contrast to the OLS runs, RES is significant in equations 2 and 3 where the residual sum of squares falls from 9.24 to 7.85 and 12.83 to 10.15 for the x and y equation respectively.

Multivariate Autoregressive Splines Analysis Model Estimated using Hastie-Tibshirani GPL routines in CRAN General Public License (GPL) Library. Version - 1 March 2006.

Left Hand Side Variable DIFX Penalty cost per degree of freedom 2.000 Threshold for Forward stepwise Stopping 0.1000E-03 Rank Test Tolerance 0.1000E-12 Max # of Knots (nk) 20 Max interaction (mi) 2 Number of Observations 98 Number of right hand Variables 4 tolbx set as 1.000000000000000E-09 stopfac gcv/gcvnull > stopfac => stop 10.00000000000000 prevcrit set as 10000000000.00000

Series Lag Mean Max Min RRES 1 -0.2386E-03 0.6108 -0.6230 DIFX 1 -0.4394E-01 0.9164 -1.083 DIFY 1 -0.5863E-03 0.6841 -0.7225 DIFZ 1 -0.3713E-01 0.7269 -0.8248

GCV with only the constant 0.1966892409075991 Total sum of squares 18.88417416020000 Final gcv 0.1848538544531003 Variance of Y Variable 0.1946822078371134 R**2 (1 - (var(res)/var(y))) 0.2783239557763409 Residual Sum of Squares 13.62825610636378 Residual Variance 0.1404974856326162 Residual Standard Error 0.3748299422839860 Sum Absolute Residuals 29.76919640657867 Max Absolute Residual 0.9063331073653624 # of coefficients after last fwd step 7

MARS Model Coefficients SE t Non Zero % Importance #

DIFX = 0.34858338 0.90425908E-01 3.85 98 100.000 1 -1.6534100 * max( DIFZ{ 1} - 0.81830000E-01, 0.0) 0.41138199 -4.01 42 42.857 95.938 2 -0.68093655 * max( 0.81830000E-01 - DIFZ{ 1} , 0.0) 0.19684607 -3.45 55 56.122 82.573 3 + 48.271322 * max( DIFY{ 1} - 0.34107000 , 0.0) 11.522451 4.18 6 6.122 100.000 4 * max( DIFZ{ 1} - 0.81830000E-01, 0.0) + 2.6564537 * max( 0.34107000 - DIFY{ 1} , 0.0) 0.95856308 2.77 36 36.735 66.151 5 * max( DIFZ{ 1} - 0.81830000E-01, 0.0) -3.7805442 * max( DIFX{ 1} - -0.41168000 , 0.0) 0.99188289 -3.81 19 19.388 90.981 6 * max( DIFY{ 1} - 0.28658000 , 0.0) -1.8075129 * max( DIFX{ 1} - -0.41168000 , 0.0) 0.62512024 -2.89 57 58.163 69.020 7 * max( 0.28658000 - DIFY{ 1} , 0.0)

DF & Augmented DF Tests series on x of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.403 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -3.558 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Multivariate Autoregressive Splines Analysis Model Estimated using Hastie-Tibshirani GPL routines in CRAN General Public License (GPL) Library. Version - 1 March 2006.

Left Hand Side Variable DIFY Penalty cost per degree of freedom 2.000

19 Essentials of Time Series Modeling

Threshold for Forward stepwise Stopping 0.1000E-03 Rank Test Tolerance 0.1000E-12 Max # of Knots (nk) 20 Max interaction (mi) 2 Number of Observations 98 Number of right hand Variables 4 tolbx set as 1.000000000000000E-09 stopfac gcv/gcvnull > stopfac => stop 10.00000000000000 prevcrit set as 10000000000.00000

Series Lag Mean Max Min RRES 1 -0.2386E-03 0.6108 -0.6230 DIFX 1 -0.4394E-01 0.9164 -1.083 DIFY 1 -0.5863E-03 0.6841 -0.7225 DIFZ 1 -0.3713E-01 0.7269 -0.8248

GCV with only the constant 0.1080477674684770 Total sum of squares 10.37368820521326 Final gcv 0.1064946714745246 Variance of Y Variable 0.1069452392290027 R**2 (1 - (var(res)/var(y))) 0.2431558414780928 Residual Sum of Squares 7.851265320443264 Residual Variance 8.094087959219863E-02 Residual Standard Error 0.2845011064867738 Sum Absolute Residuals 23.43012181690527 Max Absolute Residual 0.6895996223279111 # of coefficients after last fwd step 7

MARS Model Coefficients SE t Non Zero % Importance #

DIFY = -0.16125557 0.55877154E-01 -2.88 98 100.000 1 + 2.6467166 * max( RRES{ 1} - -0.24959402 , 0.0) 0.59503085 4.44 84 85.714 100.000 2 -3.3120105 * max( RRES{ 1} - -0.24959402 , 0.0) 0.82309666 -4.02 72 73.469 90.463 3 * max( 0.34107000 - DIFY{ 1} , 0.0) -0.65664478 * max( RRES{ 1} - -0.24959402 , 0.0) 0.28958286 -2.26 75 76.531 50.979 4 * max( 0.42337000 - DIFZ{ 1} , 0.0) -87.268879 * max( DIFX{ 1} - 0.34200000 , 0.0) 38.005695 -2.29 3 3.061 51.623 5 * max( 0.49260000E-01 - DIFY{ 1} , 0.0) + 0.87258156 * max( 0.34200000 - DIFX{ 1} , 0.0) 0.24168054 3.61 45 45.918 81.170 6 * max( 0.49260000E-01 - DIFY{ 1} , 0.0) -3.3076797 * max( RRES{ 1} - -0.24959402 , 0.0) 0.95425448 -3.46 58 59.184 77.928 7 * max( DIFY{ 1} - -0.16522000 , 0.0)

DF & Augmented DF Tests series on y of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.470 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -3.613 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Multivariate Autoregressive Splines Analysis Model Estimated using Hastie-Tibshirani GPL routines in CRAN General Public License (GPL) Library. Version - 1 March 2006.

Left Hand Side Variable DIFZ Penalty cost per degree of freedom 2.000 Threshold for Forward stepwise Stopping 0.1000E-03 Rank Test Tolerance 0.1000E-12 Max # of Knots (nk) 20 Max interaction (mi) 2 Number of Observations 98 Number of right hand Variables 4 tolbx set as 1.000000000000000E-09 stopfac gcv/gcvnull > stopfac => stop 10.00000000000000 prevcrit set as 10000000000.00000

Series Lag Mean Max Min RRES 1 -0.2386E-03 0.6108 -0.6230 DIFX 1 -0.4394E-01 0.9164 -1.083 DIFY 1 -0.5863E-03 0.6841 -0.7225 DIFZ 1 -0.3713E-01 0.7269 -0.8248

GCV with only the constant 0.1387729370010900 Total sum of squares 13.32361800248220 Final gcv 0.1377390937327698 Variance of Y Variable 0.1373568866235279 R**2 (1 - (var(res)/var(y))) 0.2378388206184848 Residual Sum of Squares 10.15474441040063 Residual Variance 0.1046880867051611 Residual Standard Error 0.3235553842932629 Sum Absolute Residuals 24.89026078752352 Max Absolute Residual 0.7323905350576841 # of coefficients after last fwd step 7

MARS Model Coefficients SE t Non Zero % Importance #

DIFZ = 0.12055464 0.69248285E-01 1.74 98 100.000 1 -3.1013478 * max( DIFX{ 1} - 0.36800000E-01, 0.0) 1.3939839 -2.22 19 19.388 58.351 2 * max( 0.22068000 - DIFY{ 1} , 0.0) -2.5088656 * max( DIFZ{ 1} - 0.26724800 , 0.0) 0.65800843 -3.81 21 21.429 100.000 3

20 Essentials of Time Series Modeling

-0.35897199 * max( 0.26724800 - DIFZ{ 1} , 0.0) 0.13466527 -2.66 76 77.551 69.913 4 + 28.316190 * max( DIFY{ 1} - 0.28658000 , 0.0) 8.3000564 3.41 4 4.082 89.476 5 * max( DIFZ{ 1} - 0.26724800 , 0.0) + 4.4938504 * max( 0.28658000 - DIFY{ 1} , 0.0) 1.3295104 3.38 16 16.327 88.650 6 * max( DIFZ{ 1} - 0.26724800 , 0.0) + 1.2845593 * max( 0.27236795E-01 - RRES{ 1} , 0.0) 0.59806341 2.14 39 39.796 56.333 7 * max( 0.26724800 - DIFZ{ 1} , 0.0)

DF & Augmented DF Tests series on z of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.388 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -5.261 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583 The GAM and PPREG estimation procedures are attempted to see if cointegratioin can be detected.

------Tests for Cointegration using GAM for EC Model ------

X series was

XNAME = Enders w Series

Y Series was

YNAME = Enders y Series

Z Series was

ZNAME = Enders z Series

Dickey Fuller Tests on raw series Dickey-Fuller Test (I) lag 0 t 0.1404 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -0.4148 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Augmented DF Tests on Raw Series Dickey-Fuller Test (II) lag 4 t -1.934 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.047 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.144 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Ordinary Least Squares Estimation Dependent variable X Centered R**2 0.9886499177668914 Adjusted R**2 0.9884158954528066 Residual Sum of Squares 6.426172569828230 Residual Variance 6.624920175080649E-02 Standard Error 0.2573892028636914 Total Sum of Squares 566.1785031903000 Log Likelihood -4.654299784590544 Mean of the Dependent Variable -6.367795000000000 Std. Error of Dependent Variable 2.391437805944366 Sum Absolute Residuals 19.57804603387277 F( 2, 97) 4224.596793829707 F Significance 1.000000000000000 1/Condition XPX 2.577407832621021E-03 Maximum Absolute Residual 0.6229903380686537 Number of Observations 100

Variable Lag Coefficient SE t Y 0 0.99007092 0.18518943E-01 53.462604 Z 0 0.95347038 0.14596108E-01 65.323604 CONSTANT 0 -0.85242017E-01 0.84488924E-01 -1.0089135

DF tests on the level equation Dickey-Fuller Test (I) lag 0 t -5.390 prob reject I(i) > .99% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.199 prob reject I(i) > .99% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

21 Essentials of Time Series Modeling

Generalized Additive Models (GAM) Analysis Reference: Generalized Additive Models by Hastie and Tibshirani. Chapman (1990) Model estimated using CRAN General Public License (GPL) routines.

Gaussian additive model assumed Identity link - yhat = x*b + sum(splines)

Response variable .... DIFX Number of observations: 98 Residual Sum of Squares 16.01496332447576 # iterations 1 # smooths/variable 13 Mean Squared Residual 0.1634179931068955 df of deviance 85.00154205644172 Scale Estimate 0.1884079151627825 Primary tolerence 1.000000000000000E-09 Secondary tolerance 1.000000000000000E-09 R square 0.1519373212396731 Total sum of Squares 18.88417416020000

Model df coef st err z score nl pval lin_res Name Lag ------1. -.407138E-01 0.4419E-01 -.9214 intcpt 3.00 -.143146 0.2067 -.6926 0.1749 16.18 RRES 1 3.00 -.414541 0.2231 -1.858 0.1610 16.17 DIFX 1 3.00 0.163459 0.2268 0.7206 0.2786 16.27 DIFY 1 3.00 0.271088 0.2219 1.222 0.8770 17.10 DIFZ 1 ----- 13.0

DF & Augmented DF Tests series on x of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.104 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -3.101 prob reject I(i) < 0.97% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Generalized Additive Models (GAM) Analysis Reference: Generalized Additive Models by Hastie and Tibshirani. Chapman (1990) Model estimated using CRAN General Public License (GPL) routines.

Gaussian additive model assumed Identity link - yhat = x*b + sum(splines)

Response variable .... DIFY Number of observations: 98 Residual Sum of Squares 8.545956788720428 # iterations 1 # smooths/variable 13 Mean Squared Residual 8.720364070122885E-02 df of deviance 85.00154205644172 Scale Estimate 0.1005388441429197 Primary tolerence 1.000000000000000E-09 Secondary tolerance 1.000000000000000E-09 R square 0.1761891605315760 Total sum of Squares 10.37368820521326

Model df coef st err z score nl pval lin_res Name Lag ------1. 0.521991E-02 0.3228E-01 0.1617 intcpt 3.00 0.399340 0.1510 2.645 0.2249 8.657 RRES 1 3.00 -.388720 0.1630 -2.385 0.3462E-01 8.573 DIFX 1 3.00 0.207879 0.1657 1.254 0.6914 8.907 DIFY 1 3.00 0.314737 0.1621 1.942 0.4888 8.778 DIFZ 1 ----- 13.0

DF & Augmented DF Tests series on y of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.377 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -2.890 prob reject I(i) < 0.95% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Generalized Additive Models (GAM) Analysis Reference: Generalized Additive Models by Hastie and Tibshirani. Chapman (1990) Model estimated using CRAN General Public License (GPL) routines.

Gaussian additive model assumed Identity link - yhat = x*b + sum(splines)

Response variable .... DIFZ

22 Essentials of Time Series Modeling

Number of observations: 98 Residual Sum of Squares 11.72508478863134 # iterations 1 # smooths/variable 12 Mean Squared Residual 0.1196437223329729 df of deviance 85.00154205644172 Scale Estimate 0.1379396715043804 Primary tolerence 1.000000000000000E-09 Secondary tolerance 1.000000000000000E-09 R square 0.1199774125581394 Total sum of Squares 13.32361800248220

Model df coef st err z score nl pval lin_res Name Lag ------1. -.413774E-01 0.3781E-01 -1.094 intcpt 3.00 0.706582E-02 0.1768 0.3995E-01 0.1322 11.82 RRES 1 3.00 -.253524 0.1909 -1.328 0.2358 11.88 DIFX 1 3.00 0.105202 0.1941 0.5420 0.5471 12.09 DIFY 1 3.00 0.216156 0.1899 1.138 0.7004 12.23 DIFZ 1 ----- 13.0 The GAM model did not indicate nonlinearity for lag RES nor did the PPREG detect lag RES was an an important variable.

DF & Augmented DF Tests series on z of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.299 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -5.236 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

SPEEDX = -0.14314590

SPEEDY = 0.39934017

SPEEDZ = 0.70658245E-02

TSPEEDX = -0.69259350

TSPEEDY = 2.6449967

TSPEEDZ = 0.39954650E-01

------Tests for Cointegration using PPREG for EC Model ------

X series was

XNAME = Enders w Series

Y Series was

YNAME = Enders y Series

Z Series was

ZNAME = Enders z Series

Dickey Fuller Tests on raw series Dickey-Fuller Test (I) lag 0 t 0.1404 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t -0.4148 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob reject I(i) < 0.90% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Augmented DF Tests on Raw Series Dickey-Fuller Test (II) lag 4 t -1.934 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.047 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Dickey-Fuller Test (II) lag 4 t -1.144 prob reject I(i) < 0.90% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Ordinary Least Squares Estimation Dependent variable X Centered R**2 0.9886499177668914 Adjusted R**2 0.9884158954528066 Residual Sum of Squares 6.426172569828230

23 Essentials of Time Series Modeling

Residual Variance 6.624920175080649E-02 Standard Error 0.2573892028636914 Total Sum of Squares 566.1785031903000 Log Likelihood -4.654299784590544 Mean of the Dependent Variable -6.367795000000000 Std. Error of Dependent Variable 2.391437805944366 Sum Absolute Residuals 19.57804603387277 F( 2, 97) 4224.596793829707 F Significance 1.000000000000000 1/Condition XPX 2.577407832621021E-03 Maximum Absolute Residual 0.6229903380686537 Number of Observations 100

Variable Lag Coefficient SE t Y 0 0.99007092 0.18518943E-01 53.462604 Z 0 0.95347038 0.14596108E-01 65.323604 CONSTANT 0 -0.85242017E-01 0.84488924E-01 -1.0089135

DF tests on the level equation Dickey-Fuller Test (I) lag 0 t -5.390 prob reject I(i) > .99% Critical Values: 99% -2.586 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.199 prob reject I(i) > .99% Critical Values: 99% -3.499 , 95% -2.892 , 90% -2.583

Projection Pursuit Regression

Number of Observations 98 Number of right hand side variables 5 Maximum number of trees 20 Minimum number of trees 20 Number of left hand side variables 1 Level of fit 2 Max number of Primary Iterations (maxit) 200 Max number of Secondary Iterations (mitone) 200 Number of cj Iterations (mitcj) 10 Smoother tone control (alpha) 0.000000000000000E+00 Span 0.000000000000000E+00 Convergence (CONV) set as 5.000000000000000E-03 Left Hand Side Variable DIFX

Series Mean Max Min DIFX -0.3263E-01 0.9164 -1.083

Right Hand Side Variables

# Series Lag Mean Max Min 1 RRES 1 -0.2386E-03 0.6108 -0.6230 2 DIFX 1 -0.4394E-01 0.9164 -1.083 3 DIFY 1 -0.5863E-03 0.6841 -0.7225 4 DIFZ 1 -0.3713E-01 0.7269 -0.8248 5 CONSTANT 0 1.000 1.000 1.000

Given # of trees 20 # primary iterations used 6 # secondary iterations used 6 # cj iterations used 2 Residual sum of squares 8.916639567874959E-03 Total sum of squares 18.88417416020000 Mean of the Dependent Variable -3.262714285714285E-02 Std. Error of Dependent Variable 0.4412280678256013 Sum Absolute Residuals 0.7019989005798212 Maximum Absolute Residual 3.180349392783743E-02 Residual Variance 9.587784481585978E-05

Variable Importance for Model with # Trees 20 Series Number Importance 2 1.00000 4 0.779642 3 0.577400 1 0.375218 5 0.907715E-16

DF & Augmented DF Tests series on x of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.512 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.050 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Projection Pursuit Regression

Number of Observations 98 Number of right hand side variables 5 Maximum number of trees 20 Minimum number of trees 20 Number of left hand side variables 1 Level of fit 2

24 Essentials of Time Series Modeling

Max number of Primary Iterations (maxit) 200 Max number of Secondary Iterations (mitone) 200 Number of cj Iterations (mitcj) 10 Smoother tone control (alpha) 0.000000000000000E+00 Span 0.000000000000000E+00 Convergence (CONV) set as 5.000000000000000E-03 Left Hand Side Variable DIFY

Series Mean Max Min DIFY 0.1040E-01 0.6841 -0.7225

Right Hand Side Variables

# Series Lag Mean Max Min 1 RRES 1 -0.2386E-03 0.6108 -0.6230 2 DIFX 1 -0.4394E-01 0.9164 -1.083 3 DIFY 1 -0.5863E-03 0.6841 -0.7225 4 DIFZ 1 -0.3713E-01 0.7269 -0.8248 5 CONSTANT 0 1.000 1.000 1.000

Given # of trees 20 # primary iterations used 11 # secondary iterations used 5 # cj iterations used 2 Residual sum of squares 7.291251209857375E-03 Total sum of squares 10.37368820521326 Mean of the Dependent Variable 1.039561224489796E-02 Std. Error of Dependent Variable 0.3270248296827058 Sum Absolute Residuals 0.6710009412489552 Maximum Absolute Residual 2.183686034847404E-02 Residual Variance 7.840055064362768E-05

Variable Importance for Model with # Trees 20 Series Number Importance 2 1.00000 4 0.868507 3 0.829871 1 0.620702 5 0.979643E-16

DF & Augmented DF Tests series on y of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.588 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -4.326 prob reject I(i) > .99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

Projection Pursuit Regression

Number of Observations 98 Number of right hand side variables 5 Maximum number of trees 20 Minimum number of trees 20 Number of left hand side variables 1 Level of fit 2 Max number of Primary Iterations (maxit) 200 Max number of Secondary Iterations (mitone) 200 Number of cj Iterations (mitcj) 10 Smoother tone control (alpha) 0.000000000000000E+00 Span 0.000000000000000E+00 Convergence (CONV) set as 5.000000000000000E-03 Left Hand Side Variable DIFZ

Series Mean Max Min DIFZ -0.3833E-01 0.7269 -0.8248

Right Hand Side Variables

# Series Lag Mean Max Min 1 RRES 1 -0.2386E-03 0.6108 -0.6230 2 DIFX 1 -0.4394E-01 0.9164 -1.083 3 DIFY 1 -0.5863E-03 0.6841 -0.7225 4 DIFZ 1 -0.3713E-01 0.7269 -0.8248 5 CONSTANT 0 1.000 1.000 1.000

Given # of trees 20 # primary iterations used 1 # secondary iterations used 6 # cj iterations used 2 Residual sum of squares 9.749327339421406E-03 Total sum of squares 13.32361800248220 Mean of the Dependent Variable -3.832765306122449E-02 Std. Error of Dependent Variable 0.3706169000781371 Sum Absolute Residuals 0.7319427377224550 Maximum Absolute Residual 3.484156541054284E-02 Residual Variance 1.048314767679721E-04

Variable Importance for Model with # Trees 20 Series Number Importance 2 1.00000 4 0.816118

25 Essentials of Time Series Modeling

3 0.608308 1 0.559764 5 0.871061E-16

DF & Augmented DF Tests series on z of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.020 prob reject I(i) > .99% Critical Values: 99% -2.587 , 95% -1.943 , 90% -1.617

Dickey-Fuller Test (II) lag 4 t -3.334 prob reject I(i) < 0.99% Critical Values: 99% -3.501 , 95% -2.892 , 90% -2.583

6.3 The ADL Cointegration Test variant.

Enders (2010, 406-411) discusses the autoregressive distributed lag (ADL) approach that assumes rst is weakly stationary and modifies (6.2-2) to be

m m

Drl t =a0 - a 1 r lt- 1 - a 2 r st - 1 +邋 A 21( i ) D r st - i + A 22 ( i ) D r l t - 1 + e lt (6.3-1) i=0 i = 1

The ADL test uses alternative critical values, listed in Enders (2010) Table F, to test a1 and a2 The below listed program will implement this approach

b34sexec options ginclude('enders_3.mac') member(quarterly); b34srun; b34sexec matrix; call loaddata; /; Enders (2009, 409) eq 6.71 call olsq(r10 tbill :print ); difrl=dif(r10); difrs=dif(tbill); tbill(1)=missing(); r10(1)=missing(); tbill=goodrow(tbill); r10 =goodrow(r10); /; Enders (2009, 411) eq 6.73 call olsq(difrl r10{1} tbill{1} difrs{0 to 6} difrl{1 to 6} :print); b34srun; and, when run, replicates Enders (2009) equation 6.71 and 6.73 exactly.

26 Essentials of Time Series Modeling

B34S(r) Matrix Command. d/m/y 13/11/09. h:m:s 14:57: 2.

=> CALL LOADDATA$

=> CALL OLSQ(R10 TBILL :PRINT )$

Ordinary Least Squares Estimation Dependent variable R10 Centered R**2 0.8053098576491220 Adjusted R**2 0.8042905375321017 Residual Sum of Squares 241.6756108823379 Residual Variance 1.265317334462502 Standard Error 1.124863251449927 Total Sum of Squares 1241.334604639514 Log Likelihood -295.5585839679375 Mean of the Dependent Variable 6.899136269430052 Std. Error of Dependent Variable 2.542692352441430 Sum Absolute Residuals 185.8725806912911 F( 1, 191) 790.0460750281466 F Significance 1.000000000000000 1/Condition XPX 4.397470203986141E-03 Maximum Absolute Residual 2.709584486130860 Number of Observations 193

Variable Lag Coefficient SE t TBILL 0 0.83772361 0.29803999E-01 28.107758 CONSTANT 0 2.2694193 0.18353873 12.364798

=> DIFRL=DIF(R10)$

=> DIFRS=DIF(TBILL)$

=> TBILL(1)=MISSING()$

=> R10(1)=MISSING()$

=> TBILL=GOODROW(TBILL)$

=> R10 =GOODROW(R10)$

=> CALL OLSQ(DIFRL R10{1} TBILL{1} DIFRS{0 TO 6} => DIFRL{1 TO 6} :PRINT)$

Ordinary Least Squares Estimation Dependent variable DIFRL Centered R**2 0.5976969068485001 Adjusted R**2 0.5621995750998383 Residual Sum of Squares 18.59471991977874 Residual Variance 0.1093807054104632 Standard Error 0.3307275395404247 Total Sum of Squares 46.22067350791237 Log Likelihood -49.75574937859660 Mean of the Dependent Variable -1.702526881720429E-03 Std. Error of Dependent Variable 0.4998414532840868 Sum Absolute Residuals 42.89650011621709 F(15, 170) 16.83779815002667 F Significance 1.000000000000000 1/Condition XPX 6.015689739706699E-04

27 Essentials of Time Series Modeling

Maximum Absolute Residual 1.170670672675654 Number of Observations 186

Variable Lag Coefficient SE t R10 1 -0.12433289 0.30337606E-01 -4.0983091 TBILL 1 0.13532334 0.30248476E-01 4.4737241 DIFRS 0 0.48871025 0.37571029E-01 13.007636 DIFRS 1 -0.17218827 0.51294347E-01 -3.3568663 DIFRS 2 0.37674166E-01 0.53327561E-01 0.70646707 DIFRS 3 -0.13259868 0.52926033E-01 -2.5053584 DIFRS 4 0.76451262E-01 0.53378114E-01 1.4322586 DIFRS 5 -0.41660068E-01 0.50264529E-01 -0.82881645 DIFRS 6 0.97920002E-01 0.49598661E-01 1.9742469 DIFRL 1 0.13115889 0.71227912E-01 1.8413973 DIFRL 2 0.31930125E-01 0.70802561E-01 0.45097415 DIFRL 3 0.57527888E-01 0.70021518E-01 0.82157442 DIFRL 4 -0.11726211 0.70189568E-01 -1.6706488 DIFRL 5 -0.16305302 0.71196836E-01 -2.2901723 DIFRL 6 -0.15952967 0.72202010E-01 -2.2094908 CONSTANT 0 0.10949103 0.82071827E-01 1.3340879

As noted in Enders, the appropriate critical values for the 99%, 95% and 90% are -3.834, -3.231 and -2.916 respectively suggesting the two interest rate series, rl and rs are cointegrated since their t scores were -4.098 and 4.47 respectively.

6.4 A Digression on Unit Root Tests

Testing for unit roots using the Dickey Fuller and Phillips Perron tests involves using tables that were generated using Monti Carlo Methods. The basic idea is that if the test statistic is greater than the critical value then it can be said that for that critical value it is not possible to reject a unit root. More detail on these tests is contained in Stokes (1997, 200x, chapter 12) and Fuller (1976). Here we show how it is possible to generate a table of critical values that mimics closely what is in the published table. The below listed code, which is supplied in matrix.mac as member DF1, will perform this task.

/$ /$ Job establishes critical values for DF test /$ Unit root and noise generated /$ b34sexec matrix; call echooff; ncase=10000; n=500; unit=array(n:); test =array(ncase:); test1=array(ncase:); test2=array(ncase:); test3=array(ncase:); do i=1,ncase; call outstring(2,3,'Case'); call outinteger(20,3,i); noise=rn(unit); unit=cusum(noise); call df(unit, d); call df(unit, d1 :adf 4);

28 Essentials of Time Series Modeling call df(unit, d2 :adft 4); call df(noise,d3); test(i)=d; test1(i)=d1; test2(i)=d2; test3(i)=d3; enddo; q=array(8:.01 .025 .05 .10 .90,.95,.975,.99); call quantile(test, q,value); call quantile(test1,q,value1); call quantile(test2,q,value2); call quantile(test3,q,value3); call print('# cases ',ncase:); call print('# observations ',n:); Call Print('DF Test at .01 .025 .05 .10 .90 .95 .975 .99'); call tabulate(q,value,value1,value2,value3); call graph(test(ranker(test)) :heading 'Unit root Distribution - Case 1'); call graph(test1(ranker(test1)) :heading 'Unit root adf Distribution - Case 2'); call graph(test2(ranker(test2)) :heading 'Unit root adf Distribution - Case 4'); call graph(test3(ranker(test3)) :heading 'Random Variable Distribution'); /$ For a discussion of why we cannot use these methods /$ for Case # 4 in some cases see Hamilton page 497 ; b34srun;

In the simulation 10,000 cases of 500 observations each are built. The data having the unit root is passed through the Dickey fuller test without a constant, with a constant and with a constant and a trend. Next the white noise series noise is tested using the constant =0.0 test. The results of this run and one with 10,000 cases and 2,000 observations are listed next:

B34S(r) Matrix Command. Version December 2002.

Date of Run d/m/y 14/ 3/03. Time of Run h:m:s 9: 9:52.

=> CALL ECHOOFF$

# cases 10000 # observations 500

DF Test at .01 .025 .05 .10 .90 .95 .975 .99

Obs Q VALUE VALUE1 VALUE2 VALUE3 1 0.1000E-01 -2.613 -3.445 -3.948 -24.79 2 0.2500E-01 -2.229 -3.113 -3.664 -24.38 3 0.5000E-01 -1.936 -2.867 -3.391 -24.03 4 0.1000 -1.614 -2.580 -3.116 -23.65 5 0.9000 0.8716 -0.4164 -1.224 -21.06 6 0.9500 1.267 -0.6114E-01 -0.8947 -20.73 7 0.9750 1.618 0.2356 -0.6056 -20.42 8 0.9900 2.023 0.6069 -0.2517 -20.09

B34S Matrix Command Ending. Last Command reached.

Space available in allocator 2874628, peak space used 79138

29 Essentials of Time Series Modeling

Number variables used 28, peak number used 32 Number temp variables used 130039, # user temp clean 0

B34S(r) Matrix Command. Version December 2002.

Date of Run d/m/y 14/ 3/03. Time of Run h:m:s 9:13:27.

=> CALL ECHOOFF$

# cases 10000 # observations 2000

DF Test at .01 .025 .05 .10 .90 .95 .975 .99

Obs Q VALUE VALUE1 VALUE2 VALUE3 1 0.1000E-01 -2.542 -3.435 -3.979 -47.01 2 0.2500E-01 -2.235 -3.138 -3.671 -46.67 3 0.5000E-01 -1.947 -2.877 -3.403 -46.35 4 0.1000 -1.635 -2.582 -3.126 -45.96 5 0.9000 0.8991 -0.4491 -1.269 -43.45 6 0.9500 1.302 -0.5254E-01 -0.9579 -43.11 7 0.9750 1.654 0.2561 -0.6572 -42.78 8 0.9900 2.083 0.6225 -0.3134 -42.43

B34S Matrix Command Ending. Last Command reached.

Space available in allocator 2874628, peak space used 85138 Number variables used 28, peak number used 32 Number temp variables used 130039, # user temp clean 0

The table values against which these values are to be compared are:

Table 6.1 Selected Values from Empirical Cumulative Distribution of t ______.01 .025 .05 .10 .90 .95 .975 .99 N = 300 Model I -2.58 -2.23 -1.95 -1.62 .89 1.28 1.62 2.00 N= Model I -2.58 -2.23 -1.95 -1.62 .89 1.28 1.62 2.00

N = 500 Model II -3.44 -3.13 -2.87 -2.57 -.43 -.07 .24 .61 N= Model II -3.43 -3.12 -2.86 -2.57 -.44 -.07 .23 .60

N = 500 Model IV -3.98 -3.68 -3.42 -3.13 -1.24 -.93 -.65 -.32 N= Model IV -3.96 -3.66 -3.41 -3.12 -1.25 -.94 -.66 -.33 ______Source: Wayne Fuller Introduction to Statistical Time-Series.(New York: John Wiley) 1976

It will be seen that especially for the 10,000 cases of 2,000 observations each, we are very close to the table values. Note that for the noise series the values found are far less than the . 01 critical values as can be expected since the random normal series does not have a unit root by design. It is left as an exercise to modify the DF1 program to get critical values for values such as .80, .85 etc that were not tabled by Dickey-Fuller. Another interesting test is to repeat the experiment using the Phillips Perron test. This is done using the sample job PP1, which is not listed, using settings 10,000 and 2,000 and reported below:

B34S(r) Matrix Command. Version December 2002.

30 Essentials of Time Series Modeling

Date of Run d/m/y 14/ 3/03. Time of Run h:m:s 9:39:50.

=> CALL ECHOOFF$

# cases 10000 # observations 2000

DF Test at .01 .025 .05 .10 .90 .95 .975 .99

Obs Q VALUE VALUE1 VALUE2 VALUE3 1 0.1000E-01 -2.498 -3.377 -3.975 -47.11 2 0.2500E-01 -2.190 -3.097 -3.653 -46.73 3 0.5000E-01 -1.916 -2.858 -3.398 -46.37 4 0.1000 -1.591 -2.544 -3.129 -46.00 5 0.9000 0.9030 -0.4339 -1.228 -43.44 6 0.9500 1.304 -0.5401E-01 -0.9262 -43.09 7 0.9750 1.631 0.2413 -0.6470 -42.77 8 0.9900 2.025 0.6043 -0.3557 -42.42

B34S Matrix Command Ending. Last Command reached.

Space available in allocator 2874601, peak space used 85138 Number variables used 28, peak number used 32 Number temp variables used 130039, # user temp clean 0

There are a number of other unit root tests that might be considered. For a good reference see and Stock (1994). Stock-Watson (2003) is a good reference on the DF_GLS test which was developed by Elliott, Rothenberg and Stock (1996) and discusses a number of other issues regarding unit root tests. The DF_GLS test first involves "detrending" the series to be tested which is yt . There are two variants, one assumes a trend, while the other does not. Consider the trend test first. Define a * =1 - 13.5/T where T = the number of data points. Define

* V1=1, Vt = y t -a y t- 1 , t = 2,..., T , * X11=1, X 1t = 1 -a , t = 2,..., T , (6.4-1) * X21=1, X 2t = t -a ( t - 1), t = 2,..., T

d ˆ ˆ and estimate Vt=d0 X 1 t + d 1 X 2 t to form the detrended series yt= y t -(d0 + d 1 t ) which is tested using a model estimated without a constant. If the no trend version of the test is desired, define * d ˆ a =1 - 7 /T and estimate Vt= d0 X 1 t which forms yt= y t - d0 . Elliott, Rothenberg-Stock provide critical values.

10% 5% 1% Intercept Only -1.62 -1.95 -2.58 Intercept and Time -2.57 -2.89 -3.48

The below listed program implements this test:

subroutine DF_GLS(x,lag1,notrend,trend,notrendx,trendx,iprint); /$ /$ Implements Elliott-Rothenberg-Stock (1996) Unit root test /$ documented in "Efficient Tests for an Autoregressive Root"

31 Essentials of Time Series Modeling

/$ Econometrica 64(4): 813-836. See also "Introduction to /$ Econometrics," By James Stock and Mark Watson, Addison /$ Wesley New York 2003 page 549-550 /$ /$ ********************************************************** /$ /$ x = series to test /$ lag1 = Lag for DF part of test. Must be GE 1 /$ notrend = > no trend test statistic /$ trend = > trend test statistic /$ notrendx = x smoothed without a trend /$ trendx = x smoothed with a trend /$ iprint = 2 to print steps and test, = 1 print test only /$ a1=1.0-(13.5/dfloat(norows(x))); a2=1.0-( 7.0/dfloat(norows(x))); y1=x; i=integers(2,norows(x)); v1(i) =afam(x(i))- a1*x(i-1); v2(i) =afam(x(i)) -a2*x(i-1); x11=array(norows(x):)+1.; x12=x11; x11(i)=x11(i)-a1; x12(i)=x12(i)-a2; i=integers(1,norows(x)); x21=dfloat(i)-(a1*dfloat(i-1)); if(iprint.ne.2)call olsq(v1 x11 x21 :noint); if(iprint.eq.2)call olsq(v1 x11 x21 :noint :print); trendx= x- (%coef(1)+%coef(2)*dfloat(i)); if(iprint.ne.2)call olsq(v2 x12 :noint); if(iprint.eq.2)call olsq(v2 x12 :noint :print); notrendx= x-%coef(1);

/$ dx1=dif(trendx) ; dx2=dif(notrendx) ; lx1=goodrow(lag( trendx,1)); lx2=goodrow(lag(notrendx,1)); if(iprint.ne.2)call olsq(dx1 lx1 dx1{1 to lag1} :noint); if(iprint.eq.2)call olsq(dx1 lx1 dx1{1 to lag1} :noint :print); trend=%t(1);

if(iprint.ne.2)call olsq(dx2 lx2 dx2{1 to lag1} :noint); if(iprint.eq.2)call olsq(dx2 lx2 dx2{1 to lag1} :noint :print); notrend=%t(1);

if(iprint.ne.0)then; call print('ADF_GLS test: Assumes notrend',notrend:); call print('ADF_GLS test: Assumes trend ',trend:); endif;

return; end; and can be tested with:

b34sexec matrix; call load(df_gls);

iprint=1;

n=1000;

32 Essentials of Time Series Modeling

x=rn(array(n:)); root=cusum(x); call graph(x); call graph(root); call echooff;

do i=1,4; call print(' ':); call print('For lag ',i:); call print('Non unit root case':); call DF_GLS(x,i,notrend,trend,notrendx,trendx,iprint); call print(' ':); call print('------':); call print(' ':); call print('Unit root case':); call DF_GLS(root,i,notrend,trend,notrendx,trendx,iprint); enddo;

b34srun; Edited output from running this example follows:

For lag 1 Non unit root case ADF_GLS test: Assumes notrend -21.68972530442140 ADF_GLS test: Assumes trend -21.61945077178021

------

Unit root case ADF_GLS test: Assumes notrend -0.2738818791495943 ADF_GLS test: Assumes trend -0.3394426053873541

For lag 2 Non unit root case ADF_GLS test: Assumes notrend -17.34564436475009 ADF_GLS test: Assumes trend -17.27238784439302

------

Unit root case ADF_GLS test: Assumes notrend -0.2833452242430957 ADF_GLS test: Assumes trend -0.3580649275824865

For lag 3 Non unit root case ADF_GLS test: Assumes notrend -14.99497955412062 ADF_GLS test: Assumes trend -14.91748242564275

------

Unit root case ADF_GLS test: Assumes notrend -0.3005369625789262 ADF_GLS test: Assumes trend -0.3923715940633312

For lag 4 Non unit root case ADF_GLS test: Assumes notrend -13.40007717269902 ADF_GLS test: Assumes trend -13.31839283146237

------

Unit root case ADF_GLS test: Assumes notrend -0.3120382122320363 ADF_GLS test: Assumes trend -0.4139016016207527 shows it was possible to identify the unit root.

33 Essentials of Time Series Modeling

6.5 Further Discussion of the Unit Root Tests used with the Cointegration Example

Since the 05% critical value for the DF test for N=100 is –1.95, the DF tests for x and y of the cointegration example of -.4148 and .0687 suggest it is not possible to reject a unit root since these values are greater than the critical value. Since the DF test for equation (6.1-.12) is -.5955, this suggests that the two series tested are not cointegrated. What is needed is the third series which will be tested below. After estimating (6.1-13) the results for the DF test were –9.62 and –9.93 which do not indicate a unit root. The t scores for the speed of adjustment term in equation (6.1-13) were .2 and 1.84 which were not significant. The above analysis has been done using OLS. The routine coint2lm allows estimation using the L1 and Minimax estimators, which are less sensitive and more sensitive to outliers respectively than OLS. Neither estimator has a t test capability. The next task is to see if this relationship holds up using a moving window. The routine coint2m, which is listed next and which uses coint2, will perform this task. subroutine coint2m(x,y,xname,yname,number,lagx,lagy,speedx,speedy tspeedx,tspeedy); /; Routine to drive coint2 using windows of data /; x = Input series # 1 /; y = Input series # 2 /; xname = Name of x series /; yname = Name of y series /; number = Number of observations in moving model /; lagx = Number of lags of X /; lagy = Number of lags of y /; speedx = Moving Error correction coefficient for x /; speedy = Moving Error correction coefficient for y /; tspeedx= t Stat of speedx /; tspeedy= t stat of speedy n=norows(x); if(n.ne.norows(y))then; call print('# of rows of x .NE. # of rows of y'); call stop; endif; if(n.le.number)then; call print('Number is too large given n',n,number); call stop; endif; nn=n-number+1; xwork =array(number:); ywork=array(number:); speedx =array(nn:); speedy=array(nn:); tspeedx=array(nn:); tspeedy=array(nn:); ii=integers(number); call cls; call outstring(1,2,'Moving Cointegration Analysis'); call outstring(1,3,'Case Speedx Speedy, t-Speedx t-Speedy'); method=0; m=0; alpha=0.0; deg=3.0; mi=2; nk=30; do j=1,nn;

34 Essentials of Time Series Modeling xwork=x(j+ii-1); ywork=y(j+ii-1); call coint2(method,m,alpha,deg,mi,nk,xwork,ywork,xname,yname,dfx,dfy, adfx,adfy,lagx,lagy,speedx1,speedy1,tspeedx1,tspeedy1, dfx2,dfy2,adfx2,adfy2,4,resid0,resid1,resid2,0); speedx(j) =speedx1; speedy(j) =speedy1; tspeedx(j)=tspeedx1; tspeedy(j)=tspeedy1; call outinteger(1,4,j); call outdouble(25,4,speedx1,'(e16.8)'); call outdouble(60,4,speedy1,'(e16.8)'); call outdouble(25,5,tspeedx1,'(e16.8)'); call outdouble(60,5,tspeedy1,'(e16.8)'); enddo; return; end;

The test problem coint2m listed next, illustrates how the above routine is used. b34sexec options ginclude('b34sdata.mac') macro(coint6); b34srun; b34sexec matrix; call loaddata; call load(coint2); call load(coint2m); call character(xname,'Enders y Series'); call character(yname,'Enders z Series'); call echooff; number=60; lagx=1; lagy=1; call coint2m(y,z,xname,yname,number,lagx,lagy, speedx,speedy,tspeedx,tspeedy); call graph(speedx,tspeedx :heading 'Enders Y Series Moving Error Correction'); call graph(speedy,tspeedy :heading 'Enders Z Series Moving Error Correction'); call tabulate(speedx,speedy,tspeedx,tspeedy); b34srun;

Since NUMBER=60, a moving window of 60 observations will be used for the error correction analysis. Edited output from running this job is listed next.

Obs SPEEDX SPEEDY TSPEEDX TSPEEDY 1 -0.3705E-01 0.1556 -0.8013 2.936 2 -0.4055E-01 0.1567 -0.8539 2.848 3 -0.4147E-01 0.1536 -0.8573 2.695 4 -0.4710E-01 0.1551 -0.9805 2.711 5 -0.5499E-01 0.1561 -1.111 2.680 6 -0.7365E-01 0.1675 -1.521 2.881 7 -0.7105E-01 0.1443 -1.399 2.432 8 -0.8003E-01 0.1493 -1.509 2.361 9 -0.1013 0.1263 -1.872 1.877 10 -0.1077 0.1319 -1.898 1.915 11 -0.8802E-01 0.1278 -1.531 1.801

35 Essentials of Time Series Modeling

12 -0.1043 0.1196 -1.807 1.657 13 -0.1223 0.1250 -2.159 1.719 14 -0.1372 0.1474 -2.349 1.978 15 -0.1356 0.1434 -2.163 1.801 16 -0.1711 0.1871 -2.584 2.219 17 -0.1680 0.1420 -2.261 1.522 18 -0.1803 0.1866 -2.287 1.871 19 -0.2068 0.1527 -2.498 1.427 20 -0.1777 0.1724 -2.071 1.534 21 -0.1243 0.1284 -1.431 1.093 22 -0.1566 0.8320E-01 -1.835 0.7040 23 -0.1919 0.6751E-01 -2.335 0.5782 24 -0.1852 0.8560E-01 -2.155 0.7223 25 -0.2084 0.9572E-01 -2.374 0.7859 26 -0.1941 0.8016E-01 -2.168 0.6372 27 -0.1978 0.7473E-01 -2.146 0.5746 28 -0.1556 0.3104E-01 -1.704 0.2326 29 -0.1492 -0.2073E-01 -1.656 -0.1595 30 -0.1296 -0.3799E-01 -1.459 -0.3040 31 -0.1173 -0.3712E-01 -1.382 -0.3093 32 -0.1100 -0.2065E-01 -1.367 -0.1832 33 -0.8754E-01 0.7469E-02 -1.103 0.6797E-01 34 -0.3676E-01 0.1178E-01 -0.4593 0.1133 35 -0.8171E-01 0.3078E-01 -1.103 0.3226 36 -0.6618E-01 0.3661E-02 -0.9666 0.4159E-01 37 -0.5724E-01 0.1519E-01 -0.8896 0.1880 38 -0.4434E-01 0.2615E-01 -0.7209 0.3475 39 -0.2018E-01 0.4942E-01 -0.3560 0.6825 40 -0.3133E-01 0.4761E-01 -0.5892 0.6984 41 -0.1619E-02 0.5005E-01 -0.3183E-01 0.7890

Note that for sub periods the speed of adjustment terms for x and y was significant while for other periods it was not. The above example suggests that analysis that looks at the complete period may give misleading findings. We next turn to three variable models. The routine coint3, which is listed below, works in a manner similar to coint2. subroutine coint3(method,m,alpha,deg,mi,nk,x,y,z,xname,yname,zname, dfx,dfy,dfz,adfx,adfy,adfz, lagx,lagy,lagz,speedx,speedy,speedz,tspeedx,tspeedy,tspeedz, dfx2,dfy2,dfz2,adfx2,adfy2,adfz2, dflag,resid0,resid1,resid2,resid3,iprint); /; Tests for Cointegration using Engle Procedure and three series /; Method = 0 => OLS, =1 => MARS, =2 => GAM, =3 => PPREG /; m = # of trees for PPREG (method =3) /; alpha = smoothing coef for ppreg usually = 0.0 /; deg = degree for gam estimation. Usually = 3. /; mi = maximum number of interactions for mars. -n range 1-3 /; nk = number of knots for mars /; x = first series /; y = second series /; z = third series /; xname = name of first series set with call character(xname,' ') /; yname = name of second series set with call character(yname,' ') /; zname = name of third series ser with call character(zname,' ') /; dfx = Unit root test for x

36 Essentials of Time Series Modeling

/; dfy = Unit root test for y /; dfz = Unit root test for z /; adfx = Augmented DF test for x lag=dflag /; adfy = Augmented DF test for y lag=dflag /; adfz = Augmented DF test for z lag=dflag /; lagx = Number of lags of x /; lagy = Number of lags of y /; lagz = Number of lags of z /; speedx = Speed of adjustment of x /; speedy = Speed of adjustment of y /; speedz = Speed of adjustment of z /; tspeedx = t of Speed of adjustment of x /; tspeedy = t of Speed of adjustment of y /; tspeedz = t of Speed of adjustment of z /; dfx2 = Unit root test for x RES /; dfy2 = Unit root test for y RES /; dfy2 = Unit root test for y RES /; adfx2 = Augmented DF test for x RES lag=dflag /; adfy2 = Augmented DF test for y RES lag=dflag /; adfz2 = Augmented DF test for z RES lag=dflag /; dflag = Sets lag on DF test /; resid0 = Residual for Cointegrating Eq /; resid1 = Residual for Equation 1 /; resid2 = Residual for Equation 2 /; resid3 = Residual for Equation 3 /; iprint = 0 no print, = 1 print /; /; Built 9 September 2012 /; if(iprint.eq.0)then; call df(x,dfx); call df(y,dfy); call df(z,dfz); call df(x,adfx:adf dflag); call df(y,adfy:adf dflag); call df(z,adfz:adf dflag); endif; if(iprint.ne.0)then; call print(' ':); call print('------':); if(method.eq.0) call print('Tests for Cointegration using OLS for EC Model':); if(method.eq.1) call print('Tests for Cointegration using MARS for EC Model':); if(method.eq.2) call print('Tests for Cointegration using GAM for EC Model':); if(method.eq.3) call print('Tests for Cointegration using PPREG for EC Model':); call print('------':); call print('X series was ',xname); call print('Y Series was ',yname); call print('Z Series was ',zname); call print(' ':); call print('Dickey Fuller Tests on raw series':); call df(x,dfx :print); call df(y,dfy :print); call df(z,dfz :print); call print('Augmented DF Tests on Raw Series':); call df(x,adfx:adf dflag :print); call df(y,adfy:adf dflag :print); call df(z,adfz:adf dflag :print);

37 Essentials of Time Series Modeling

call olsq(x y z:print); call print(' '); call print('DF tests on the level equation':); call df(%res,dd :print); call df(%res,dd2:adf dflag :print); endif; if(iprint.eq.0)call olsq(x y z); resid0=%res; difx=dif(x); dify=dif(y); difz=dif(z); rres=goodrow(lag(%res,-1)); if(iprint.ne.0)then; if(method.eq.0) call olsq(difx rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :print); if(method.eq.1) call marspline(difx rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :mi mi :nk nk :print); if(method.eq.2) call gamfit(difx rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} difz[predictor,deg]{1 to lagz} :print); if(method.eq.3) call ppreg(difx rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :print :m m :alpha alpha); call print(' ':); call print( 'DF & Augmented DF Tests series on x of Error Correction Model'); call df(%res,dfx2 :print); call df(%res,adfx2 :adf dflag :print); speedx=%coef(1); resid1=%res; tspeedx=%t(1); if(method.eq.0) call olsq(dify rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :print); if(method.eq.1) call marspline(dify rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :mi mi :nk nk :print); if(method.eq.2) call gamfit(dify rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} difz[predictor,deg]{1 to lagz} :print); if(method.eq.3) call ppreg(dify rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :print :m m :alpha alpha); call print(' ':); call print( 'DF & Augmented DF Tests series on y of Error Correction Model'); call df(%res,dfy2 :print); call df(%res,adfy2 :adf dflag :print); speedy=%coef(1); resid2=%res; tspeedy=%t(1); if(method.eq.0)

38 Essentials of Time Series Modeling call olsq(difz rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :print); if(method.eq.1) call marspline(difz rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :mi mi :nk nk :print); if(method.eq.2) call gamfit(difz rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} difz[predictor,deg]{1 to lagz} :print); if(method.eq.3) call ppreg(difz rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :m m :alpha alpha :print); call print(' ':); call print( 'DF & Augmented DF Tests series on z of Error Correction Model'); call df(%res,dfz2 :print); call df(%res,adfz2 :adf dflag :print); speedz=%coef(1); resid3=%res; tspeedz=%t(1); endif; if(iprint.eq.0)then; if(method.eq.0) call olsq(difx rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} ); if(method.eq.1) call marspline(difx rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :mi mi :nk nk); if(method.eq.2) call gamfit(difx rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} difz[predictor,deg]{1 to lagz}); if(method.eq.3) call ppreg(difx rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :m m :alpha alpha); call df(%res,dfx2); call df(%res,adfx2 :adf dflag); speedx=%coef(1); resid1=%res; tspeedx=%t(1); if(method.eq.0) call olsq(dify rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} ); if(method.eq.1) call marspline(dify rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :mi mi :nk nk); if(method.eq.2) call gamfit(dify rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} difz[predictor,deg]{1 to lagz}); if(method.eq.3) call ppreg(dify rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :m m :alpha alpha);

39 Essentials of Time Series Modeling speedy=%coef(1); resid2=%res; tspeedy=%t(1); call df(%res,dfy2); call df(%res,adfy2 :adf dflag); if(method.eq.0) call olsq(difz rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} ); if(method.eq.1) call marspline(difz rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :mi mi :nk nk); if(method.eq.2) call gamfit(difz rres[predictor,deg]{1} difx[predictor,deg]{1 to lagx} dify[predictor,deg]{1 to lagy} difz[predictor,deg]{1 to lagz}); if(method.eq.3) call ppreg(difz rres{1} difx{1 to lagx} dify{1 to lagy} difz{1 to lagz} :m m :alpha alpha); speedz=%coef(1); resid3=%res; tspeedz=%t(1); call df(%res,dfz2); call df(%res,adfz2 :adf dflag); endif; return; end;

The test job shown above attempts to replicate Enders (1995, 380). The output for OLS was listed above:

The same calculations can done with rats.

* set dy = y - y(t-1) set dz = z - z(t-1) set dw = w - w(t-1) linreg w / residw # constant y z system 1 to 3 variables dy dz dw lags 1 to 1 det constant residw{1} end(system) estimate(outsigma=vsigma)

Output from this job is listed next. First the B34S results and next the RATS results. Note that while both programs agree 100%, the reported results do not agree with the second stage (eq (6.1-13)) Enders results which appear to be in error. In equation (6.1-12) we have assumed the model w=f(y,z) which is arbitrary. This equation replicates RATS.

B34S(r) Matrix Command. Version December 2002.

Date of Run d/m/y 13/ 3/03. Time of Run h:m:s 16:30:43.

40 Essentials of Time Series Modeling

=> CALL LOADDATA$

=> CALL LOAD(COINT3)$

=> CALL CHARACTER(XNAME,'Enders w Series')$

=> CALL CHARACTER(YNAME,'Enders y Series')$

=> CALL CHARACTER(ZNAME,'Enders z Series')$

=> CALL ECHOOFF$

X series was

XNAME = Enders w Series

Y Series was

YNAME = Enders y Series

Z Series was

ZNAME = Enders z Series

Dickey Fuller Tests on raw series Dickey-Fuller Test (I) lag 0 t 0.1404 prob 0.1000 Dickey-Fuller Test (I) lag 0 t -0.4148 prob 0.1000 Dickey-Fuller Test (I) lag 0 t 0.6877E-01 prob 0.1000 Augmented DF Tests on Raw Series Dickey-Fuller Test (II) lag 4 t -1.934 prob 0.1000 Dickey-Fuller Test (II) lag 4 t -1.047 prob 0.1000 Dickey-Fuller Test (II) lag 4 t -1.144 prob 0.1000

Ordinary Least Squares Estimation Dependent variable X Centered R**2 0.9886499177225009 Residual Sum of Squares 6.426172569828230 Residual Variance 6.624920175080649E-02 Sum Absolute Residuals 19.57804603387277 1/Condition XPX 2.577407832621021E-03 Maximum Absolute Residual 0.6229903380686537 Number of Observations 100

Variable Lag Coefficient SE t Y 0 0.99007092 0.18518943E-01 53.462604 Z 0 0.95347038 0.14596108E-01 65.323604 CONSTANT 0 -0.85242017E-01 0.84488924E-01 -1.0089135

DF tests on the level equation Dickey-Fuller Test (I) lag 0 t -5.390 prob 0.0000 Dickey-Fuller Test (II) lag 4 t -4.199 prob 0.0000

Ordinary Least Squares Estimation Dependent variable DIFX Centered R**2 6.646191203759100E-02

41 Essentials of Time Series Modeling

Residual Sum of Squares 17.62909569895712 Residual Variance 0.1895601688059905 Sum Absolute Residuals 33.33645224286305 1/Condition XPX 1.297537266431191E-02 Maximum Absolute Residual 0.8956717505432853 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 -0.69075517E-01 0.20731201 -0.33319593 DIFX 1 -0.41953191 0.22378199 -1.8747349 DIFY 1 0.15576594 0.22754186 0.68455947 DIFZ 1 0.30122136 0.22258660 1.3532772 CONSTANT 0 -0.39800989E-01 0.44321192E-01 -0.89801261

DF & Augmented DF Tests series on x of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.334 prob 0.0000 Dickey-Fuller Test (II) lag 4 t -3.020 prob 0.0250

Ordinary Least Squares Estimation Dependent variable DIFY Centered R**2 0.1097689621899358 Residual Sum of Squares 9.234979211789948 Residual Variance 9.930085173967686E-02 Sum Absolute Residuals 25.60432801623568 1/Condition XPX 1.297537266431191E-02 Maximum Absolute Residual 0.7736027909104686 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 0.41797376 0.15004703 2.7856184 DIFX 1 -0.36771979 0.16196757 -2.2703297 DIFY 1 0.17827619 0.16468887 1.0825030 DIFZ 1 0.31299454 0.16110238 1.9428301 CONSTANT 0 0.60650236E-02 0.32078524E-01 0.18906804

DF & Augmented DF Tests series on y of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.379 prob 0.0000 Dickey-Fuller Test (II) lag 4 t -2.813 prob 0.0500

Ordinary Least Squares Estimation Dependent variable DIFZ Centered R**2 3.740855370370377E-02 Residual Sum of Squares 12.82520067317964 Residual Variance 0.1379053835825767 Sum Absolute Residuals 29.74041957877599 1/Condition XPX 1.297537266431191E-02 Maximum Absolute Residual 0.8097385891116423 Number of Observations 98

Variable Lag Coefficient SE t RRES 1 0.74097565E-01 0.17682413 0.41904669 DIFX 1 -0.31262802 0.19087199 -1.6378937 DIFY 1 0.14593871 0.19407892 0.75195549 DIFZ 1 0.26246359 0.18985239 1.3824613 CONSTANT 0 -0.42214941E-01 0.37803194E-01 -1.1167030

42 Essentials of Time Series Modeling

DF & Augmented DF Tests series on z of Error Correction Model Dickey-Fuller Test (I) lag 0 t -9.669 prob 0.0000 Dickey-Fuller Test (II) lag 4 t -4.838 prob 0.0000

SPEEDX = -0.69075517E-01

SPEEDY = 0.41797376

SPEEDZ = 0.74097565E-01

TSPEEDX = -0.33319593

TSPEEDY = 2.7856184

TSPEEDZ = 0.41904669

B34S Matrix Command Ending. Last Command reached.

Space available in allocator 2874871, peak space used 9822 Number variables used 85, peak number used 86 Number temp variables used 90, # user temp clean 0

Rats results next set dy = y - y(t-1) set dz = z - z(t-1) set dw = w - w(t-1) linreg w / residy # constant y z

Dependent Variable W - Estimation by Least Squares Usable Observations 100 Degrees of Freedom 97 Centered R**2 0.988650 R Bar **2 0.988416 Uncentered R**2 0.998609 T x R**2 99.861 Mean of Dependent Variable -6.367795000 Std Error of Dependent Variable 2.391437806 Standard Error of Estimate 0.257389203 Sum of Squared Residuals 6.4261725698 Regression F(2,97) 4224.5968 Significance Level of F 0.00000000 Durbin-Watson Statistic 0.868356 Q(25-0) 83.132833 Significance Level of Q 0.00000004

Variable Coeff Std Error T-Stat Signif ******************************************************************************* 1. Constant -0.085242017 0.084488924 -1.00891 0.31552626 2. Y 0.990070917 0.018518943 53.46260 0.00000000 3. Z 0.953470378 0.014596108 65.32360 0.00000000 system 1 to 3 variables dy dz dw lags 1 to 1 det constant residy{1} end(system)

43 Essentials of Time Series Modeling estimate(outsigma=vsigma)

Dependent Variable DY - Estimation by Least Squares Usable Observations 98 Degrees of Freedom 93 Centered R**2 0.109769 R Bar **2 0.071479 Uncentered R**2 0.110677 T x R**2 10.846 Mean of Dependent Variable 0.0103956122 Std Error of Dependent Variable 0.3270248297 Standard Error of Estimate 0.3151203766 Sum of Squared Residuals 9.2349792118 Durbin-Watson Statistic 1.903629

Variable Coeff Std Error T-Stat Signif ******************************************************************************* 1. DY{1} 0.178276194 0.164688870 1.08250 0.28182786 2. DZ{1} 0.312994545 0.161102378 1.94283 0.05506132 3. DW{1} -0.367719789 0.161967574 -2.27033 0.02549642 4. Constant 0.006065024 0.032078524 0.18907 0.85045149 5. RESIDY{1} 0.417973763 0.150047030 2.78562 0.00647469

F-Tests, Dependent Variable DY Variable F-Statistic Signif DY 1.1718 0.2818279 DZ 3.7746 0.0550613 DW 5.1544 0.0254964

Dependent Variable DZ - Estimation by Least Squares Usable Observations 98 Degrees of Freedom 93 Centered R**2 0.037409 R Bar **2 -0.003993 Uncentered R**2 0.047698 T x R**2 4.674 Mean of Dependent Variable -0.038327653 Std Error of Dependent Variable 0.370616900 Standard Error of Estimate 0.371356141 Sum of Squared Residuals 12.825200673 Durbin-Watson Statistic 1.971941

Variable Coeff Std Error T-Stat Signif ******************************************************************************* 1. DY{1} 0.145938711 0.194078923 0.75196 0.45397672 2. DZ{1} 0.262463592 0.189852392 1.38246 0.17014107 3. DW{1} -0.312628022 0.190871990 -1.63789 0.10482313 4. Constant -0.042214941 0.037803194 -1.11670 0.26699816 5. RESIDY{1} 0.074097565 0.176824129 0.41905 0.67614830

F-Tests, Dependent Variable DZ Variable F-Statistic Signif DY 0.5654 0.4539767 DZ 1.9112 0.1701411 DW 2.6827 0.1048231

Dependent Variable DW - Estimation by Least Squares Usable Observations 98 Degrees of Freedom 93 Centered R**2 0.066462 R Bar **2 0.026310 Uncentered R**2 0.071591 T x R**2 7.016 Mean of Dependent Variable -0.032627143 Std Error of Dependent Variable 0.441228068 Standard Error of Estimate 0.435385081 Sum of Squared Residuals 17.629095699 Durbin-Watson Statistic 1.903992

Variable Coeff Std Error T-Stat Signif

44 Essentials of Time Series Modeling

******************************************************************************* 1. DY{1} 0.155765936 0.227541861 0.68456 0.49532443 2. DZ{1} 0.301221362 0.222586595 1.35328 0.17924742 3. DW{1} -0.419531906 0.223781991 -1.87473 0.06396762 4. Constant -0.039800989 0.044321192 -0.89801 0.37149784 5. RESIDY{1} -0.069075517 0.207312009 -0.33320 0.73973640

F-Tests, Dependent Variable DW Variable F-Statistic Signif DY 0.4686 0.4953244 DZ 1.8314 0.1792474 DW 3.5146 0.0639676

Unlike in the COINT2 case, here the residual of (6.1-12) did not have a unit root since –5.390 is less than the critical value. The fact that the linear combination of three I(1) series produced a I(0) error, indicates that these three series are cointegrated. For the complete sample, only in the case of the y equation in (6.1-.13) was the speed of adjustment term significant (t score 2.7856), a finding reported in Enders (2004, 380), although the exact coefficients are not the same. The routine coint3me, in a manner similar to coint2m, allows calculation of moving windows. This routine is listed next and a sample problem and its results are presented. subroutine coint3me(method,deg,x,y,z,xname,yname,zname,number, lagx,lagy,lagz, speedx,speedy,speedz,tspeedx,tspeedy,tspeedz, dfx,dfy,dfz,adfx,adfy,adfz,dfres1,dfres2,dfres3, adfres1,adfres2,adfres3,dflag); /; Routine to drive coint2 using windows of data. Uses expanded Arg list /; method = 0 => use OLS /; ne 0 => implies uses GAM with degree deg /; deg = degree for gam /; x = Input series # 1 /; y = Input series # 2 /; z = Input series # 3 /; xname = Name of x series /; yname = Name of y series /; zname = Name of z series /; number = Number of observations in moving model /; lagx = Number of lags of X /; lagy = Number of lags of y /; speedx = Moving Error correction coefficient for x /; speedy = Moving Error correction coefficient for y /; speedz = Moving Error correction coefficient for z /; tspeedx = t-Stat for speedx /; tspeedy = t-stat for speedy /; tspeedz = t-stat for speedz /; dfx = Dickey Fuller Test on Raw Data Series x /; dfy = Dickey Fuller Test on Raw Data Series y /; dfz = Dickey Fuller Test on Raw Data Series z /; adfx = Augmented Dickey Fuller Test Raw Data Series x lag=dflag /; adfy = Augmented Dickey Fuller Test Raw Data Series y lag=dflag /; dfres1 = Dickey Fuller Test on RES1 Data Series /; dfres2 = Dickey Fuller Test on RES2 Data Series /; dfres3 = Dickey Fuller Test on RES3 Data Series /; adfres1 = Augmented Dickey Fuller Test RES1 Data Series lag=dflag /; adfres2 = Augmented Dickey Fuller Test RES2 Data Series lag=dflag /; adfres3 = Augmented Dickey Fuller Test RES3 Data Series lag=dflag

45 Essentials of Time Series Modeling

/; dflag = Lags for augmented DF test n=norows(x); if(n.ne.norows(y))then; call print('# of rows of x .NE. # of rows of y'); call stop; endif; if(n.ne.norows(z))then; call print('# of rows of x .NE. # of rows of z'); call stop; endif; if(n.le.number)then; call print('Number is too large given n',n,number); call stop; endif; nn=n-number+1; xwork =array(number:); ywork=array(number:); zwork=array(number:); speedx =array(nn:); speedy =array(nn:); speedz =array(nn:); tspeedx =array(nn:); tspeedy =array(nn:); tspeedz =array(nn:); dfx =array(nn:); dfy =array(nn:); dfz =array(nn:); adfx =array(nn:); adfy =array(nn:); adfz =array(nn:); dfres1 =array(nn:); dfres2 =array(nn:); dfres3 =array(nn:); adfres1 =array(nn:); adfres2 =array(nn:); adfres3 =array(nn:); ii=integers(number); call cls; call outstring(1,2,'Moving Cointegration Analysis'); call outstring(1,3,'Case Speedx Speedy Speedz t-1 t-2 t-3'); method2=0; m=0; alpha=0.0; mi=2; nk=30; if(method.ne.0)method2=2; do j=1,nn; xwork=x(j+ii-1); ywork=y(j+ii-1); zwork=z(j+ii-1); call coint3(method2,m,alpha,deg,mi,nk,xwork,ywork,zwork, xname,yname,zname,dfxa,dfya,dfza,adfxa,adfya,adfza, lagx,lagy,lagz,speedx1,speedy1,speedz1,tspeedx1,tspeedy1,tspeedz1, dfx2a,dfy2a,dfz2a,adfx2a,adfy2a,adfz2a, dflag,resid0,resid1,resid2,resid3,0); speedx(j) =speedx1; speedy(j) =speedy1; speedz(j) =speedz1; tspeedx(j)=tspeedx1; tspeedy(j)=tspeedy1; tspeedz(j)=tspeedz1; dfx(j) =dfxa; dfy(j) =dfya; dfz(j) =dfza; adfx(j) =adfxa; adfy(j) =adfya; adfz(j) =adfza; dfres1(j) =dfx2a; dfres2(j) =dfy2a; dfres3(j) =dfz2a; adfres1(j) =adfx2a; adfres2(j) =adfy2a; adfres3(j) =adfz2a; call outinteger(1,4,j); call outdouble(15,4,speedx1,'(e16.8)'); call outdouble(30,4,speedy1,'(e16.8)'); call outdouble(50,4,speedz1,'(e16.8)'); call outdouble(15,5,tspeedx1,'(e16.8)'); call outdouble(30,5,tspeedy1,'(e16.8)');

46 Essentials of Time Series Modeling call outdouble(50,5,tspeedz1,'(e16.8)'); enddo; return; end;

The test problem used was b34sexec options ginclude('b34sdata.mac') macro(coint6); b34srun; b34sexec matrix; call loaddata; call load(coint3); call load(coint3me); call print(coint3,coint3me); call character(xname,'Enders y Series'); call character(yname,'Enders z Series'); call character(zname,'Enders w Series'); call echooff; number=60; lagx=1; lagy=1; lagz=1; dflag=4; do method=0,1; deg=3.; call coint3me(method,deg,y,z,w,xname,yname,zname,number,lagx,lagy,lagz, speedx,speedy,speedz,tspeedx,tspeedy,tspeedz, dfx,dfy,dfz,adfx,adfy,adfz,dfres1,dfres2,dfres3, adfres1,adfres2,adfres3,dflag); if(method.eq.0)then; call graph(speedx,tspeedx :nocontact :pgborder :nolabel :grid :file 'coint3me_x.wmf' :heading 'Enders X Series OLS Moving Error Correction'); call graph(speedy,tspeedy :nocontact :pgborder :nolabel :grid :file 'coint3me_y.wmf' :heading 'Enders Y Series OLS Moving Error Correction'); call graph(speedz,tspeedz :nocontact :pgborder :nolabel :grid :file 'coint3me_z.wmf' :heading 'Enders Z series OLS Moving Error Correction'); call print('Moving EC Model estimated with OLS' :); call print('Window size was ',number:); call tabulate(speedx,speedy,speedz,tspeedx,tspeedy,tspeedz); speedx1=speedx; speedy1=speedy; speedz1=speedz; tspeedx1=tspeedx; tspeedy1=tspeedy; tspeedz1=tspeedz; endif; if(method.ne.0)then; call graph(speedx,tspeedx :nocontact :pgborder :nolabel :grid :file 'coint3me_x.wmf' :heading 'Enders X Series GAM Moving Error Correction');

47 Essentials of Time Series Modeling call graph(speedy,tspeedy :nocontact :pgborder :nolabel :grid :file 'coint3me_y.wmf' :heading 'Enders Y Series GAM Moving Error Correction'); call graph(speedz,tspeedz :nocontact :pgborder :nolabel :grid :file 'coint3me_z.wmf' :heading 'Enders Z series GAM Moving Error Correction'); call print('Moving EC Model estimated with GAM. Degree was',deg:); call print('Window size was ',number:); call tabulate(speedx,speedy,speedz,tspeedx,tspeedy,tspeedz); speedx2=speedx; speedy2=speedy; speedz2=speedz; tspeedx2=tspeedx; tspeedy2=tspeedy; tspeedz2=tspeedz; endif; enddo; call print(' ':); call print('1 => OLS model, 2 => GAM Model':); call tabulate( speedx1, speedx2, speedy1, speedy2, speedz1, speedz2); call tabulate(tspeedx1,tspeedx2,tspeedy1,tspeedy2,tspeedz1,tspeedz2); b34srun;

Edited results from running this command are:

1 => OLS model, 2 => GAM Model

Obs SPEEDX1 SPEEDX2 SPEEDY1 SPEEDY2 SPEEDZ1 SPEEDZ2 1 -0.4843 -0.4948 0.4625 0.6061 0.3358 0.4430 2 -0.4920 -0.4906 0.4703 0.6194 0.3524 0.4707 3 -0.5008 -0.5092 0.4594 0.5807 0.3360 0.4267 4 -0.4781 -0.4915 0.4624 0.5769 0.3628 0.4446 5 -0.4809 -0.4937 0.4327 0.5355 0.3209 0.3781 6 -0.4686 -0.4744 0.3827 0.4422 0.2829 0.3176 7 -0.4284 -0.4176 0.3854 0.4409 0.3154 0.3654 8 -0.3987 -0.3897 0.4229 0.4970 0.3448 0.4052 9 -0.4315 -0.4098 0.3007 0.3924 0.2630 0.3399 10 -0.4662 -0.4427 0.2707 0.3760 0.1515 0.2382 11 -0.4781 -0.4549 0.2708 0.3732 0.1405 0.2283 12 -0.4619 -0.4489 0.3063 0.4007 0.1562 0.2384 13 -0.4308 -0.4202 0.3049 0.3958 0.1863 0.2743 14 -0.4329 -0.4203 0.3539 0.4633 0.2304 0.3416 15 -0.4258 -0.4244 0.3520 0.4590 0.2618 0.3654 16 -0.5222 -0.5150 0.3930 0.5237 0.2673 0.4005 17 -0.5462 -0.5368 0.3079 0.4404 0.1983 0.3589 18 -0.6127 -0.6091 0.4468 0.5533 0.3569 0.4749 19 -0.7378 -0.6940 0.4487 0.5669 0.2307 0.4104 20 -0.7504 -0.6893 0.4707 0.6119 0.2071 0.4161 21 -0.7366 -0.6698 0.3992 0.5275 0.1365 0.3257 22 -0.7711 -0.7242 0.2555 0.3364 -0.1670E-01 0.1136 23 -0.7195 -0.6607 0.2020 0.3023 0.2150E-01 0.1696 24 -0.7034 -0.6491 0.2019 0.3030 0.4851E-01 0.1938 25 -0.6940 -0.6441 0.2231 0.3116 0.8386E-01 0.2153 26 -0.6810 -0.6265 0.1906 0.2884 0.5989E-01 0.1979 27 -0.7150 -0.6711 0.1800 0.2728 0.2500E-01 0.1533 28 -0.6537 -0.6013 0.1017 0.2064 0.4548E-01 0.1966 29 -0.5536 -0.5219 0.4380E-01 0.1665 0.8201E-01 0.2365 30 -0.5171 -0.4969 0.1191E-01 0.1278 0.9477E-01 0.2431 31 -0.4951 -0.4920 0.1385E-01 0.1197 0.1207 0.2537 32 -0.4195 -0.4214 -0.2028E-01 0.8398E-01 0.1541 0.2868 33 -0.4449 -0.4133 -0.7114E-01 0.8925E-01 0.9620E-01 0.3001 34 -0.5365 -0.5225 -0.1002 0.6112E-01 0.2953E-01 0.2222 35 -0.6161 -0.5906 -0.9295E-01 0.3707E-01 -0.8185E-01 0.1191 36 -0.5775 -0.5467 -0.1444 -0.5842E-01 -0.1039 0.6184E-01 37 -0.4825 -0.4588 -0.5885E-01 0.6404E-02 0.6303E-01 0.2024 38 -0.4686 -0.4469 -0.7354E-01 -0.5121E-02 0.6664E-01 0.2016 39 -0.4230 -0.4023 -0.7793E-01 -0.2065E-01 0.8812E-01 0.2176 40 -0.4620 -0.4451 -0.1146 -0.4016E-01 0.2346E-01 0.1583 41 -0.4228 -0.3947 -0.1332 -0.6055E-01 0.2277E-01 0.1574

48 Essentials of Time Series Modeling

Obs TSPEEDX1 TSPEEDX2 TSPEEDY1 TSPEEDY2 TSPEEDZ1 TSPEEDZ2 1 -2.831 -2.914 2.163 2.909 1.433 1.947 2 -2.842 -2.835 2.156 2.936 1.481 2.047 3 -2.862 -2.913 2.049 2.612 1.373 1.771 4 -2.759 -2.840 2.082 2.621 1.493 1.857 5 -2.699 -2.757 1.905 2.366 1.348 1.616 6 -2.802 -2.828 1.679 1.898 1.183 1.336 7 -2.496 -2.371 1.747 1.953 1.332 1.546 8 -2.285 -2.200 1.884 2.193 1.432 1.680 9 -2.518 -2.367 1.311 1.721 1.102 1.436 10 -2.797 -2.624 1.209 1.693 0.6361 1.004 11 -2.937 -2.822 1.215 1.694 0.5864 0.9567 12 -2.753 -2.691 1.340 1.773 0.6361 0.9759 13 -2.556 -2.512 1.335 1.759 0.7554 1.122 14 -2.493 -2.430 1.556 2.101 0.9367 1.417 15 -2.360 -2.351 1.499 2.009 1.026 1.462 16 -2.853 -2.792 1.628 2.256 1.015 1.581 17 -2.631 -2.552 1.129 1.708 0.6704 1.258 18 -2.957 -2.949 1.616 2.122 1.155 1.607 19 -3.314 -3.040 1.501 2.015 0.6873 1.264 20 -3.338 -2.982 1.519 2.138 0.5964 1.258 21 -3.395 -2.990 1.276 1.805 0.3923 0.9825 22 -3.591 -3.269 0.8013 1.108 -0.4736E-01 0.3332 23 -3.401 -3.044 0.6463 1.013 0.6226E-01 0.5072 24 -3.215 -2.879 0.6497 1.020 0.1426 0.5824 25 -3.156 -2.837 0.7195 1.043 0.2479 0.6462 26 -3.116 -2.775 0.6077 0.9521 0.1750 0.5871 27 -3.256 -2.936 0.5669 0.8861 0.7224E-01 0.4480 28 -3.138 -2.794 0.3165 0.6662 0.1357 0.6019 29 -2.650 -2.404 0.1420 0.5545 0.2542 0.7470 30 -2.443 -2.268 0.3914E-01 0.4286 0.2973 0.7738 31 -2.368 -2.273 0.4592E-01 0.4037 0.3824 0.8153 32 -2.026 -1.972 -0.6933E-01 0.2943 0.4787 0.9127 33 -2.075 -1.880 -0.2345 0.3033 0.2855 0.9270 34 -2.423 -2.275 -0.3322 0.2093 0.8819E-01 0.6825 35 -2.866 -2.664 -0.3186 0.1313 -0.2502 0.3750 36 -2.766 -2.548 -0.5113 -0.2125 -0.3288 0.2006 37 -2.388 -2.227 -0.2230 0.2481E-01 0.2069 0.6852 38 -2.296 -2.182 -0.2828 -0.2061E-01 0.2183 0.7098 39 -2.079 -1.967 -0.2886 -0.8050E-01 0.2761 0.7317 40 -2.285 -2.194 -0.4234 -0.1547 0.7333E-01 0.5296 41 -2.070 -1.948 -0.5027 -0.2347 0.7239E-01 0.5364

Note that the x or first series was in fact the Enders y series. Based on the way that coint3 works, y was on the left of equation (6.1-12). The moving model shows that the y series speed of adjustment term was significant for all windows while the other speed of adjustment coefficients were mostly not significant. Cointegration is an important concept.

6.6 Cointegration Tests using the Stock-Watson Approach

The Stock-Watson (1993) approach to cointegration testing involving a two series model provides an alternative estimate to b1 in (6.1-12). The dynamic OLS model (DOLS) estimated is

p

yt=b0 + b 1 x t + d j D x t- j + u t (6.6-1) j=- p

and contains both future and past values of Dx . If ytand x t are cointegrated, the DOLS estimator of b1 is efficient and the heteroskedasticity corrected standard errors (White) are valid with a t statistic that has a standard normal distribution in large samples. If b1 is significant, (6.2-2) can be estimated as

49 Essentials of Time Series Modeling

m m ˆ Dyt =a1 + a 2( y t- 1 - b 1 x t - 1 ) +邋 A 11 ( i ) D y t - i + A 12 ( i ) D x t - 1 + e yt i=1 i = 1 m m (6.6-2) ˆ Dxt =a3 - a 4( y t- 1 - b 1 x t - 1 ) +邋 A 21 ( i ) D y t - i + A 22 ( i ) D x t - 1 + e xt i=1 i = 1

where the same cointegrating vector is imposed on both series and b1 was estimated in (6.6-1). The Stock-Watson (1993) approach is easily extended to more than two series by explicitly adding positive and negative lags of the differences of the other series and estimating level terms for each of the other series. Stock-Watson (2007, 661) cautions

"Even if economic theory does not suggest a specific value for the cointegration coefficient, it is important to check whether the estimated cointegrating relationship makes sense in practice. Because cointegration tests can be misleading (they can improperly reject the null hypothesis of no cointegration more frequently than they should, and frequently they improperly fail to reject the null), it is especially important to rely on economic theory, institutional knowledge, and common sense when estimating and using cointegrating relationships."

Based on the experience of this author, this warning is appropriate. Stock-Watson (2007, 664) provide a simplified example of (6.6-2) where it is assumed that the cointegrating vector b1 =1. Here the estimating equation becomes

m m

Dyt =a1 + a 2( y t- 1 - x t - 1 ) +邋 A 11 ( i ) D y t - i + A 12 ( i ) D x t - 1 + e yt i=1 i = 1 m m (6.6-3)

Dxt =a3 - a 4( y t- 1 - x t - 1 ) +邋 A 21 ( i ) D y t - i + A 22 ( i ) D x t - 1 + e xt i=1 i = 1 A program that implements the Stock-Watson suggestions to analyze the Enders y, w and z series is shown next.

b34sexec options ginclude('b34sdata.mac') macro(coint6); b34srun; b34sexec matrix; call loaddata; call load(coint_sw); call character(xname,'Enders y Series'); call character(yname,'Enders z Series'); call character(zname,'Enders w Series'); call echooff;

iprint=0; maxlag=4;

call coint_sw(catcol(y,z,w),10,res1,ec_coef,ec_vec, const,shock,iprint); if(iprint.eq.0)then; call print('Stock-Watson DOLS Estimation with maxlag = ',maxlag:); call print('Estimate of Cointegrating Vector ',ec_coef); call print('Estimate of constant ',const:); call graph(ec_vec,y,shock :nolabel :grid :pgborder :nocontact :heading 'Error Correction Vector' :file 'sw.wmf'); call graph(res1 :heading 'Residual from DOLS Model ' :grid :pgborder :nocontact);

50 Essentials of Time Series Modeling

b34srun;

It makes use of the subroutine coint_sw which is shown next:

Subroutine coint_sw(xvar,maxlag,res1,ec_coef,ec_vec,const,shock,iprint); /; /; Estimate Stock-Watson (1993) Cointegration test /; See Stock, James and Mark Watson. /; "A Simple Estimator of Cointegrating Vectoprs in higher /; order systems" Econometrica (61(4) (1993) : pp 783-820 /; /; Setup for VECM (Vector Error Component Analysis) /; /; xvar = matrix of variables for VECM /; maxlag = Maximum lag in plus and minus direction /; res1 = Residual from DOLS equation. Check acf to see if /; maxlag is set high enough /; ec_coef = Error Correction Coefficients /; ec_vec = Error Correction Vector /; const = mean(y-ec_vec); /; shock = y-ec_vec-const /; iprint = ne 0 => print estimated equation /; /; Built October 2009 by Houston H. Stokes /; Modifications made April 2011 for > 3 series /; n=norows(xvar); k=nocols(xvar); /; /; get error correction term /; difx1=dif(xvar(,2)); maxlag2=(-1)*maxlag; call lagmatrix(difx1{maxlag2 to maxlag} :noint :matrix difx);

if(k.gt.2)then; do i=3,k; difx1=dif(xvar(,i)); call lagmatrix(difx1{maxlag2 to maxlag} :noint :matrix difx2); difx=catcol(difx,difx2); enddo; endif;

/; y=xvar(,1); /; y=dropfirst(y,maxlag+1); /; y= droplast(y,maxlag ); /; y=submatrix(xvar,maxlag+2,n-maxlag,1,1); /; /; add levels to the first of difx /; do i=2,k; /; xwork=dropfirst(xvar(,i),maxlag+1); /; xwork=droplast(xwork,maxlag); difx=catcol(submatrix(xvar,maxlag+2,n-maxlag,i,i),difx); enddo; /; if(iprint.ne.0)call olsq(y,difx :qr :print); if(iprint.eq.0)call olsq(y,difx :qr);

res1=%res; kk=integers(1,k-1); ec_coef=%coef(kk); ec_vec = -1.*(mfam(submatrix(xvar,1,n,2,k))*ec_coef); shock = vfam(xvar(,1))-ec_vec; const = mean(shock); shock = shock-const;

if(iprint.ne.0)then;

51 Essentials of Time Series Modeling

call print(' ':); call print('Estimate of Cointegrating Coef',ec_coef); call print('Estimate of Constant ',const:); endif;

return; end;

Output and graphs are:

Stock-Watson DOLS Estimation with maxlag = 4

Estimate of Cointegrating Vector

EC_COEF = Vector of 2 elements

1.01324 -0.948553

Estimate of constant -0.4129915418376106

Error Correction Vector

1

0

-1

-2 E Y S C H -3 _ O V C E K -4 C

-5

-6

0 10 20 30 40 50 60 70 80 90 100 Obs

The estimated cointegrating vector 1.01324 -0.948553 is consistent with what Enders reports. If the maxlag value is changed, these values will change. Inspection of the residuals of the DOLS equation, available in the variable res1, can be inspected to help in determining the appropriate lag. In a VECM with k lags there can be at most k-1 cointegrating vectors. The

52 Essentials of Time Series Modeling

Johansen approach, discussed next, will give some insight how many of these vectors there indeed are.

6.7 Cointegration Tests using the Johansen Approach

Johansen (1988, 1991) proposed a systems approach that is substantially more complex that the prior two methods discussed. After first summarizing the Johansen methods in some detail following Greene (2008, 763) and Davidson-MacKinnon (2004, 640-644), a B34S subroutine CATS that implements these methods is shown. The Enders (2004) example is used as a test case. Rats output is used to validate what is being calculated. While Rats and B34S are shown to be producing the same answers for the eigenvalues and the max and trace eigenvalue tests,, the results in Enders are shown to be somewhat different.

Assume the vector of M variables in the VAR are contained in yt and that the lag length has be set as r using the appropriate test. The first step is to estimate the level equation

p yt= G i y t- i + u t (6.7-1) i=1

Define

zt=[ D y t-1 , D y t - 2 ,..., D y t - p - 1 ] (6.7-2)

For the M variables in y define

D= the residuals in the regression of Dyton z t (6.7-3)

E= the residuals in the regression of yt- pon z t (6.7-4)

The M 2 squared canonical correlations between the columns in D and those in E can be shown to be the ordered characteristic roots (eigenvalues) of the symmetric matrix

*- .5 - 1 - .5 R= RDD R DE R EE R ED R DD (6.7-5)

where Ri, j is the cross-correlation matrix between the variables in set i and set j. The null hypothesis that there are r or fewer cointegrating vectors is tested using

M * 2 l(trace)= -N ln[1 - ( ri ) ] (6.7-6) i= r +1

* where ri is the ordered eigenvalue or squared canonical correlation. The statistic l(maximum) can be used to test if there are any cointegrating vectors (r=0) against the hypothesis that there are indeed at least one cointegrating vector. Inspection of l(trace) can be used to test how many

53 Essentials of Time Series Modeling cointegrating vectors. The critical values of this test for p-r cointegrating vectors as suggested by Dorniik (1998) are

4.07 12.28 24.21 40.10 59.96 83.82 111.68 143.53 179.38 219.23 263.09 310.94 for p-r = 1,2,…,12.

A specific test was proposed by Davidson-MacKinnon (2004, 641) who define

'ˆ ˆ- 1 ˆ A 篠yDD DES EE S ED yˆ DD (6.7-7)

'- 1 * where yˆDD y ˆ DD= S DD . Although A R , the eigenvalues are the same. If these eigenvalues and their corresponding eigenvectors X are reordered, then the first r columns of

Z =yˆ DD X (6.7-8) are the maximum likehood estimates of hˆ where from

p

Dyt = x t B + y t-1p + D y t - i G i + u t (6.7-9) i=1 p= ha ' (6.7-10)

Note that yt is a N by k matrix of data and xt is a constant and or trend term that may or may not be in the model. Equation (6.7-9) is in error correction form. It can be reparameterized as

P+1 yt= x t B + y t- if i + u t (6.7-11) i=1

Where Gp = -f p+1, G i = G i + 1 - f i + 1 and

p+1 p= fi - I k (6.7-12) i=1

The below listed program implements these ideas using the Enders (2004, 2010) example as a test case. Rats output is also shown.

/; /; Rats job verifies the B34S cats routine /; %b34slet runrats=0; b34sexec options ginclude('b34sdata.mac')

54 Essentials of Time Series Modeling

macro(coint6); b34srun; b34sexec matrix; call loaddata; call load(cats); call echooff;

/; call cats(y,maxlag,eigval,eigvec,lamtrace,lammax, /; alpha,beta,pi,icon,itrend,iprint,ieprint); /; /; Implements Johansen (1988, ,1992) Cointegration Testing Methods /; as discussed in William Greene 2008, pp 761-767 /; /; See also Russell Davidson and James MacKinnon /; 'Econometric Theory and Methods' (2004) 640-641.

/; y = basic data of VAR model to be tested /; maxlag = must be ge 1 /; eigval = ordered eigenvalues /; eigvec = ordered eigenvectors /; lamtrace = eigenvalue trace test /; lammax = eigenvalue max test /; alpha = Speed of adjustment matrix /; beta = /; pi = alpha * transpose(beta) /; icon = 1 => have constant in model /; itrend = 1 => have trend in the model /; testtab = Test table /; iprint = 1 => print results /; ieprint = 1 => 0 to print steps /; /; Basic code implemented September 2009 by Houston H. Stokes /; big_x =catcol(y,z,w ); iprint =0; maxlag =1; icon =1; itrend =1; ieprint =0;

/;call cats(big_x,maxlag,eigval,eigvec,ltrace,lmax,iprint, /; icon,itrend,idebug); /; one series setup/ /; big_x=matrix(100,1:y); do maxlag=1,3; call cats(big_x,maxlag,eigval,eigvec,ltrace,lmax, alpha,beta,pi,0,0,iprint,ieprint); call cats(big_x,maxlag,eigval,eigvec,ltrace,lmax, alpha,beta,pi,1,0,iprint,ieprint); call cats(big_x,maxlag,eigval,eigvec,ltrace,lmax, alpha,beta,pi,0,1,iprint,ieprint); call cats(big_x,maxlag,eigval,eigvec,ltrace,lmax, alpha,beta,pi,1,1,iprint,ieprint); enddo; b34srun;

55 Essentials of Time Series Modeling

%b34sif(&runrats.ne.0)%then; /; /; Note that lag = k for rats is lag=k-1 for the B34S CATS program. /; Eigenvalues lamda(trace) and lamda(max) agree across programs. /; Normalization for Alpha and beta do not agree. /; b34sexec options ginclude('b34sdata.mac') macro(coint6); b34srun; b34sexec data set; rename w=w_new; rename z=z_new; rename y=y_new; b34srun; b34sexec options open('rats.dat') unit(28) disp=unknown$ b34srun$ b34sexec options open('rats.in') unit(29) disp=unknown$ b34srun$ b34sexec options clean(28)$ b34srun$ b34sexec options clean(29)$ b34srun$ b34sexec pgmcall$ rats passasts pcomments('* ', '* Data passed from B34S(r) system to RATS', '* ', "display @1 %dateandtime() @33 ' Rats Version ' %ratsversion()" '* ') $ PGMCARDS$ * source(noecho) d:\r\johmle.src

@johmle(lags=2) * * # y_new z_new w_new open copy c:\b34swork\coint.txt

@johmle(lags=3) * * # y_new z_new w_new open copy c:\b34swork\coint.txt * b34sreturn$ b34srun $ b34sexec options close(28)$ b34srun$ b34sexec options close(29)$ b34srun$ b34sexec options /$ dodos(' rats386 rats.in rats.out ') dodos('start /w /r rats32s rats.in /run') dounix('rats rats.in rats.out')$ B34SRUN$ b34sexec options npageout WRITEOUT('Output from RATS',' ',' ') COPYFOUT('rats.out') dodos('ERASE rats.in','ERASE rats.out','ERASE rats.dat') dounix('rm rats.in','rm rats.out','rm rats.dat') $ B34SRUN$ %b34sendif;

56 Essentials of Time Series Modeling

The above program makes use of the subroutine cats which is listed below.

subroutine cats(y,maxlag,eigval,eigvec,lamtrace,lammax, alpha,beta,pi,icon,itrend,iprint,ieprint); /; /; Implements Johansen (1988, ,1992) Cointegration Testing Methods /; as discussed in William Greene 2008, pp 761-767 /; /; See also Russell Davidson and James MacKinnon /; 'Econometric Theory and Methods' (2004) 640-641. /; /; This routine is experimental. It is intended as a first pass at /; testing for cointegration using the Johansen method. For more /; extended analysis, see "CATS in Rats" which was developed under /; Johansen and is available from Estima. /; /; y = basic data of VAR model to be tested /; maxlag = must be ge 1 /; eigval = ordered eigenvalues /; eigvec = ordered eigenvectors /; lamtrace = eigenvalue trace test /; lammax = eigenvalue max test /; alpha = Speed of adjustment matrix /; beta = BIG_Z=psi(dd)*eigvec /; psi(dd)*transpose(psi(dd)=inv(sigma(dd)) /; beta is first k by k matrix in big_Z /; pi = alpha * transpose(beta) /; icon = 1 => have constant in model /; itrend = 1 => have trend in the model /; testtab = Test table /; iprint = 1 => print extended results /; ieprint = 1 => print steps /; /; Basic code implemented in Beta release September 2009. /; Improvements October 2011 /; by Houston H. Stokes /; k=nocols(y); n=norows(y); new_y=y; nn=n-maxlag-1;

/; Row 1 95% of Table C.1 trace test of CATS Manual /; Row 2 95% of Table C.3 of Cats Manual /; Rom 3 ? /; Row 4 95% of Table C.1 cointegrating rank Cats manual

testtab=array(4,12: 4.07 12.28 24.21 40.10 59.96 83.82 111.68 143.53 179.38 219.23 263.09 310.94 3.84 15.41 29.80 47.71 69.61 95.51 125.42 159.32 197.22 239.12 285.02 334.92

57 Essentials of Time Series Modeling

3.84 18.15 34.56 54.11 77.79 104.76 135.75 170.15 208.53 250.53 296.02 345.27 9.14 20.16 35.07 53.94 76.81 103.68 134.54 169.41 208.27 251.13 297.99 348.85); testtab=transpose(testtab);

/; if(iprint.ne.0)then; call print(' ':); call print('CATS B34S Version - Beta Test October 2011':); call print('Number of observations in raw series ',n:); call print('Number of series ',k:); call print('Number of lags ',maxlag:); call print('Number of Data points for analysis ',nn:); if(icon .ne.0 )call print('Constant assumed':); if(icon .eq.0 )call print('Constant not assumed':); if(itrend.ne.0)call print('Trend assumed':); if(itrend.eq.0)call print('Trend not assumed':); call print(' ':); /; endif;

/; ydif=matrix(n-1,k:); /; do i=1,k; ydif(,i)=dif(y(,i),1,1); enddo; /; /; d = residuals of delta y on z /; e = residuals of y(t-p) on z /; d=matrix(nn,k*(maxlag):); e=matrix(nn,k*(maxlag):); /; /; build z /; z=lag(ydif,1); if(maxlag.gt.1)then; do i=2,maxlag; z=catcol(z,lag(ydif,i)); enddo; endif; z=goodrow(z); if(nn.ne.norows(z))then; call print('ERROR: Logic error in cats - nn .ne. norows(z)':); call print(' nn was ',nn:); call print(' norows(z) was ',norows(z):); call stop; endif; n1=norows(ydif); n2=norows(z); if(n1.gt.n2)then;

58 Essentials of Time Series Modeling ydif2=dropfirst(ydif,n1-n2); ydif2=goodrow(ydif2); endif; yt_m_p=goodrow(lag(y,1)); n3=norows(yt_m_p); if(n3.gt.n2)then; yt_m_p = dropfirst(yt_m_p,n3-n2); yt_m_p= goodrow(yt_m_p); endif;

/; /; get d=> get residuals of delta y on z /; trend=dfloat(integers(1,norows(z))); one=array(norows(z):)+1.; arg=' '; if(itrend.ne.0.and.icon.eq.0)arg='trend'; if(itrend.ne.0.and.icon.ne.0)arg='trend one'; if(itrend.eq.0.and.icon.ne.0)arg='one'; /; do i=1,k; if(ieprint.ne.0)call print(' ':); if(ieprint.ne.0)call print('Delta y = f(z,t) for series ',i:); if(ieprint.ne.0)call olsq(ydif2(,i) z argument(arg) :noint :qr :print); if(ieprint.eq.0)call olsq(ydif2(,i) z argument(arg) :noint :qr ); d(,i)=%res; enddo; /; /; get e=> get residuals of y(t-p) on z /; do i=1,k; if(ieprint.ne.0)call print(' ':); if(ieprint.ne.0)call print('y(t-p) = f(z,t) for series ',i:); if(ieprint.ne.0)call olsq(yt_m_p(,i) z argument(arg) :noint :qr :print); if(ieprint.eq.0)call olsq(yt_m_p(,i) z argument(arg) :noint :qr ); e(,i)=%res; enddo; /; rdd=matrix(k,k:); rde=matrix(k,k:); ree=matrix(k,k:); red=matrix(k,k:); /; do i=1,k; do j=1,k; rdd(i,j)=ccf(d(,i),d(,j)); rde(i,j)=ccf(d(,i),e(,j)); ree(i,j)=ccf(e(,i),e(,j)); red(i,j)=ccf(e(,i),d(,j)); enddo; enddo; /; if(ieprint.ne.0)then; call print(rdd,rde,ree,red);

59 Essentials of Time Series Modeling call print(ydif2,yt_m_p,z,d,e); endif; /; pp=-.5; rstar = real(complex(rdd)**complex(pp))*rde*inv(ree)*red *real(complex(rdd)**complex(pp)); /; /; eigval= eigenval(rstar,eigvec :lapack); /; eigval= seigenval(rstar,eigvec); alpha=eigval; beta =eigvec; jj=0; /; lamtrace=vector(k:); lammax =vector(k:); /; do i=k,1,-1; jj=jj+1; eigval(jj)=alpha(i); eigvec(,jj)=beta(,i); lammax(jj) =dfloat(((-1)*nn))*(dlog(1.- eigval(jj))); enddo; /; lamtrace(k)=lammax(k); lm_test=lammax*missing(); tr_test=lammax*missing(); jj=1; if(k.le.12)then; do i=k,1,-1; lm_test(jj)=testtab(i,2); tr_test(jj)=testtab(i,1); jj=jj+1; enddo; endif; /; if(k.gt.1)then; do i=k-1,1,-1; lamtrace(i)=lammax(i)+lamtrace(i+1); enddo; endif; /; /; if(iprint.ne.0)then; call tabulate(eigval,lammax,lamtrace,lm_test,tr_test); call print(' ':); call print('lm_test 95% for LR test. Cats Manual Table C3':); call print('value > critical value => Rejects null of r=0.':); call print('tr_test 95% for trace test. Cats Manual Table C1':); call print('value > critical value => variables are cointegrated.':); if(iprint.ne.0)then; call print('R_star',rstar); call print('Eigenvector of rstar',eigvec); tt1=eig(rstar,tt :lapack); tt=real(tt);

60 Essentials of Time Series Modeling call print('scaled',tt); endif;

/; /; get alpha, beta and pi /; /; what Davidson-MacKinnon call 22 is dd in Greene's notation /; psi_dd= transpose(pdfac(inv(rdd))); /; before reordering eigval2=seigenval(rstar,eigvec2); big_z=psi_dd*eigvec ; /; /; validate calculation so far /; if(iprint.ne.0)then; testbeta=transpose(big_z)*rdd*big_z; call print('psi_ee,big_z, is testbeta=I ?',psi_dd,big_z,testbeta); rstar2 = transpose(psi_dd)*rde*inv(ree)*red*psi_dd; call print('are eig of rstar2 = to eigenvalues of rstar?',seig(rstar2)); endif;

/; /; Now get pi from coef of y = f(x y(lags) ) as coef- I /; ylag= lag(y,1); if(maxlag.gt.1)then; do i=2,maxlag; ylag=catcol(ylag,lag(ylag,i)); enddo; endif; ylag=goodrow(ylag); pi=matrix(k,k:); kk=integers(1,k); yt_m_p=y; n2=norows(ylag); n3=norows(yt_m_p); if(n3.gt.n2)then; yt_m_p = dropfirst(yt_m_p,n3-n2); yt_m_p= goodrow(yt_m_p); endif; trend=dfloat(integers(1,norows(ylag))); one=array(norows(ylag):)+1.; beta=submatrix(big_z,1,k,1,k); do i=1,k; if(ieprint.ne.0)call print(' ':); if(ieprint.ne.0)call print('Level Equation for series ',i:); if(ieprint.ne.0) call olsq(yt_m_p(,i) ylag argument(arg) :noint :qr :print);

61 Essentials of Time Series Modeling if(ieprint.eq.0) call olsq(yt_m_p(,i) ylag argument(arg) :noint :qr ); pi(i,)=%coef(kk); enddo; ii=matrix(k,k:); ii(kk,kk)=1.0; pi=pi-ii; alpha = mfam(pi)*inv(transpose(beta)); if(iprint.ne.0)then; call print('Alpha - Weight matrix ',alpha); call print('Beta = Cointegrating Parms',beta); call print('Pi ',pi); call print('Eigenvalues of Estimate of Impact Matrix pi',eig(pi)); endif; return; end;

The Enders test case was estimated for 1-2 lags for four models. These included no constant or trend, a constant but no trend, a trend but no constant and a constant and a trend. Edited results from running these examples are:

B34SI 8.11F (D:M:Y) 11/10/11 (H:M:S) 8: 2: 5 DATA STEP

Variable # Cases Mean Std Deviation Variance Maximum Minimum

Y 1 100 -4.281073400 1.414861186 2.001832177 -1.251250000 -6.330700000 Z 2 100 -2.143733840 1.795117829 3.222448020 0.6257030000 -5.704060000 W 3 100 -6.367795000 2.391437806 5.718974780 -1.446050000 -9.684840000 CONSTANT 4 100 1.000000000 0.000000000 0.000000000 1.000000000 1.000000000

Number of observations in data file 100 Current missing variable code 1.000000000000000E+031

B34SI Matrix Command. d/m/y 11/10/11. h:m:s 8: 2: 5.

=> CALL LOADDATA$

=> CALL LOAD(CATS)$

=> CALL ECHOOFF$

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 1 Number of Data points for analysis 98 Constant not assumed Trend not assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.3254 38.58 54.84 29.80 24.21 2 0.1329 13.98 16.26 15.41 12.28 3 0.2304E-01 2.285 2.285 3.840 4.070

lm_test 95% for LR test. Cats Manual Table C3

62 Essentials of Time Series Modeling

value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 1 Number of Data points for analysis 98 Constant assumed Trend not assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.3254 38.58 55.10 29.80 24.21 2 0.1333 14.02 16.53 15.41 12.28 3 0.2528E-01 2.509 2.509 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 1 Number of Data points for analysis 98 Constant not assumed Trend assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.3148 37.05 55.31 29.80 24.21 2 0.1546 16.46 18.26 15.41 12.28 3 0.1819E-01 1.799 1.799 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 1 Number of Data points for analysis 98 Constant assumed Trend assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.3066 35.88 49.50 29.80 24.21 2 0.1292 13.55 13.62 15.41 12.28 3 0.6640E-03 0.6510E-01 0.6510E-01 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 2 Number of Data points for analysis 97 Constant not assumed Trend not assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2481 27.66 47.41 29.80 24.21 2 0.1682 17.86 19.74 15.41 12.28 3 0.1919E-01 1.879 1.879 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011

63 Essentials of Time Series Modeling

Number of observations in raw series 100 Number of series 3 Number of lags 2 Number of Data points for analysis 97 Constant assumed Trend not assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2482 27.68 47.84 29.80 24.21 2 0.1685 17.90 20.16 15.41 12.28 3 0.2299E-01 2.256 2.256 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 2 Number of Data points for analysis 97 Constant not assumed Trend assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2719 30.78 56.01 29.80 24.21 2 0.2132 23.26 25.23 15.41 12.28 3 0.2015E-01 1.974 1.974 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 2 Number of Data points for analysis 97 Constant assumed Trend assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2722 30.82 51.25 29.80 24.21 2 0.1892 20.34 20.43 15.41 12.28 3 0.9348E-03 0.9072E-01 0.9072E-01 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 3 Number of Data points for analysis 96 Constant not assumed Trend not assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2175 23.55 39.08 29.80 24.21 2 0.1343 13.84 15.54 15.41 12.28 3 0.1754E-01 1.699 1.699 3.840 4.070 lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 3 Number of Data points for analysis 96 Constant assumed

64 Essentials of Time Series Modeling

Trend not assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2174 23.53 39.53 29.80 24.21 2 0.1344 13.85 15.99 15.41 12.28 3 0.2203E-01 2.139 2.139 3.840 4.070

lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 3 Number of Data points for analysis 96 Constant not assumed Trend assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2314 25.26 45.57 29.80 24.21 2 0.1687 17.74 20.31 15.41 12.28 3 0.2642E-01 2.570 2.570 3.840 4.070

lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

CATS B34S Version - Beta Test October 2011 Number of observations in raw series 100 Number of series 3 Number of lags 3 Number of Data points for analysis 96 Constant assumed Trend assumed

Obs EIGVAL LAMMAX LAMTRACE LM_TEST TR_TEST 1 0.2331 25.48 41.47 29.80 24.21 2 0.1507 15.68 16.00 15.41 12.28 3 0.3310E-02 0.3183 0.3183 3.840 4.070

lm_test 95% for LR test. Cats Manual Table C3 value > critical value => Rejects null of r=0. tr_test 95% for trace test. Cats Manual Table C1 value > critical value => variables are cointegrated.

B34S Matrix Command Ending. Last Command reached.

Space available in allocator 59856817, peak space used 102011 Number variables used 308, peak number used 331 Number temp variables used 8770, # user temp clean 0

Number of observations in data file 100 Current missing variable code 1.000000000000000E+031

Output from RATS

* * Data passed from B34S(r) system to RATS * display @1 %dateandtime() @33 ' Rats Version ' %ratsversion() 10/11/2011 08:02 Rats Version 8.01000 * CALENDAR(IRREGULAR) ALLOCATE 100 OPEN DATA rats.dat DATA(FORMAT=FREE,ORG=OBS, $ MISSING= 0.1000000000000000E+32 ) / $ Y_NEW $ Z_NEW $ W_NEW $ CONSTANT SET TREND = T TABLE Series Obs Mean Std Error Minimum Maximum

65 Essentials of Time Series Modeling

Y_NEW 100 -4.28107340 1.41486119 -6.33070000 -1.25125000 Z_NEW 100 -2.14373384 1.79511783 -5.70406000 0.62570300 W_NEW 100 -6.36779500 2.39143781 -9.68484000 -1.44605000 TREND 100 50.50000000 29.01149198 1.00000000 100.00000000

* source(noecho) d:\r\johmle.src @johmle(lags=2) * * # y_new z_new w_new

Likelihood Based Analysis of Cointegration Variables: Y_NEW Z_NEW W_NEW Estimated from 3 to 100 Data Points 98 Lags 2 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -52.2607 1 0.3254 38.5761 55.1027 29.8000 -32.9726 2 0.1333 14.0172 16.5267 15.4100 -25.9640 3 0.0253 2.5094 2.5094 3.8400 -24.7093

Cointegrating Vector for Largest Eigenvalue Y_NEW Z_NEW W_NEW -4.101723 -4.252296 4.171202

open copy c:\b34swork\coint.txt @johmle(lags=3) * * # y_new z_new w_new

Likelihood Based Analysis of Cointegration Variables: Y_NEW Z_NEW W_NEW Estimated from 4 to 100 Data Points 97 Lags 3 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -45.0809 1 0.2482 27.6759 47.8361 29.8000 -31.2429 2 0.1685 17.9041 20.1602 15.4100 -22.2909 3 0.0230 2.2561 2.2561 3.8400 -21.1628

Cointegrating Vector for Largest Eigenvalue Y_NEW Z_NEW W_NEW -5.115275 -5.268698 5.222082

The next example is validated in the RATS test case # 1 shown at the end of this section. Note that the results for B34S and RATS agree. For the eigenvalues Enders (2004, 364-365, 2010, 403-404) gets .3260, .14032 and .033168 on the p matrix . For the summary measures the results reported were

l(trace)= 56.786 and l (max) = 38.663 forr = 0 l(trace)= 18.123 and l (max) = 14.817 forr = 1 l(trace)= 3.306 and l (max) = 3.306 forr = 2 which suggest one cointegrating vector.

6.8 Tests on the Johansen and Engle-Granger Procedures

The Johansen procedure is intended to be used when there are unit root series that are potentially cointegrated. Of interest is what will the test show if the input series do not in fact have unit roots. The Engle Granger test is also shown for these cases. The below listed Rats code investigates these cases.

66 Essentials of Time Series Modeling display @1 %dateandtime() @33 ' Rats Version ' %ratsversion() * source egtest.src source johmle.src allocate 2000 compute nob = 4000 clear random_1 clear unitroot_1 clear coint_1 clear random_2 clear unitroot_2 clear coint_2 clear random_3 clear unitroot_3 clear coint_3 clear eg_random clear eg_unit clear eg_coint clear df_a clear df_b clear df_c clear df_aunit clear df_bunit clear df_cunit clear df_cunitc smpl 1 nob

* n sets number of trials compute n = 1000

* lag sets # of lags to be used in johmle call compute lag = 6

* nob sets number os observations in the series that are generated do cases=1,n set a = %ran(1.0) set b = %ran(1.0) set c = %ran(1.0) set error = %ran(1.0) accumulate a 1 nob aunit accumulate b 1 nob bunit accumulate c 1 nob cunit set cunitc = aunit+bunit+error * print * * a b c aunit bunit cunit cunitc

* linreg cunit * # constant cunitc

67 Essentials of Time Series Modeling

* linreg cunit * # constant aunit bunit

* linreg cunitc * # constant aunit bunit if cases <= 2 {

@johmle(lags=lag,det=constant,tracetests=random, $ title='random series - no unit root') # a b c

@egtest(lags=lag,det=constant) # a b c compute eg_random(cases) = %cdstat

* ======

@johmle(lags=lag,det=constant,tracetests=unitroot, $ title='Unit root series no coint') # cunit aunit bunit

@egtest(lags=lag,det=constant) # cunit aunit bunit compute eg_unit(cases) = %cdstat

* ======

@johmle(lags=lag,det=constant,tracetests=coint, $ title='Unit root series with cointegration') # cunitc aunit bunit

@egtest(lags=lag,det=constant) # cunitc aunit bunit compute eg_coint(cases) = %cdstat display random display unitroot display coint

@dfunit(print) a compute df_a(cases) = %cdstat

@dfunit(print) b compute df_b(cases) = %cdstat

@dfunit(print) c compute df_c(cases) = %cdstat

@dfunit(print) aunit compute df_aunit(cases) = %cdstat

@dfunit(print) bunit compute df_bunit(cases) = %cdstat

68 Essentials of Time Series Modeling

@dfunit(print) cunit compute df_cunit(cases) = %cdstat

@dfunit(print) cunitc compute df_cunitc(cases) = %cdstat

} if cases > 2 {

@johmle(lags=lag,det=constant,tracetests=random,noprint, $ title='randon series - no unit root') # a b c

@egtest(lags=lag,det=constant,noprint) # a b c compute eg_random(cases) = %cdstat

* ======

@johmle(lags=lag,det=constant,tracetests=unitroot,noprint, $ title='Unit root series no coint') # cunit aunit bunit

@egtest(lags=lag,det=constant,noprint) # cunit aunit bunit compute eg_unit(cases) = %cdstat

* ======

@johmle(lags=lag,det=constant,tracetests=coint,noprint, $ title='Unit root series with cointegration') # cunitc aunit bunit

@egtest(lags=lag,det=constant,noprint) # cunitc aunit bunit compute eg_coint(cases) = %cdstat

* ======

@dfunit(noprint) a compute df_a(cases) = %cdstat

@dfunit(noprint) b compute df_b(cases) = %cdstat

@dfunit(noprint) c compute df_c(cases) = %cdstat

@dfunit(noprint) aunit compute df_aunit(cases) = %cdstat

@dfunit(noprint) bunit compute df_bunit(cases) = %cdstat

69 Essentials of Time Series Modeling

@dfunit(noprint) cunit compute df_cunit(cases) = %cdstat

@dfunit(noprint) cunitc compute df_cunitc(cases) = %cdstat

} compute random_1(cases) = random(1) compute random_2(cases) = random(2) compute random_3(cases) = random(3) compute unitroot_1(cases) = unitroot(1) compute unitroot_2(cases) = unitroot(2) compute unitroot_3(cases) = unitroot(3) compute coint_1(cases) = coint(1) compute coint_2(cases) = coint(2) compute coint_3(cases) = coint(3) end do cases display " " display "random_i => rank i test using random normal series" display "unitroot_i => rank i test using unitroot series" display "coint_i => rank i test using cointegrated series" display " " table display " " display " first 2 values shown" print * 2 random_1 unitroot_1 coint_1 $ random_2 unitroot_2 coint_2 $ random_3 unitroot_3 coint_3

The test case first generates 4000 random normal series series A, B and C and tests for cointegration. The results signal that there is "cointegration" that arises due to the fact that the three series are stationary to that any linear combination will be stationary. This fact, however, does not suggest that an error correction model makes any sense. As controls two other models are developed. In the first three unit root series CUNIT, AUNIT and BUNIT and are not cointegrated are tested. Finally three series CUNITC, AUNIT and BUNIT that are cointegrated and analysed. The Dickey Fuller test is used to prove the properties of the series. Detailed output for the first two samples of the 1000 test cases are shown. Annotated and edited output follows.

display @1 %dateandtime() @33 ' Rats Version ' %ratsversion() 07/11/2013 14:55 Rats Version 8.20000 The first sample is annotated for illustration purposes. Means for all 1000 samples of 4000 observations are shown at the end. For the first model of three random series, "cointegration" is found since the ltrace value of 1852.66 is greater than its 95% critical value of 29.8. This could be highly misleading unless it is noticed that the series being tested do not have unit roots. The Engle-Granger test also indicated cointegration. random series - no unit root Variables: A B C

70 Essentials of Time Series Modeling

Estimated from 1 to 4000 Data Points 3994 Lags 6 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -17941.7556 1 0.1552 673.7326 1852.6612 29.8000 -17604.8894 2 0.1434 618.2530 1178.9286 15.4100 -17295.7629 3 0.1310 560.6756 560.6756 3.8400 -17015.4251

Cointegrating Vector for Largest Eigenvalue A B C 1.799206 -1.213842 -1.263407

Engle-Granger Cointegration Test Null is no cointegration (residual has unit root) Regression Run From 1 to 4000 Observations 3994 Using fixed lags 6 Constant in cointegrating vector Critical Values from MacKinnon for 3 Variables

Test Statistic -24.1576** 1%(**) -4.3016 5%(*) -3.7450 10% -3.4534 The next test looks at three unit root series that are not cointegrated. As expected, cointegration is not found by either method.

Unit root series no coint Variables: CUNIT AUNIT BUNIT Estimated from 1 to 4000 Data Points 3994 Lags 6 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -17019.6129 1 0.0029 11.7872 20.1080 29.8000 -17013.7193 2 0.0018 7.0914 8.3207 15.4100 -17010.1736 3 0.0003 1.2294 1.2294 3.8400 -17009.5590

Cointegrating Vector for Largest Eigenvalue CUNIT AUNIT BUNIT -0.048888 0.038586 0.044900

Engle-Granger Cointegration Test Null is no cointegration (residual has unit root) Regression Run From 1 to 4000 Observations 3994 Using fixed lags 6 Constant in cointegrating vector Critical Values from MacKinnon for 3 Variables

Test Statistic -2.52558 1%(**) -4.30156 5%(*) -3.74499 10% -3.45336

In the final test we look at three cointegrated series whose relationship is detected correctly.

Unit root series with cointegration Variables: CUNITC AUNIT BUNIT Estimated from 1 to 4000 Data Points 3994 Lags 6 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -17298.8513 1 0.1378 592.2131 601.2585 29.8000 -17002.7447 2 0.0018 7.3708 9.0454 15.4100 -16999.0593 3 0.0004 1.6746 1.6746 3.8400 -16998.2220

Cointegrating Vector for Largest Eigenvalue CUNITC AUNIT BUNIT -2.412449 2.409434 2.411391

71 Essentials of Time Series Modeling

These results are for the second of 1000 samples and are consistent.

Model 1 sample 2. random series - no unit root Variables: A B C Estimated from 1 to 4000 Data Points 3994 Lags 6 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -17841.4770 1 0.1494 646.2688 1802.0899 29.8000 -17518.3426 2 0.1394 599.5482 1155.8210 15.4100 -17218.5685 3 0.1300 556.2728 556.2728 3.8400 -16940.4321

Cointegrating Vector for Largest Eigenvalue A B C -0.754835 0.404189 2.416288

Engle-Granger Cointegration Test Null is no cointegration (residual has unit root) Regression Run From 1 to 4000 Observations 3994 Using fixed lags 6 Constant in cointegrating vector Critical Values from MacKinnon for 3 Variables

Test Statistic -23.6114** 1%(**) -4.3016 5%(*) -3.7450 10% -3.4534 Model 2 sample 2.

Unit root series no coint Variables: CUNIT AUNIT BUNIT Estimated from 1 to 4000 Data Points 3994 Lags 6 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL 0 -16948.2315 1 0.0021 8.5838 12.7281 29.8000 -16943.9395 2 0.0008 3.1932 4.1443 15.4100 -16942.3429 3 0.0002 0.9511 0.9511 3.8400 -16941.8674

Cointegrating Vector for Largest Eigenvalue CUNIT AUNIT BUNIT -0.046733 0.026724 0.027100

Engle-Granger Cointegration Test Null is no cointegration (residual has unit root) Regression Run From 1 to 4000 Observations 3994 Using fixed lags 6 Constant in cointegrating vector Critical Values from MacKinnon for 3 Variables

Test Statistic -1.68707 1%(**) -4.30156 5%(*) -3.74499 10% -3.45336 Model 3 sample 2.

Unit root series with cointegration Variables: CUNITC AUNIT BUNIT Estimated from 1 to 4000 Data Points 3994 Lags 6 with Constant

Unrestricted eigenvalues and -T log(1-lambda) Rank EigVal Lambda-max Trace Trace-95% LogL

72 Essentials of Time Series Modeling

0 -17330.3393 1 0.1455 628.0099 633.2411 29.8000 -17016.3343 2 0.0008 3.1331 5.2312 15.4100 -17014.7678 3 0.0005 2.0981 2.0981 3.8400 -17013.7187

Cointegrating Vector for Largest Eigenvalue CUNITC AUNIT BUNIT -2.440908 2.442712 2.440847

Engle-Granger Cointegration Test Null is no cointegration (residual has unit root) Regression Run From 1 to 4000 Observations 3994 Using fixed lags 6 Constant in cointegrating vector Critical Values from MacKinnon for 3 Variables

Test Statistic -23.8625** 1%(**) -4.3016 5%(*) -3.7450 10% -3.4534

This table summarizes results for all 1000 samples. For ranks 1-3 all the random series are found to have cointegration. For ranks 1-3 the unit root series are correctly found to not be cointegrated while for rank1 the cointegrated series are found to be cointegrated. Dickey-Fuller test means are shown for all series tested. The reason that the three random series are found to be cointegrated is that a regression of one of the series on the other two will produce a stationary error term that is interpreted as as indication of cointegration. display " " display "random_i => rank i test using random normal series" random_i => rank i test using random normal series display "unitroot_i => rank i test using unitroot series" unitroot_i => rank i test using unitroot series display "coint_i => rank i test using cointegrated series" coint_i => rank i test using cointegrated series display " " table Series Obs Mean Std Error Minimum Maximum RANDOM_1 1000 1858.5068510 48.8554439 1718.2590985 1992.4903970 UNITROOT_1 1000 21.0826093 5.8005337 7.9696960 45.5243320 COINT_1 1000 631.1189664 29.6164901 546.8830562 714.7869241 RANDOM_2 1000 1196.1879850 34.6063402 1084.6142385 1305.7486062 UNITROOT_2 1000 7.5766450 2.8403800 1.1508351 21.1341539 COINT_2 1000 9.9023826 4.2429115 1.8126992 30.7506709 RANDOM_3 1000 577.3045866 21.2222227 503.1480905 646.7378611 UNITROOT_3 1000 1.4166489 1.2845018 0.0000025 8.0162015 COINT_3 1000 1.7625296 1.5550323 0.0000051 9.5198548 EG_RANDOM 1000 -23.8997718 0.6363570 -26.2908756 -21.7934343 EG_UNIT 1000 -2.5060415 0.7823436 -5.7121679 0.5317479 EG_COINT 1000 -23.9324904 0.6329362 -25.7560712 -21.9554612 DF_A 1000 -63.2532172 0.9937978 -66.6457398 -60.4030147 DF_B 1000 -63.2566946 1.0202048 -67.1625271 -60.4944412 DF_C 1000 -63.2302340 1.0228337 -66.4292473 -60.1803528 DF_AUNIT 1000 -1.5000502 0.8501827 -4.4169211 2.1368245 DF_BUNIT 1000 -1.4976372 0.7962099 -3.6644080 1.0817347 DF_CUNIT 1000 -1.5563462 0.8190509 -4.0710776 1.1889073 DF_CUNITC 1000 -2.1543074 0.9351888 -5.6179932 0.8149572 A 4000 -0.0135218 0.9884209 -3.4163438 3.7723895 B 4000 -0.0012669 1.0038117 -4.1233935 3.5167812 C 4000 -0.0074646 1.0074268 -3.2089580 3.4580884 ERROR 4000 0.0173365 1.0058550 -3.6145567 3.9088771 AUNIT 4000 -37.9754783 37.5721002 -92.9456985 34.9852663 BUNIT 4000 22.0857722 19.2417972 -16.1368629 71.9424514 CUNIT 4000 10.6852830 27.2377002 -53.5103240 54.0743484 CUNITC 4000 -15.8723696 38.1443104 -77.0388447 72.9365818 TREND 4000 2000.5000000 1154.8448669 1.0000000 4000.0000000

6.9 Conclusions

73 Essentials of Time Series Modeling

Cointegration analysis is concerned with the study of series with unit roots that may jointly be moving together. Since many series in macroeconomic analysis exhibit unit roots, carefully analysis for cointegration is important if meaningful and useful models are to be developed. Cointegration can be tested using a number of procedures. The Engle-Granger (1987) method, the Stock-Watson (1993) method and the Johansen (1988) method of analysis are discussed and illustrated using data developed by Enders (2004). Problems of interpretation of the Johansen and Engke-Granger procedures that are incorrectly applied to series that do not have a unit root are illustrated using a Monti Carlo study involving 1000 samples of 4000 each. The take away from this study is that if these tests are applied to series that do not have unit roots, cointegration will falsely be detected.

74

Recommended publications