FRED/RSAFSImporting and transforming the data:
RSAFS <- Quandl("FRED/RSAFS", type="ts")
rsafs <- log(RSAFS)
Plotting the FRED/RSAFS at level and log transformation:
par(mfrow=c(1,2))
plot(RSAFS, xlab="", ylab="Million of Dollars", main="Real Personal Con. Exp.")
plot(rsafs, xlab="", ylab="Log Scale",main="Log of Retail and Food Services Sales")
The next step is to do the actual Zivot-Andrews test, the test itself is a left tail test with the null hypothesis of no structural break exist. We will test the structural break for the intercep first at lag 2 and 4.
rsafs.ur.za1 <- ur.za(rsafs, model="intercept", lag=4)
summary(rsafs.ur.za1)
################################
# 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
rsafs.ur.za2 <- ur.za(rsafs, model="intercept", lag=2)
summary(rsafs.ur.za2)
################################
# 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
The test conducted before does not indicate that there is a structural break in our dataset.The next step is to repeat the test to detect any structural break in the trend.
rsafs.ur.za3 <- ur.za(rsafs, model="trend", lag=4)
summary(rsafs.ur.za3)
##
## ################################
## # 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
rsafs.ur.za4 <- ur.za(rsafs, model="trend", lag=2)
summary(rsafs.ur.za4)
##
## ################################
## # 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
On both lag 2 and 4, Zivot-Andrews test indicate that there is a break in the dataset
FRED/DNDGRG3M086SBEAImporting and transforming the data:
PCE <- Quandl("FRED/DNDGRG3M086SBEA", type="ts")
pce <- log(PCE)
Plotting the FRED/DNDGRG3M086SBEA at level and log transformation:
par(mfrow=c(1,2))
plot(PCE, xlab="", ylab="Chain-Type Index", main="Personal Cons. Expenditure: Nondurable Goods")
plot(pce, xlab="", ylab="Log Scale",main="Log of Personal Cons. Expenditure: Nondurable Goods")
Structural break for the intercept at lag 2 and 4:
pce.ur.za1 <- ur.za(pce, model="intercept", lag=4)
summary(pce.ur.za1)
################################
# Zivot-Andrews Unit Root Test #
################################
Call:
lm(formula = testmat)
Residuals:
Min 1Q Median 3Q Max
-0.038406 -0.002232 -0.000137 0.002267 0.023958
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.050e-02 6.703e-03 4.551 6.34e-06 ***
y.l1 9.901e-01 2.293e-03 431.817 < 2e-16 ***
trend 1.558e-05 5.338e-06 2.918 0.00364 **
y.dl1 4.579e-01 3.823e-02 11.978 < 2e-16 ***
y.dl2 -1.354e-01 4.217e-02 -3.212 0.00138 **
y.dl3 7.632e-03 4.217e-02 0.181 0.85643
y.dl4 2.264e-02 3.819e-02 0.593 0.55360
du 6.414e-03 1.135e-03 5.651 2.36e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.005028 on 672 degrees of freedom
(5 observations deleted due to missingness)
Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
F-statistic: 1.282e+06 on 7 and 672 DF, p-value: < 2.2e-16
Teststatistic: -4.3009
Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
Potential break point at position: 168
pce.ur.za2 <- ur.za(pce, model="intercept", lag=2)
summary(pce.ur.za2)
################################
# 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
The test conducted before does indicate that there is a structural break in our dataset.The next step is to repeat the test to detect any structural break in the trend.
pce.ur.za3 <- ur.za(pce, model="trend", lag=4)
summary(pce.ur.za3)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.038067 -0.002285 -0.000142 0.002281 0.023960
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.607e-02 6.627e-03 3.934 9.23e-05 ***
## y.l1 9.907e-01 2.417e-03 409.837 < 2e-16 ***
## trend 4.991e-05 1.155e-05 4.322 1.78e-05 ***
## y.dl1 4.679e-01 3.828e-02 12.226 < 2e-16 ***
## y.dl2 -1.300e-01 4.236e-02 -3.069 0.00223 **
## y.dl3 1.167e-02 4.238e-02 0.275 0.78311
## y.dl4 3.220e-02 3.826e-02 0.842 0.40024
## dt -3.743e-05 7.629e-06 -4.906 1.17e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.005056 on 672 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
## F-statistic: 1.268e+06 on 7 and 672 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -3.8339
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 260
pce.ur.za4 <- ur.za(pce, model="trend", lag=2)
summary(pce.ur.za4)
##
## ################################
## # 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
On both lag 2 and 4, Zivot-Andrews test indicate that there is a break in the dataset, so we can conclude that for this dataset, we have structural break both in trend and intercept.
FRED/DNDGRG3M086SBEAImporting and transforming the data:
EARNINGS <- Quandl("FRED/DNDGRG3M086SBEA", type="ts")
PCE <- Quandl("FRED/PCECTPI", type="ts")
monthly <- ts(EARNINGS,start=c(1959,1),frequency=12)
quarterly <- aggregate(monthly, nfrequency=4)
EARN<-quarterly/4
WAGEHOUR <- EARN/PCE
lwage <- log(WAGEHOUR)
Plotting the log transformed real wage per hour:
plot(lwage, xlab="", ylab="Log Scale of Real Wage per Hour", main="Real Wage per Hour")
Structural break for the intercept at lag 2 and 4:
lwage.ur.za1 <- ur.za(lwage, model="intercept", lag=4)
summary(pce.ur.za1)
################################
# Zivot-Andrews Unit Root Test #
################################
Call:
lm(formula = testmat)
Residuals:
Min 1Q Median 3Q Max
-0.038406 -0.002232 -0.000137 0.002267 0.023958
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.050e-02 6.703e-03 4.551 6.34e-06 ***
y.l1 9.901e-01 2.293e-03 431.817 < 2e-16 ***
trend 1.558e-05 5.338e-06 2.918 0.00364 **
y.dl1 4.579e-01 3.823e-02 11.978 < 2e-16 ***
y.dl2 -1.354e-01 4.217e-02 -3.212 0.00138 **
y.dl3 7.632e-03 4.217e-02 0.181 0.85643
y.dl4 2.264e-02 3.819e-02 0.593 0.55360
du 6.414e-03 1.135e-03 5.651 2.36e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.005028 on 672 degrees of freedom
(5 observations deleted due to missingness)
Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
F-statistic: 1.282e+06 on 7 and 672 DF, p-value: < 2.2e-16
Teststatistic: -4.3009
Critical values: 0.01= -5.34 0.05= -4.8 0.1= -4.58
Potential break point at position: 168
lwage.ur.za2 <- ur.za(lwage, model="intercept", lag=2)
summary(pce.ur.za2)
################################
# 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
The test conducted before does indicate that there is a structural break in our dataset.The next step is to repeat the test to detect any structural break in the trend.
lwage.ur.za3 <- ur.za(lwage, model="trend", lag=4)
summary(pce.ur.za3)
##
## ################################
## # Zivot-Andrews Unit Root Test #
## ################################
##
##
## Call:
## lm(formula = testmat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.038067 -0.002285 -0.000142 0.002281 0.023960
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.607e-02 6.627e-03 3.934 9.23e-05 ***
## y.l1 9.907e-01 2.417e-03 409.837 < 2e-16 ***
## trend 4.991e-05 1.155e-05 4.322 1.78e-05 ***
## y.dl1 4.679e-01 3.828e-02 12.226 < 2e-16 ***
## y.dl2 -1.300e-01 4.236e-02 -3.069 0.00223 **
## y.dl3 1.167e-02 4.238e-02 0.275 0.78311
## y.dl4 3.220e-02 3.826e-02 0.842 0.40024
## dt -3.743e-05 7.629e-06 -4.906 1.17e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.005056 on 672 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
## F-statistic: 1.268e+06 on 7 and 672 DF, p-value: < 2.2e-16
##
##
## Teststatistic: -3.8339
## Critical values: 0.01= -4.93 0.05= -4.42 0.1= -4.11
##
## Potential break point at position: 260
lwage.ur.za4 <- ur.za(lwage, model="trend", lag=2)
summary(pce.ur.za4)
##
## ################################
## # 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
On both lag 2 and 4, Zivot-Andrews test indicate that there is a break in the dataset, so we can conclude that for this dataset, we have structural break both in trend and intercept.