Problem 1

Use Zivot-Andrews test to analyze the presence of a unit root and structural breaks in the following series:

In general, the common null hypothesis for the Zivot-Andrews test is as follows:
\[{H_0}:{y_t} = \mu + {y_{t - 1}} + {\varepsilon _t}\]
This null is testing for the presence of a unit root process with drift that excludes exogenous structural change.

Depending on the model variant, the alternative hypothesis is a trend stationary process that allows for a one time break in the level, the trend or both.

The following three models represent the alternative hypothesis for the Zivot-Andrews test:

\[\eqalign{ & {\rm{model A: }}{H_A}:{y_t} = {\mu _1} + ({\mu _2} - {\mu _1})D{U_t} + \beta t + {\varepsilon _t} \cr & {\rm{model B: }}{H_A}:{y_t} = \mu + {\beta _1}t + ({\beta _2} - {\beta _1})D{T_t}(\hat \lambda ) + {\varepsilon _t} \cr & {\rm{model C: }}{H_A}:{y_t} = {\mu _1} + ({\mu _2} - {\mu _1})D{U_t}(\hat \lambda ) + {\beta _1}t + {\beta _1}t + ({\beta _2} - {\beta _1})D{T_t}(\hat \lambda ) + {\varepsilon _t} \cr} \]

We will use this model to test various time series for the presence of a one time break in the level, the trend or both.

(a) Log transformed Retail and Food Services Sales FRED/RSAFS




# Model A
za_lnRSAFS_all.1 <- ur.za(lnRSAFS_all, model="intercept", lag=10)
summary(za_lnRSAFS_all.1)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.030923 -0.004594  0.000230  0.005347  0.056017 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.698e+00  2.769e-01   6.133 3.14e-09 ***
## y.l1         8.594e-01  2.298e-02  37.400  < 2e-16 ***
## trend        5.728e-04  9.561e-05   5.991 6.80e-09 ***
## y.dl1       -1.001e-01  5.756e-02  -1.739   0.0833 .  
## y.dl2        1.414e-02  5.744e-02   0.246   0.8057    
## y.dl3        2.180e-02  5.731e-02   0.380   0.7040    
## y.dl4        7.519e-02  5.733e-02   1.312   0.1908    
## y.dl5        3.753e-03  5.729e-02   0.066   0.9478    
## y.dl6        9.203e-02  5.727e-02   1.607   0.1092    
## y.dl7        2.125e-02  5.747e-02   0.370   0.7119    
## y.dl8       -5.253e-02  5.750e-02  -0.914   0.3618    
## y.dl9        1.307e-01  5.759e-02   2.270   0.0240 *  
## y.dl10       7.355e-02  5.774e-02   1.274   0.2039    
## du          -2.615e-02  4.648e-03  -5.626 4.71e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.009217 on 264 degrees of freedom
##   (11 observations deleted due to missingness)
## Multiple R-squared:  0.9989, Adjusted R-squared:  0.9988 
## F-statistic: 1.787e+04 on 13 and 264 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -6.1179 
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58 
## 
## Potential break point at position: 199
Acf(za_lnRSAFS_all.1@res, type="correlation", lag.max = 24)

plot(za_lnRSAFS_all.1)

#Model B 
za_lnRSAFS_all.2 <- ur.za(lnRSAFS_all, model="trend", lag=10)
summary(za_lnRSAFS_all.2)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.040601 -0.004724  0.000413  0.005441  0.056928 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.603e-01  2.262e-01   3.361 0.000891 ***
## y.l1         9.371e-01  1.885e-02  49.725  < 2e-16 ***
## trend        2.648e-04  8.659e-05   3.058 0.002457 ** 
## y.dl1       -8.784e-02  6.064e-02  -1.449 0.148658    
## y.dl2        3.489e-02  6.055e-02   0.576 0.564959    
## y.dl3        3.983e-02  6.037e-02   0.660 0.509948    
## y.dl4        8.946e-02  6.042e-02   1.481 0.139896    
## y.dl5        1.713e-02  6.058e-02   0.283 0.777620    
## y.dl6        1.194e-01  6.054e-02   1.973 0.049583 *  
## y.dl7        4.541e-02  6.096e-02   0.745 0.456979    
## y.dl8       -1.890e-02  6.102e-02  -0.310 0.756990    
## y.dl9        1.599e-01  6.100e-02   2.621 0.009288 ** 
## y.dl10       8.836e-02  6.115e-02   1.445 0.149667    
## dt          -1.275e-04  5.176e-05  -2.464 0.014373 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.009644 on 264 degrees of freedom
##   (11 observations deleted due to missingness)
## Multiple R-squared:  0.9988, Adjusted R-squared:  0.9987 
## F-statistic: 1.632e+04 on 13 and 264 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -3.3389 
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11 
## 
## Potential break point at position: 147
Acf(za_lnRSAFS_all.2@res, type="correlation", lag.max = 24)

