In this part we have to use Zivot-Andrews test to analyze the presence of the unit root and structural breaks.
In this part we have to analyze log transformed Retail and Food Services Sales Retail and Food Services Sales (FRED/RSAFS).
library(Quandl)
library(urca)
## Warning: package 'urca' was built under R version 3.2.4
library(fGarch)
## Warning: package 'fGarch' was built under R version 3.2.4
## Warning: package 'timeSeries' was built under R version 3.2.4
## Warning: package 'fBasics' was built under R version 3.2.4
library(stargazer)
rfss=Quandl("FRED/RSAFS", type="zoo")
str(rfss)
## 'zooreg' series from Jan 1992 to Jan 2016
## Data: num [1:289] 164083 164260 163747 164759 165617 ...
## Index: Class 'yearmon' num [1:289] 1992 1992 1992 1992 1992 ...
## Frequency: 12
head(rfss)
## Jan 1992 Feb 1992 Mar 1992 Apr 1992 May 1992 Jun 1992
## 164083 164260 163747 164759 165617 166098
tail(rfss)
## Aug 2015 Sep 2015 Oct 2015 Nov 2015 Dec 2015 Jan 2016
## 447133 446855 446929 448376 449109 449904
plot(rfss, xlab="", ylab="", main="Retail and Food Services Sales (RFSS)")
Now we will log transform the given series:
lrfss=log(rfss)
plot(lrfss, xlab="", ylab="", main="Log transformation of Retail and Food Services Sales (lRFSS)")
Now we will conduct the Zivot-Andrews test (both for trend and intercept)
lrfss.ur.za = ur.za(lrfss, model="intercept", lag=2)
summary(lrfss.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
index(lrfss[lrfss.ur.za@bpoint])
## [1] "Jun 2008"
lrfss.ur.za = ur.za(lrfss, model="trend", lag=2)
summary(lrfss.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
index(lrfss[lrfss.ur.za@bpoint])
## [1] "Aug 1999"
Here we can see that t-statistic is significant at 5%, which means that the break doesn’t exist.
In this section we analyze the Personal consumption expenditures: Nondurable goods (chain-type price index) for the period of 1959-2015.
pce=Quandl("FRED/DNDGRG3M086SBEA", type="zoo")
str(pce)
## 'zooreg' series from Jan 1959 to Jan 2016
## Data: num [1:685] 19.9 19.9 19.9 19.9 19.9 ...
## Index: Class 'yearmon' num [1:685] 1959 1959 1959 1959 1959 ...
## Frequency: 12
head(pce)
## Jan 1959 Feb 1959 Mar 1959 Apr 1959 May 1959 Jun 1959
## 19.874 19.882 19.868 19.880 19.858 19.903
tail(pce)
## Aug 2015 Sep 2015 Oct 2015 Nov 2015 Dec 2015 Jan 2016
## 109.848 108.862 108.950 108.961 108.172 107.700
plot(pce, xlab="", ylab="", main="Personal consumption expenditures: Nondurable goods (PCE)")
Now we will log transform the given series:
lpce=log(pce)
plot(lrfss, xlab="", ylab="", main="Log transformation of Personal consumption expenditures: Nondurable goods (lPCE)")
Now we will conduct the Zivot-Andrews test (both for trend and intercept)
lpce.ur.za = ur.za(lpce, model="intercept", lag=2)
summary(lpce.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.038278 -0.002228 -0.000116 0.002294 0.023752
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.119e-02 6.637e-03 4.699 3.17e-06 ***
## y.l1 9.899e-01 2.273e-03 435.474 < 2e-16 ***
## trend 1.583e-05 5.315e-06 2.977 0.003011 **
## y.dl1 4.562e-01 3.782e-02 12.061 < 2e-16 ***
## y.dl2 -1.296e-01 3.774e-02 -3.434 0.000631 ***
## du 6.618e-03 1.105e-03 5.987 3.47e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.005016 on 676 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
## F-statistic: 1.819e+06 on 5 and 676 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -4.4342
## Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
##
## Potential break point at position: 168
index(lpce[lpce.ur.za@bpoint])
## [1] "Dec 1972"
lpce.ur.za = ur.za(lpce, model="trend", lag=2)
summary(lpce.ur.za)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.037873 -0.002249 -0.000183 0.002339 0.023663
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.654e-02 6.556e-03 4.049 5.75e-05 ***
## y.l1 9.906e-01 2.387e-03 414.996 < 2e-16 ***
## trend 5.076e-05 1.128e-05 4.501 7.97e-06 ***
## y.dl1 4.659e-01 3.791e-02 12.289 < 2e-16 ***
## y.dl2 -1.211e-01 3.787e-02 -3.197 0.00145 **
## dt -3.840e-05 7.374e-06 -5.207 2.54e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.005047 on 676 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
## F-statistic: 1.796e+06 on 5 and 676 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -3.9424
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 261
index(lpce[lpce.ur.za@bpoint])
## [1] "Sep 1980"
And this time we can observe the break in the series.