Use Zivot-Andrews test to analyze the presence of a unit root and structural breaks in the following series:
Log transformed Retail and Food Services Sales FRED/RSAFS
Log transformed Personal consumption expenditures: Nondurable goods (chain-type price index) FRED/DNDGRG3M086SBEA
Log transformed real wage per hour in manufacturing, constructed by dividing the Average Hourly Earnings of Production and Nonsupervisory Employees in Manufacturing, FRED/DNDGRG3M086SBEA, with the Personal Consumption Expenditures: Chain-type Price Index FRED/PCECTPI
To answer the first point of this problem, we should transform the variable of Retail and Food Services Sales and Personal Consumption Expenditures (Nondurable goods, chain-type price index)
rsafs<-Quandl("FRED/RSAFS", type="ts")
lrsafs<-log(rsafs)
pceng<-Quandl("FRED/PCECTPI", type="ts")
lpceng<-log(pceng)
earning<-Quandl("FRED/DNDGRG3M086SBEA", type="ts")
wph<-Quandl("FRED/PCECTPI", type="ts")
monthly <- ts(earning,start=c(1959,1),frequency=12)
quarterlywp <- aggregate(monthly, nfrequency=4)
qwp<-quarterlywp/4
wp<-qwp/wph
lwp<-log(wp)
Then, we can start on looking at the plot of each data first
plot(lrsafs, xlab="", ylab="", main="Retail and Food Services Sales")
plot(lpceng, xlab="", ylab="", main="Personal consumption expenditures: Nondurable goods")
plot(lwp, xlab="", ylab="", main="Real Wage per Hour in Manufacturing")
For Retail and Food Services Sales we can see that there seems to be a break in around 2009, roughly it looks like a break in level. However for personal consumption expenditures, it is more difficult to see if there is a break or not. However for data of Real Wage per Hour in Manufacturing, there seems to be multiple breaks. To be sure, we have to test all the data formally, by using Zivot and Andrews’ test.
The first thing to do is to estimate the model and look at its t-statistics of Zivot-Andrews Unit Root test. Note that this is a left side test, and if Hypothesis null is not rejected then it is not a break. Lag determined is 4 and 2.
lrsafs.ur.za<-ur.za(lrsafs, model="intercept", lag=4)
summary(lrsafs.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.033467 -0.004643 0.000584 0.005413 0.057976
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.441e+00 2.485e-01 5.798 1.83e-08 ***
## y.l1 8.808e-01 2.063e-02 42.693 < 2e-16 ***
## trend 4.904e-04 8.683e-05 5.648 4.04e-08 ***
## y.dl1 -1.036e-01 5.677e-02 -1.824 0.0692 .
## y.dl2 1.079e-02 5.707e-02 0.189 0.8502
## y.dl3 4.302e-02 5.701e-02 0.755 0.4511
## y.dl4 7.800e-02 5.665e-02 1.377 0.1697
## du -2.346e-02 4.318e-03 -5.433 1.22e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.009247 on 276 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.9989, Adjusted R-squared: 0.9989
## F-statistic: 3.63e+04 on 7 and 276 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -5.7779
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 198
lrsafs.ur.za<-ur.za(lrsafs, model="intercept", lag=2)
summary(lrsafs.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.034502 -0.004977 0.000477 0.005571 0.057190
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.388e+00 2.442e-01 5.682 3.33e-08 ***
## y.l1 8.852e-01 2.028e-02 43.654 < 2e-16 ***
## trend 4.729e-04 8.565e-05 5.521 7.68e-08 ***
## y.dl1 -9.999e-02 5.660e-02 -1.767 0.0784 .
## y.dl2 1.014e-02 5.652e-02 0.179 0.8577
## du -2.298e-02 4.286e-03 -5.362 1.73e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.009232 on 280 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.9989, Adjusted R-squared: 0.9989
## F-statistic: 5.261e+04 on 5 and 280 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -5.6598
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 198
From the test we see that there is no break in intercept at lag 2 or lag 4. At lag equal to 2 and 4 we can see that hypothesis null is rejected as the t-statistics is bigger than all the critical values in each confidence level. Although we still can check whether the break is in the trend
lrsafs.ur.za<-ur.za(lrsafs, model="trend", lag=4)
summary(lrsafs.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.042191 -0.004504 0.000861 0.004788 0.059130
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.425e-01 2.088e-01 2.599 0.00986 **
## y.l1 9.554e-01 1.737e-02 54.987 < 2e-16 ***
## trend 1.785e-04 7.965e-05 2.242 0.02579 *
## y.dl1 -9.447e-02 6.001e-02 -1.574 0.11655
## y.dl2 2.807e-02 6.027e-02 0.466 0.64183
## y.dl3 5.652e-02 6.021e-02 0.939 0.34870
## y.dl4 8.875e-02 5.975e-02 1.485 0.13860
## dt -8.485e-05 4.872e-05 -1.742 0.08269 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.009676 on 276 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.9988, Adjusted R-squared: 0.9988
## F-statistic: 3.315e+04 on 7 and 276 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -2.5692
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 147
lrsafs.ur.za<-ur.za(lrsafs, model="trend", lag=2)
summary(lrsafs.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.043028 -0.004381 0.000818 0.005001 0.057915
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.498e-01 1.860e-01 2.418 0.0162 *
## y.l1 9.630e-01 1.552e-02 62.046 <2e-16 ***
## trend 1.750e-04 8.939e-05 1.958 0.0512 .
## y.dl1 -9.712e-02 5.949e-02 -1.632 0.1037
## y.dl2 1.900e-02 5.930e-02 0.320 0.7489
## dt -8.530e-05 5.528e-05 -1.543 0.1239
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.009654 on 280 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.9988, Adjusted R-squared: 0.9988
## F-statistic: 4.811e+04 on 5 and 280 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -2.3821
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 92
However, both lag 2 and lag 4 test showing that hypothesis null is no longer rejected, this means that there is break in the trend for Retail and Food Service data set.
For this data, it was not clear whether there is a break or not if we just observe it from the data plot.
lpceng.ur.za<-ur.za(lpceng, model="intercept", lag=4)
summary(lpceng.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0220950 -0.0017593 0.0001047 0.0017849 0.0176871
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.197e-02 6.171e-03 5.182 4.38e-07 ***
## y.l1 9.885e-01 2.418e-03 408.840 < 2e-16 ***
## trend 5.643e-05 1.778e-05 3.174 0.00168 **
## y.dl1 5.425e-01 5.978e-02 9.075 < 2e-16 ***
## y.dl2 3.452e-02 6.625e-02 0.521 0.60280
## y.dl3 1.962e-01 6.638e-02 2.955 0.00341 **
## y.dl4 -1.501e-01 5.747e-02 -2.611 0.00953 **
## du 8.788e-03 1.508e-03 5.828 1.64e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003845 on 263 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.362e+06 on 7 and 263 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -4.7595
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 104
lpceng.ur.za<-ur.za(lpceng, model="intercept", lag=2)
summary(lpceng.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0223838 -0.0018041 0.0000567 0.0019279 0.0177756
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.292e-02 6.539e-03 5.034 8.85e-07 ***
## y.l1 9.882e-01 2.557e-03 386.414 < 2e-16 ***
## trend 5.847e-05 1.848e-05 3.163 0.00174 **
## y.dl1 5.484e-01 5.977e-02 9.175 < 2e-16 ***
## y.dl2 7.882e-02 5.837e-02 1.350 0.17802
## du 8.829e-03 1.570e-03 5.623 4.73e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003981 on 267 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.808e+06 on 5 and 267 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -4.6305
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 105
From the test we can see that in the intercept, at both lag, break detected as hypothesis null is not rejected at 1% and 5% confidence interval however, it is rejected at 10%. Since we cannot see clearly whether the break is in intercept or at the trend, we should test whether there is a change in a trend or not
lpceng.ur.za<-ur.za(lpceng, model="trend", lag=4)
summary(lpceng.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0224588 -0.0019250 -0.0002399 0.0018072 0.0181762
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.508e-02 5.091e-03 2.962 0.00334 **
## y.l1 9.939e-01 2.165e-03 459.003 < 2e-16 ***
## trend 7.542e-05 2.360e-05 3.195 0.00157 **
## y.dl1 5.971e-01 6.071e-02 9.836 < 2e-16 ***
## y.dl2 6.128e-02 6.845e-02 0.895 0.37148
## y.dl3 2.081e-01 6.879e-02 3.026 0.00273 **
## y.dl4 -1.180e-01 5.917e-02 -1.994 0.04714 *
## dt -6.409e-05 1.773e-05 -3.615 0.00036 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003988 on 263 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.266e+06 on 7 and 263 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -2.7989
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 169
lpceng.ur.za<-ur.za(lpceng, model="trend", lag=2)
summary(lpceng.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0227569 -0.0019931 -0.0001692 0.0019764 0.0174613
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.426e-02 5.165e-03 2.761 0.006169 **
## y.l1 9.944e-01 2.185e-03 455.024 < 2e-16 ***
## trend 6.948e-05 2.354e-05 2.952 0.003440 **
## y.dl1 6.191e-01 5.950e-02 10.405 < 2e-16 ***
## y.dl2 1.255e-01 5.933e-02 2.115 0.035345 *
## dt -6.148e-05 1.762e-05 -3.490 0.000566 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004118 on 267 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.691e+06 on 5 and 267 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -2.5718
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 170
Test conducted in both lags showing that t-statistics is smaller than all critical values, and since this is a left test then when hypothesis null is not rejected it means that there is structural change in the trend and intercept.
For this data, it seems that there are several breaks presented, although Bai-Perron’s test is more sufficient in detecting this case, we will try to detect them through Zivot-Andrew’s Test.
lwp.ur.za<-ur.za(lwp, model="intercept", lag=4)
summary(lwp.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.049021 -0.002945 -0.000458 0.002929 0.019873
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -9.392e-03 2.613e-03 -3.595 0.000403 ***
## y.l1 9.402e-01 1.691e-02 55.586 < 2e-16 ***
## trend 1.586e-06 1.467e-05 0.108 0.913982
## y.dl1 2.550e-01 6.614e-02 3.855 0.000153 ***
## y.dl2 -1.222e-01 6.770e-02 -1.804 0.072594 .
## y.dl3 1.843e-01 6.779e-02 2.719 0.007078 **
## y.dl4 -7.455e-02 6.922e-02 -1.077 0.282668
## du -7.813e-03 2.447e-03 -3.193 0.001622 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.006986 on 215 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.9888, Adjusted R-squared: 0.9884
## F-statistic: 2700 on 7 and 215 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -3.5336
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 95
lwp.ur.za<-ur.za(lwp, model="intercept", lag=2)
summary(lwp.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.048249 -0.003051 -0.000439 0.003193 0.019877
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8.491e-03 2.322e-03 -3.656 0.000321 ***
## y.l1 9.469e-01 1.520e-02 62.277 < 2e-16 ***
## trend 8.682e-06 1.457e-05 0.596 0.551929
## y.dl1 2.095e-01 6.585e-02 3.181 0.001678 **
## y.dl2 -9.622e-02 6.609e-02 -1.456 0.146848
## du -8.161e-03 2.207e-03 -3.697 0.000275 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.007 on 219 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.9886, Adjusted R-squared: 0.9884
## F-statistic: 3811 on 5 and 219 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -3.4948
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 91
Both lags showing that there is a structural break in the intercept as both t-statistics are smaller than their critical values at any level of confidence interval. We can also check if there is a change in the break
lwp.ur.za<-ur.za(lwp, model="trend", lag=4)
summary(lwp.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.050474 -0.003157 -0.000224 0.002933 0.020425
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.086e-03 1.943e-03 -2.103 0.03666 *
## y.l1 9.617e-01 1.531e-02 62.818 < 2e-16 ***
## trend -4.988e-05 2.163e-05 -2.306 0.02205 *
## y.dl1 2.633e-01 6.718e-02 3.919 0.00012 ***
## y.dl2 -1.133e-01 6.880e-02 -1.646 0.10118
## y.dl3 1.968e-01 6.885e-02 2.859 0.00467 **
## y.dl4 -5.705e-02 7.013e-02 -0.814 0.41683
## dt 7.042e-05 4.129e-05 1.705 0.08955 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.007102 on 215 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.9884, Adjusted R-squared: 0.988
## F-statistic: 2612 on 7 and 215 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -2.5044
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 154
lwp.ur.za<-ur.za(lwp, model="trend", lag=2)
summary(lwp.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.049698 -0.003170 -0.000433 0.002970 0.020690
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.782e-03 1.938e-03 -1.952 0.052218 .
## y.l1 9.660e-01 1.495e-02 64.601 < 2e-16 ***
## trend -4.480e-05 2.124e-05 -2.109 0.036081 *
## y.dl1 2.390e-01 6.695e-02 3.571 0.000438 ***
## y.dl2 -6.659e-02 6.730e-02 -0.989 0.323513
## dt 6.277e-05 3.950e-05 1.589 0.113453
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.007174 on 219 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.9881, Adjusted R-squared: 0.9878
## F-statistic: 3626 on 5 and 219 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -2.2713
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 151
From the trend test, we can also see that the break is also happen in the trend as hypothesis null aren’t rejected. The data is having structural break both in trend and intercept.
The data showing that there is structural break in the trend for Retail and Food Services Sales data and also there is structural break both in the trend and intercept at confidence interval 1% and 5% for Personal consumption expenditures: Nondurable goods data. And there is a structural break in both intercept and trend for the Real Wage Per Hour in Manufacturing data.