plot(za_lnRSAFS_all.2)

# Model C
za_lnRSAFS_all.3 <- ur.za(lnRSAFS_all, model="both", lag=10)
summary(za_lnRSAFS_all.3)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.031223 -0.004365  0.000117  0.005373  0.056227 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.867e+00  3.135e-01   5.954 8.35e-09 ***
## y.l1         8.453e-01  2.605e-02  32.445  < 2e-16 ***
## trend        6.369e-04  1.108e-04   5.749 2.48e-08 ***
## y.dl1       -8.998e-02  5.820e-02  -1.546   0.1233    
## y.dl2        2.512e-02  5.820e-02   0.432   0.6664    
## y.dl3        3.219e-02  5.799e-02   0.555   0.5793    
## y.dl4        8.588e-02  5.805e-02   1.479   0.1402    
## y.dl5        1.580e-02  5.821e-02   0.271   0.7863    
## y.dl6        1.036e-01  5.813e-02   1.783   0.0758 .  
## y.dl7        3.348e-02  5.843e-02   0.573   0.5672    
## y.dl8       -4.038e-02  5.844e-02  -0.691   0.4902    
## y.dl9        1.422e-01  5.843e-02   2.434   0.0156 *  
## y.dl10       8.439e-02  5.848e-02   1.443   0.1502    
## du          -2.675e-02  4.675e-03  -5.722 2.86e-08 ***
## dt          -5.584e-05  4.884e-05  -1.143   0.2539    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.009212 on 263 degrees of freedom
##   (11 observations deleted due to missingness)
## Multiple R-squared:  0.9989, Adjusted R-squared:  0.9988 
## F-statistic: 1.661e+04 on 14 and 263 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -5.9357 
## Critical values: 0.01= -5.57 0.05= -5.08 0.1= -4.82 
## 
## Potential break point at position: 199
Acf(za_lnRSAFS_all.3@res, type="correlation", lag.max = 24)

plot(za_lnRSAFS_all.3)


From the above results we can see that we Reject the Null and it is reasonable to assume we have a change in the intercept but not a change in the trend.

By plotting the t-statistics for the lagged endogenous variable we can more plainly see that we accept a change in level but reject a change in trend.


The above plot shows a plot of the Log Transformed data with an indicator where the Zivot-Andrews test tells us we have a structural break in the level, which seems correct by viewing the data plot.

(b) Log transformed Personal consumption expenditures: Nondurable goods (chain-type price index)




# Model A
za_lnDNDG_all.1 <- ur.za(lnDNDG_all, model="intercept", lag=12)
summary(za_lnDNDG_all.1)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.036287 -0.002285 -0.000083  0.002380  0.022527 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.853e-02  6.689e-03   4.265 2.29e-05 ***
## y.l1         9.907e-01  2.284e-03 433.685  < 2e-16 ***
## trend        1.499e-05  5.295e-06   2.831  0.00478 ** 
## y.dl1        4.606e-01  3.818e-02  12.066  < 2e-16 ***
## y.dl2       -1.369e-01  4.167e-02  -3.285  0.00107 ** 
## y.dl3        1.384e-02  4.198e-02   0.330  0.74179    
## y.dl4        2.268e-02  4.195e-02   0.541  0.58896    
## y.dl5       -1.219e-02  4.204e-02  -0.290  0.77201    
## y.dl6        8.493e-03  4.205e-02   0.202  0.84000    
## y.dl7        1.741e-02  4.202e-02   0.414  0.67872    
## y.dl8       -7.532e-03  4.203e-02  -0.179  0.85782    
## y.dl9        5.523e-02  4.216e-02   1.310  0.19062    
## y.dl10       2.130e-03  4.231e-02   0.050  0.95987    
## y.dl11       1.820e-01  4.205e-02   4.329 1.73e-05 ***
## y.dl12      -1.681e-01  3.833e-02  -4.387 1.34e-05 ***
## du           5.821e-03  1.176e-03   4.951 9.42e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.004953 on 656 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.9999, Adjusted R-squared:  0.9999 
## F-statistic: 5.954e+05 on 15 and 656 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -4.0504 
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58 
## 
## Potential break point at position: 168
Acf(za_lnDNDG_all.1@res, type="correlation", lag.max = 24)

