Direction

Transform the data and test using ADF and KPSS tests.

Category A: Real Personal Consumption Expenditure per Capita Data

The data that I am going to use for the category A is Real Personal Consumption Expenditure per Capita Data

pcep <- Quandl("FRED/A794RX0Q048SBEA", type="ts")
lpcep <- log(pcep)

Plotting the data

plot(pcep, xlab="", ylab="", main="Real Personal Consumption Expenditures Per Capita")

plot(lpcep, xlab="", ylab="", main="Log in Personal Consumption Expenditures Per Capita")

We can see that there is a structural break in around 2010. To test the stationarity, first we can use ADF test

lpcep.urdf<-ur.df(lpcep, type="trend", selectlags="BIC")
summary(lpcep.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.044194 -0.003682  0.000176  0.004222  0.039169 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)
## (Intercept)  1.087e-01  1.068e-01   1.018    0.310
## z.lag.1     -1.147e-02  1.187e-02  -0.967    0.335
## tt           5.988e-05  6.771e-05   0.884    0.377
## z.diff.lag   9.439e-02  6.116e-02   1.543    0.124
## 
## Residual standard error: 0.008187 on 270 degrees of freedom
## Multiple R-squared:  0.01389,    Adjusted R-squared:  0.002935 
## F-statistic: 1.268 on 3 and 270 DF,  p-value: 0.2857
## 
## 
## Value of test-statistic is: -0.9667 22.1663 0.824 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.98 -3.42 -3.13
## phi2  6.15  4.71  4.05
## phi3  8.34  6.30  5.36

From the ADF test we can see that t-statistics are not significant which means that we cannot reject null hypothesis, Real Personal Consumption Expenditures Per Capita is not trend stationary. Looking at \(\phi_3\) we see that we cannot reject hypothesis null, proceed to estimate model B

