Problem 2

The first step is to obtain quarterly time series for Disposable Personal Income, FRED/DPI and for Personal Consumption Expenditures, FRED/PCEC.

DPI <- Quandl("FRED/DPI", type="ts")
PCE <- Quandl("FRED/PCEC", type="ts")

(a) Log Transformation and Unit Root Test

Next step is to construct the log of Personal Consumption Expenditure, \(y_{1,t}=log{PCE_{t}}\), and Disposable Personal Income, \(y_{2,t}=log{DPI_{t}}\) as follow:

y1t <- log(PCE)
y2t <- log(DPI)

The following figures shows the original and log time series of \(DPI_{t}\) and \(PCE_{t}\).

par(mfrow=c(2,2), cex=0.5, mar=c(2,2,3,1))
plot(PCE, xlab="", ylab="", main="Personal Consumption Expenditures")
plot(y1t, xlab="", ylab="", main="Log Personal Consumption Expenditure")
plot(DPI, xlab="", ylab="", main="Disposable Personal Income")
plot(y2t, xlab="", ylab="", main="Log Disposable Personal Income")

The next step is to test for the stationary for both \(y_{1,t}\) and \(y_{2,t}\).

y1t.adf <- adf.test(y1t)
y1t.adf

    Augmented Dickey-Fuller Test

data:  y1t
Dickey-Fuller = 0.41081, Lag order = 6, p-value = 0.99
alternative hypothesis: stationary
y2t.adf <- adf.test(y2t)
y2t.adf

    Augmented Dickey-Fuller Test

data:  y2t
Dickey-Fuller = 0.41081, Lag order = 6, p-value = 0.99
alternative hypothesis: stationary

From the ADF test we can see that the p-value of the test for both \(y_{1,t}\) and \(y_{2,t}\) are greater than 0.05, hence, we can conclude that both \(y_{1,t}\) and \(y_{2,t}\) are non-stationary (has an unit-root).

The next step that we have to take is to take first difference of the series and retest the series for non-stationarity. We construct new series \(\Delta y_{1,t}\) and \(\Delta y_{2,t}\) using the following code

dy1t <- diff(y1t)
dy2t <- diff(y2t)

Next, we redo the ADF test for both \(\Delta y_{1,t}\) and \(\Delta y_{2,t}\):

dy1t.adf <- adf.test(dy1t)
dy1t.adf

    Augmented Dickey-Fuller Test

data:  dy1t
Dickey-Fuller = -3.6801, Lag order = 6, p-value = 0.02586
alternative hypothesis: stationary
dy2t.adf <- adf.test(dy2t)
dy2t.adf

    Augmented Dickey-Fuller Test

data:  dy2t
Dickey-Fuller = -3.6801, Lag order = 6, p-value = 0.02586
alternative hypothesis: stationary

From the ADF test above for \(\Delta y_{1,t}\) and \(\Delta y_{2,t}\), we can see that both of the series were stationary, indicated by p-values that are less than 0.05. Hence, we can verify that \(y_{1,t}\) and \(y_{2,t}\) are \(I(1)\).

(b) Trace and Max Eigenvalue Tests for Cointegration

Before conducting trace and max eigenvalue test, we need to bind \(y_{1,t}\) and \(y_{2,t}\) into one data frame \(y_{t}\), where \(y_{t} = (y_{1,t},y_{2,t})\)

y <- cbind(y1t,y2t)

Trace test:

y.CA <- ca.jo(y, ecdet="const", type="trace", K=2, spec="transitory", season=4)
summary(y.CA)

###################### 
# Johansen-Procedure # 
###################### 

Test type: trace statistic , without linear trend and constant in cointegration 

Eigenvalues (lambda):
[1] 3.035673e-01 6.067856e-02 2.735830e-16

Values of teststatistic and critical values of test:

           test 10pct  5pct  1pct
r <= 1 |  17.21  7.52  9.24 12.97
r = 0  | 116.70 17.85 19.96 24.60

Eigenvectors, normalised to first column:
(These are the cointegration relations)

              y1t.l1     y2t.l1  constant
y1t.l1    1.00000000  1.0000000  1.000000
y2t.l1   -1.00125397 -1.0165837 -0.961505
constant  0.01523677  0.2530166 -0.154454

Weights W:
(This is the loading matrix)

           y1t.l1      y2t.l1      constant
y1t.d -0.10390559 -0.01391660 -1.224577e-13
y2t.d -0.07471752  0.08070184  2.163910e-14

Trace test suggests that \(y_t\) are cointegrated, we can reject \(H_0: rank(\Pi) = 0\) and afterward also reject \(H_0: rank(\Pi) = 1\).

Max Eigenvalue test:

y.CA <- ca.jo(y, ecdet="const", type="eigen", K=2, spec="transitory", season=4)
summary(y.CA)