plot(za_lnDNDG_all.1)

# Model B
za_lnDNDG_all.2 <- ur.za(lnDNDG_all, model="trend", lag=12)
summary(za_lnDNDG_all.2)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.036143 -0.002398 -0.000183  0.002354  0.023001 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.634e-02  6.861e-03   3.839 0.000136 ***
## y.l1         9.905e-01  2.525e-03 392.236  < 2e-16 ***
## trend        5.049e-05  1.245e-05   4.054 5.65e-05 ***
## y.dl1        4.680e-01  3.821e-02  12.247  < 2e-16 ***
## y.dl2       -1.325e-01  4.181e-02  -3.169 0.001600 ** 
## y.dl3        1.756e-02  4.212e-02   0.417 0.676833    
## y.dl4        2.836e-02  4.207e-02   0.674 0.500464    
## y.dl5       -8.011e-03  4.218e-02  -0.190 0.849428    
## y.dl6        1.392e-02  4.217e-02   0.330 0.741491    
## y.dl7        2.092e-02  4.217e-02   0.496 0.619890    
## y.dl8       -3.588e-03  4.217e-02  -0.085 0.932214    
## y.dl9        5.774e-02  4.232e-02   1.364 0.172913    
## y.dl10       3.125e-03  4.248e-02   0.074 0.941380    
## y.dl11       1.838e-01  4.221e-02   4.354 1.55e-05 ***
## y.dl12      -1.675e-01  3.849e-02  -4.351 1.57e-05 ***
## dt          -3.664e-05  8.420e-06  -4.352 1.56e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.004974 on 656 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.9999, Adjusted R-squared:  0.9999 
## F-statistic: 5.905e+05 on 15 and 656 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -3.7546 
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11 
## 
## Potential break point at position: 260
Acf(za_lnDNDG_all.2@res, type="correlation", lag.max = 24)

plot(za_lnDNDG_all.2)

# Model C
za_lnDNDG_all.3 <- ur.za(lnDNDG_all, model="both", lag=12)
summary(za_lnDNDG_all.3)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.036092 -0.002359 -0.000174  0.002346  0.022436 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.712e-02  6.726e-03   4.033 6.16e-05 ***
## y.l1         9.908e-01  2.281e-03 434.392  < 2e-16 ***
## trend        3.066e-05  1.032e-05   2.972 0.003067 ** 
## y.dl1        4.566e-01  3.818e-02  11.959  < 2e-16 ***
## y.dl2       -1.393e-01  4.163e-02  -3.347 0.000864 ***
## y.dl3        1.035e-02  4.196e-02   0.247 0.805174    
## y.dl4        1.949e-02  4.192e-02   0.465 0.642197    
## y.dl5       -1.532e-02  4.201e-02  -0.365 0.715411    
## y.dl6        5.472e-03  4.202e-02   0.130 0.896418    
## y.dl7        1.406e-02  4.199e-02   0.335 0.737861    
## y.dl8       -1.044e-02  4.199e-02  -0.249 0.803802    
## y.dl9        5.177e-02  4.213e-02   1.229 0.219654    
## y.dl10      -1.172e-03  4.228e-02  -0.028 0.977901    
## y.dl11       1.795e-01  4.200e-02   4.273 2.21e-05 ***
## y.dl12      -1.721e-01  3.833e-02  -4.491 8.40e-06 ***
## du           4.850e-03  1.296e-03   3.742 0.000198 ***
## dt          -1.653e-05  9.346e-06  -1.769 0.077362 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.004945 on 655 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.9999, Adjusted R-squared:  0.9999 
## F-statistic: 5.6e+05 on 16 and 655 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -4.0493 
## Critical values: 0.01= -5.57 0.05= -5.08 0.1= -4.82 
## 
## Potential break point at position: 168
Acf(za_lnDNDG_all.3@res, type="correlation", lag.max = 24)

plot(za_lnDNDG_all.3)



In all three of the above Zivot_Andrews tests (Models A-C) it would appear that we Fail to Reject the Null which could indicate we are dealing with the presence of a unit root process with drift.