lpcep.urdf<-ur.df(lpcep, type="drift", selectlags="BIC")
summary(lpcep.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression drift 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.044421 -0.003538  0.000291  0.003914  0.039085 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.014734   0.010773   1.368    0.173
## z.lag.1     -0.001022   0.001097  -0.931    0.353
## z.diff.lag   0.086055   0.060404   1.425    0.155
## 
## Residual standard error: 0.008183 on 271 degrees of freedom
## Multiple R-squared:  0.01103,    Adjusted R-squared:  0.003736 
## F-statistic: 1.512 on 2 and 271 DF,  p-value: 0.2223
## 
## 
## Value of test-statistic is: -0.9309 32.8848 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau2 -3.44 -2.87 -2.57
## phi1  6.47  4.61  3.79

We can see that hypothesis null can not be rejected since \(\tau_2\) showing that t-statistics is bigger than critical value, thus we proceed to see \(\phi_1\) and it is showing that through \(\phi_1\), hypothesis null can be rejected, means that we should estimate restricted model B

lpcep.urdf<-ur.df(lpcep, type="drift", selectlags="Fixed")
summary(lpcep.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression drift 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.044421 -0.003538  0.000291  0.003914  0.039085 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.014734   0.010773   1.368    0.173
## z.lag.1     -0.001022   0.001097  -0.931    0.353
## z.diff.lag   0.086055   0.060404   1.425    0.155
## 
## Residual standard error: 0.008183 on 271 degrees of freedom
## Multiple R-squared:  0.01103,    Adjusted R-squared:  0.003736 
## F-statistic: 1.512 on 2 and 271 DF,  p-value: 0.2223
## 
## 
## Value of test-statistic is: -0.9309 32.8848 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau2 -3.44 -2.87 -2.57
## phi1  6.47  4.61  3.79

From restricted model B we can see that hypothesis null cannot be rejected, proceed to estimate model A

lpcep.urdf<-ur.df(lpcep, type="none", selectlags="BIC")
summary(lpcep.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression none 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.043660 -0.003861  0.000246  0.004194  0.040117 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## z.lag.1    4.772e-04  5.979e-05   7.981 4.09e-14 ***
## z.diff.lag 9.224e-02  6.033e-02   1.529    0.127    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.008196 on 272 degrees of freedom
## Multiple R-squared:  0.2893, Adjusted R-squared:  0.2841 
## F-statistic: 55.37 on 2 and 272 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: 7.9809 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau1 -2.58 -1.95 -1.62

From model A, we can see that \(\tau_1\) statistics is bigger than critical value means that we cannot reject the null hypothesis, means that the data is random walk. COnfirming this test using KPSS tesst we get the same result that proof the data is not trend stationary

kpss.test(lpcep, null="Trend")
## Warning in kpss.test(lpcep, null = "Trend"): p-value smaller than printed
## p-value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  lpcep
## KPSS Trend = 0.66564, Truncation lag parameter = 3, p-value = 0.01

Differencing the data and re-checking the ADF test

dlpcep<-diff(lpcep)
dlpcep.urdf<-ur.df(dlpcep, type="trend", selectlags="BIC")

We can see that now hypothesis null is rejected concluding that difference of log real per capita consumption average is a trend stationary, it is confirmed with KPSS test

kpss.test(dlpcep, null="Trend")
## Warning in kpss.test(dlpcep, null = "Trend"): p-value greater than printed
## p-value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  dlpcep
## KPSS Trend = 0.09943, Truncation lag parameter = 3, p-value = 0.1

Conclusion: Through both KPSS and ADF test, log(pcep) is a random walk, however through differencing the log(pcep), the result shows that the data is trend stationary

Category B: Dow Jones Industrial Index

The data that I am going to use for Category B is Dow Jones Industrial Index. Before using ADF and KPSS test, we have to transform the data first using log difference

dji <- Quandl("YAHOO/INDEX_DJI", type="zoo")
ldji <- diff(log(dji[,4]))
plot(dji[,4], main="Dow Jones Industrial Average")

plot(ldji, main="Log Difference in Dow Jones Industrial Average")

ldji.urdf<-ur.df(ldji, type="trend", selectlags="BIC")
summary(ldji.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.079861 -0.004968  0.000342  0.005360  0.100615 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.309e-04  2.799e-04   1.897   0.0579 .  
## z.lag.1     -1.102e+00  1.862e-02 -59.176   <2e-16 ***
## tt          -7.644e-08  7.969e-08  -0.959   0.3375    
## z.diff.lag   4.464e-02  1.282e-02   3.482   0.0005 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.0109 on 6074 degrees of freedom
## Multiple R-squared:  0.5282, Adjusted R-squared:  0.528 
## F-statistic:  2267 on 3 and 6074 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -59.1759 1167.261 1750.891 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2  6.09  4.68  4.03
## phi3  8.27  6.25  5.34

Test the unit root using ADF test showing that null hypothesis rejected at any level, the value of test statistics is smaller than the critical value. Concluding that the data is trend stationary. Confirming with KPSS test we can get the same result

kpss.test(ldji, null="Trend")
## Warning in kpss.test(ldji, null = "Trend"): p-value greater than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  ldji
## KPSS Trend = 0.07084, Truncation lag parameter = 17, p-value = 0.1

Conclusion: Through both KPSS and ADF test, log(dji) data is trend stationary

Category C: 10-Year Treasury Constant Maturity Rate*

Since this is an interest rate data thus we do not need to transform the data, using the level, we test adf and kpss test.

ten <- Quandl("FRED/DGS10", type="zoo") 
plot(ten, main="10 Year Treasury Constant Maturity Rate")

ten.urdf<-ur.df(ten, type="trend", selectlags="BIC")
summary(ten.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.74280 -0.02942 -0.00143  0.02894  0.63603 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.141e-03  2.276e-03   2.259   0.0239 *  
## z.lag.1     -4.494e-04  2.294e-04  -1.959   0.0502 .  
## tt          -3.646e-07  1.689e-07  -2.158   0.0309 *  
## z.diff.lag   6.904e-02  8.655e-03   7.977 1.62e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06741 on 13285 degrees of freedom
## Multiple R-squared:  0.005212,   Adjusted R-squared:  0.004987 
## F-statistic:  23.2 on 3 and 13285 DF,  p-value: 5.683e-15
## 
## 
## Value of test-statistic is: -1.9589 2.0105 2.9789 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2  6.09  4.68  4.03
## phi3  8.27  6.25  5.34

From the ADF test we cannot rejected hypothesis null, since \(\tau_3\) is bigger than the critical value, showing that the data is not trend stationary. To make sure we have to confirm the data by looking at \(\phi_3\) and from this one, we can not reject hypothesis null at any level of confidence interval. Estimating model B

ten.urdf<-ur.df(ten, type="drift", selectlags="BIC")
summary(ten.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression drift 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.74342 -0.02946 -0.00027  0.02928  0.63562 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.0013528  0.0014490   0.934    0.351    
## z.lag.1     -0.0002361  0.0002070  -1.140    0.254    
## z.diff.lag   0.0691813  0.0086555   7.993 1.43e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06742 on 13286 degrees of freedom
## Multiple R-squared:  0.004863,   Adjusted R-squared:  0.004713 
## F-statistic: 32.46 on 2 and 13286 DF,  p-value: 8.638e-15
## 
## 
## Value of test-statistic is: -1.1402 0.6869 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau2 -3.43 -2.86 -2.57
## phi1  6.43  4.59  3.78

From estimating model B, \(\tau_2\) statistics is still bigger than the critical value thus we proceed to look at \(\phi_1\), stil, the hypothesis null cannot be rejected at any level of the critical value. Estimate model A

ten.urdf<-ur.df(ten, type="none", selectlags="BIC")
summary(ten.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression none 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.74387 -0.02915  0.00025  0.02964  0.63484 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## z.lag.1    -5.922e-05  8.357e-05  -0.709    0.479    
## z.diff.lag  6.906e-02  8.654e-03   7.980 1.59e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06742 on 13287 degrees of freedom
## Multiple R-squared:  0.004804,   Adjusted R-squared:  0.004654 
## F-statistic: 32.07 on 2 and 13287 DF,  p-value: 1.277e-14
## 
## 
## Value of test-statistic is: -0.7087 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau1 -2.58 -1.95 -1.62

From the estimation of model A, \(\tau_1\) statistics tell us that the data is random walk as we cannot reject hypothesis null. This result also confirmed by the KPSS test

kpss.test(ten, null="Trend")
## Warning in kpss.test(ten, null = "Trend"): p-value smaller than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  ten
## KPSS Trend = 8.9218, Truncation lag parameter = 26, p-value = 0.01

So, we have to difference the data and re-checking the ADF test

dten<-diff(ten)
ten.urdf<-ur.df(dten, type="trend", selectlags="BIC")
summary(ten.urdf)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.74510 -0.02945 -0.00079  0.02893  0.63267 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.313e-03  1.170e-03   1.122    0.262    
## z.lag.1     -9.200e-01  1.184e-02 -77.706   <2e-16 ***
## tt          -2.207e-07  1.525e-07  -1.447    0.148    
## z.diff.lag  -1.200e-02  8.676e-03  -1.384    0.167    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06742 on 13284 degrees of freedom
## Multiple R-squared:  0.4657, Adjusted R-squared:  0.4655 
## F-statistic:  3859 on 3 and 13284 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -77.7063 2012.757 3019.136 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2  6.09  4.68  4.03
## phi3  8.27  6.25  5.34

The ADF test of differenced data showing that we can reject hypothesis null and that the data is trend stationary. This is confirmed with the KPSS test

kpss.test(dten, null="Trend")
## Warning in kpss.test(dten, null = "Trend"): p-value greater than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  dten
## KPSS Trend = 0.038166, Truncation lag parameter = 26, p-value =
## 0.1

Conclusion: Through both KPSS and ADF test, ten data is a random walk, however through differencing the ten data, the result shows that the data is trend stationary