###################### 
# Johansen-Procedure # 
###################### 

Test type: maximal eigenvalue statistic (lambda max) , without linear trend and constant in cointegration 

Eigenvalues (lambda):
[1] 3.035673e-01 6.067856e-02 2.735830e-16

Values of teststatistic and critical values of test:

          test 10pct  5pct  1pct
r <= 1 | 17.21  7.52  9.24 12.97
r = 0  | 99.49 13.75 15.67 20.20

Eigenvectors, normalised to first column:
(These are the cointegration relations)

              y1t.l1     y2t.l1  constant
y1t.l1    1.00000000  1.0000000  1.000000
y2t.l1   -1.00125397 -1.0165837 -0.961505
constant  0.01523677  0.2530166 -0.154454

Weights W:
(This is the loading matrix)

           y1t.l1      y2t.l1      constant
y1t.d -0.10390559 -0.01391660 -1.224577e-13
y2t.d -0.07471752  0.08070184  2.163910e-14

Max eigenvalue test also suggests that \(y_t\) are cointegrated, we can first reject \(H_0: rank(\Pi) = 0\) and afterwards can’t reject \(H_0: rank(\Pi) = 1\).

(c) Test for the Presence of a Restricted Constant

Hypothesis testing with \(H_0\): restricted constant (case 2) against \(H_A:\) drift (case 3) is implemented using lttest:

lttest(y.CA, r=1)
LR-test for no linear trend

H0: H*2(r<=1)
H1: H2(r<=1)

Test statistic is distributed as chi-square
with 1 degress of freedom
        test statistic p-value
LR test             10       0

From the test result above, we can see that we reject the restriced constant (\(H_0\)), hence the ecdet="const" is not appropriate, we need to re-run the cointegration test.

Trace test:

y.CA <- ca.jo(y, ecdet="trend", type="trace", K=2, spec="transitory", season=4)
summary(y.CA)

###################### 
# Johansen-Procedure # 
###################### 

Test type: trace statistic , with linear trend in cointegration 

Eigenvalues (lambda):
[1] 1.168362e-01 3.057904e-02 9.218546e-18

Values of teststatistic and critical values of test:

          test 10pct  5pct  1pct
r <= 1 |  8.54 10.49 12.25 16.26
r = 0  | 42.71 22.76 25.32 30.45

Eigenvectors, normalised to first column:
(These are the cointegration relations)

                y1t.l1       y2t.l1     trend.l1
y1t.l1    1.0000000000  1.000000000  1.000000000
y2t.l1   -1.0557212661 -0.889777180 -0.554135161
trend.l1  0.0008717862 -0.002877414 -0.007632338

Weights W:
(This is the loading matrix)

           y1t.l1      y2t.l1      trend.l1
y1t.d -0.12191402 0.008786922 -4.367322e-13
y2t.d -0.01710054 0.026319443  5.017094e-14

Max Eigenvalue test:

y.CA <- ca.jo(y, ecdet="trend", type="eigen", K=2, spec="transitory", season=4)
summary(y.CA)

###################### 
# Johansen-Procedure # 
###################### 

Test type: maximal eigenvalue statistic (lambda max) , with linear trend in cointegration 

Eigenvalues (lambda):
[1] 1.168362e-01 3.057904e-02 9.218546e-18

Values of teststatistic and critical values of test:

          test 10pct  5pct  1pct
r <= 1 |  8.54 10.49 12.25 16.26
r = 0  | 34.17 16.85 18.96 23.65

Eigenvectors, normalised to first column:
(These are the cointegration relations)

                y1t.l1       y2t.l1     trend.l1
y1t.l1    1.0000000000  1.000000000  1.000000000
y2t.l1   -1.0557212661 -0.889777180 -0.554135161
trend.l1  0.0008717862 -0.002877414 -0.007632338

Weights W:
(This is the loading matrix)

           y1t.l1      y2t.l1      trend.l1
y1t.d -0.12191402 0.008786922 -4.367322e-13
y2t.d -0.01710054 0.026319443  5.017094e-14

From the retesting procedure above, we now get consistent result between trace and max eigenvalue test. It is suggested that test also suggests that \(y_t\) are cointegrated, we can first reject \(H_0: rank(\Pi) = 0\) and afterwards can’t reject \(H_0: rank(\Pi) = 1\).

(d) Estimating the Unrestricted VEC Model

y.VEC <- cajorls(y.CA, r=1)
y.VEC
$rlm

Call:
lm(formula = substitute(form1), data = data.mat)

Coefficients:
          y1t.d      y2t.d    
ect1      -0.121914  -0.017101
constant  -0.038894   0.001767
sd1        0.001718   0.002001
sd2        0.000575   0.001216
sd3        0.002677   0.001749
y1t.dl1    0.053063   0.470902
y2t.dl1    0.174835  -0.030415