(c) Log transformed real wage per hour in manufacturing


# Model A
za_lnRWPHM_all.1 <- ur.za(lnRWPHM_all, model="intercept", lag=4)
summary(za_lnRWPHM_all.1)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0170725 -0.0038458 -0.0000097  0.0038727  0.0216554 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -4.765e-02  1.080e-02  -4.413 1.49e-05 ***
## y.l1         9.757e-01  4.849e-03 201.227  < 2e-16 ***
## trend        4.546e-05  1.678e-05   2.709 0.007201 ** 
## y.dl1        3.152e-02  5.771e-02   0.546 0.585373    
## y.dl2        1.457e-02  5.733e-02   0.254 0.799648    
## y.dl3        8.821e-02  5.648e-02   1.562 0.119540    
## y.dl4       -1.919e-01  5.602e-02  -3.426 0.000711 ***
## du          -4.147e-03  1.613e-03  -2.571 0.010704 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.006028 on 263 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.9991, Adjusted R-squared:  0.999 
## F-statistic: 4.013e+04 on 7 and 263 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -5.0191 
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58 
## 
## Potential break point at position: 142
Acf(za_lnRWPHM_all.1@res, type="correlation", lag.max = 24)

plot(za_lnRWPHM_all.1)

# Model B
za_lnRWPHM_all.2 <- ur.za(lnRWPHM_all, model="trend", lag=4)
summary(za_lnRWPHM_all.2)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0175199 -0.0038520 -0.0001165  0.0041902  0.0225317 
## 
## Coefficients: (1 not defined because of singularities)
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.532e-02  9.777e-03  -3.613 0.000362 ***
## y.l1         9.808e-01  4.458e-03 220.014  < 2e-16 ***
## trend        1.233e-05  1.086e-05   1.135 0.257504    
## y.dl1        4.475e-02  5.808e-02   0.770 0.441702    
## y.dl2        2.640e-02  5.775e-02   0.457 0.647955    
## y.dl3        1.033e-01  5.677e-02   1.819 0.070010 .  
## y.dl4       -1.813e-01  5.646e-02  -3.212 0.001484 ** 
## dt                  NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.006092 on 264 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.999,  Adjusted R-squared:  0.999 
## F-statistic: 4.585e+04 on 6 and 264 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -4.2987 
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11 
## 
## Potential break point at position: 1
Acf(za_lnRWPHM_all.2@res, type="correlation", lag.max = 24)

plot(za_lnRWPHM_all.2)

# Model C
za_lnRWPHM_all.3 <- ur.za(lnRWPHM_all, model="both", lag=4)
summary(za_lnRWPHM_all.3)
## 
## ################################ 
## # Zivot-Andrews Unit Root Test # 
## ################################ 
## 
## 
## Call:
## lm(formula = testmat)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0173172 -0.0041552 -0.0001391  0.0039140  0.0219687 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.840e-02  1.044e-02  -3.678 0.000285 ***
## y.l1         9.795e-01  4.718e-03 207.603  < 2e-16 ***
## trend        1.714e-05  1.244e-05   1.378 0.169367    
## y.dl1        3.626e-02  5.808e-02   0.624 0.532927    
## y.dl2        2.134e-02  5.761e-02   0.370 0.711336    
## y.dl3        9.851e-02  5.662e-02   1.740 0.083087 .  
## y.dl4       -1.855e-01  5.633e-02  -3.294 0.001125 ** 
## du          -5.705e-03  2.897e-03  -1.969 0.049987 *  
## dt           3.699e-04  2.206e-04   1.677 0.094814 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.00607 on 262 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.9991, Adjusted R-squared:  0.999 
## F-statistic: 3.463e+04 on 8 and 262 DF,  p-value: < 2.2e-16
## 
## 
## Teststatistic: -4.3498 
## Critical values: 0.01= -5.57 0.05= -5.08 0.1= -4.82 
## 
## Potential break point at position: 255
Acf(za_lnRWPHM_all.3@res, type="correlation", lag.max = 24)

plot(za_lnRWPHM_all.3)



In this time series of Log transformed real wage per hour in manufacturing it looks like the Zivot-Andrews test is suggesting that we Reject the Null in the first test where Model A is our alternative which we are accepting at the greater that 2.5% c.v. for a trend stationary time series with a structural break in the level at position 142 which is April 1982. This seems reasonable but just by eyeing the data I would have said we had a change in the trend around this point. Interesting results!