$beta
                  ect1
y1t.l1    1.0000000000
y2t.l1   -1.0557212661
trend.l1  0.0008717862

(d) Hypothesis Testing on the Restriction on Cointegrating Relationship

Assuming \(y_t = (y_{1,t}, y_{2,t})'\) follow a VEC model \(\Delta y_t = \mu_t + \Pi y_{t-1} + \varepsilon_t\) with \(\Pi = \alpha \beta'\), hence we have \[\mathbf{\Pi} = \left[\begin{array} {rrr} \alpha_1 \beta_1 & \alpha_1 \beta_2 \\ \alpha_2 \beta_1 & \alpha_2 \beta_2 \\ \end{array}\right] \] The cointegrating relationship is \(\beta' y_t = y_{1,t}-y_{2,t}\). From previous estimation of unrestricted VEC model in part (d), the cointegrating vector was estimated as \(\beta = (1,-1.0557,0.00087)\) and so \(\beta_2\) is very close to \(-1\).

Next, we will conducting three hypothesis testing to test:

  1. \(\beta_2 = -1\)
  2. \(\alpha_2 = 0\)
  3. \(\beta_2 = -1\) and \(\alpha_2 = 0\)

Testing \(\beta_2 = -1\):

rest.betta <- matrix(c(1,0,0,
                       0,-1,0), c(3,2))
summary( blrtest(y.CA, H=rest.betta, r=1) )

###################### 
# Johansen-Procedure # 
###################### 

Estimation and testing under linear restrictions on beta 

The VECM has been estimated subject to: 
beta=H*phi and/or alpha=A*psi

     [,1] [,2]
[1,]    1    0
[2,]    0   -1
[3,]    0    0

Eigenvalues of restricted VAR (lambda):
[1] 0.1060 0.0259

The value of the likelihood ratio test statistic:
3.34 distributed as chi square with 1 df.
The p-value of the test statistic is: 0.07 

Eigenvectors, normalised to first column
of the restricted VAR:

        [,1]   [,2]
[1,]  1.0000  1.000
[2,] -1.0072 -1.118
[3,]  0.0000  0.000

Weights W of the restricted VAR:

         [,1]   [,2]
y1t.d -0.1222 0.0044
y2t.d -0.0049 0.0108

From the \(p-value\) of 0.07, we reject the hypothesis that \(\beta_2 = -1\).

Testing \(\alpha_2 = 0\):

rest.alpha <- matrix(c(1,0), c(2,1))
summary(alrtest(y.CA, A=rest.alpha, r=1) )

###################### 
# Johansen-Procedure # 
###################### 

Estimation and testing under linear restrictions on beta 

The VECM has been estimated subject to: 
beta=H*phi and/or alpha=A*psi

     [,1]
[1,]    1
[2,]    0

Eigenvalues of restricted VAR (lambda):
[1] 0.1157 0.0000 0.0000

The value of the likelihood ratio test statistic:
0.34 distributed as chi square with 1 df.
The p-value of the test statistic is: 0.56 

Eigenvectors, normalised to first column
of the restricted VAR:

               [,1]
RK.y1t.l1    1.0000
RK.y2t.l1   -1.0525
RK.trend.l1  0.0008

Weights W of the restricted VAR:

       [,1]
[1,] -0.117
[2,]  0.000

From the \(p-value\) of 0.56, we cannot reject the hypothesis that \(\alpha_2 = 0\).

Testing \(\beta_2 = -1\) and \(\alpha_2 = 0\)

summary( ablrtest(y.CA, A=rest.alpha, H=rest.betta, r=1) )

###################### 
# Johansen-Procedure # 
###################### 

Estimation and testing under linear restrictions on alpha and beta 

The VECM has been estimated subject to: 
beta=H*phi and/or alpha=A*psi

     [,1] [,2]
[1,]    1    0
[2,]    0   -1
[3,]    0    0

     [,1]
[1,]    1
[2,]    0

Eigenvalues of restricted VAR (lambda):
[1] 0.106 0.000

The value of the likelihood ratio test statistic:
3.36 distributed as chi square with 1 df.
The p-value of the test statistic is: 0.07 

Eigenvectors, normalised to first column
of the restricted VAR:

        [,1]
[1,]  1.0000
[2,] -1.0074
[3,]  0.0000

Weights W of the restricted VAR:

        [,1]
[1,] -0.1204
[2,]  0.0000

From the \(p-value\) of 0.07, we reject the hypothesis that \(\beta_2 = -1\) and \(\alpha_2 = 0\).

(e) Forecasting using a VEC Model

y.VAR <- vec2var(y.CA, r=1)
y.VAR.fcst <- predict(y.VAR, n.ahead=8)
plot(y.VAR.fcst)