Q1

We consider time series from each of the three categories given in the problem. We look at the FRED Database and Yahoo Finance time series data.

First we load the “Quandl” packages and the

library("Quandl")
library("tseries")
library("urca")

Category A

Real personal consumption expenditures per capita **FRED/A794RX0Q048SBEA

This data is expected to rise over time. We plot the first differences of the original time series.

rconsum<-Quandl("FRED/A794RX0Q048SBEA", type="zoo")
diffrconsum<-diff(rconsum,1)
par(mfrow=c(1,2))
plot(rconsum,xlab="Time", ylab="Real Personal Consumption Actual")
plot(diffrconsum,xlab="Time", ylab="First Differences RPC")

I conduct ADF tests on both the time series and the first differences of the Real Personal Consumption Expenditures per Capita data.

adf.rconsum<-ur.df(rconsum,type="trend",selectlags="BIC")
summary(adf.rconsum)
## 
## ############################################### 
## # 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 
## -509.13  -66.20    2.28   67.87  370.70 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 102.341827  32.791009   3.121  0.00200 ** 
## z.lag.1      -0.013012   0.005639  -2.308  0.02177 *  
## tt            1.600519   0.602343   2.657  0.00835 ** 
## z.diff.lag    0.300107   0.057422   5.226 3.46e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 125.3 on 270 degrees of freedom
## Multiple R-squared:  0.1444, Adjusted R-squared:  0.1349 
## F-statistic: 15.19 on 3 and 270 DF,  p-value: 3.664e-09
## 
## 
## Value of test-statistic is: -2.3077 19.7139 5.4141 
## 
## 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
adf.diffconsum<-ur.df(diffrconsum,type="trend",selectlags="BIC")
summary(adf.diffconsum)
## 
## ############################################### 
## # 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 
## -475.71  -63.12   -7.21   73.51  329.40 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 26.13238   15.16490   1.723    0.086 .  
## z.lag.1     -0.48448    0.06845  -7.078 1.27e-11 ***
## tt           0.15534    0.09546   1.627    0.105    
## z.diff.lag  -0.30103    0.05811  -5.181 4.34e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 120.8 on 269 degrees of freedom
## Multiple R-squared:  0.4061, Adjusted R-squared:  0.3995 
## F-statistic: 61.31 on 3 and 269 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -7.0783 16.7038 25.052 
## 
## 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

Next, I conduct KPSS tests on both the time series and the first differences of the Real Personal Consumption Expenditures per Capita data.

kpss.rconsum<-kpss.test(rconsum,null=“Trend”) summary(kpss.rconsum) kpss.diffrconsum<-kpss.test(diffrconsum,null=“Trend”) summary(kpss.diffrconsum)

Category B

NYSE Composite Index YAHOO/INDEX_NYA

nya<-Quandl("YAHOO/INDEX_NYA", type="zoo")
lognya<-log(nya$Close)
difflognya<-diff(lognya,1)
par(mfrow=c(1,2))
plot(nya$Close,xlab="Time", ylab="NYSE Composite Index")
plot(difflognya,xlab="Time", ylab="Log Differences NYSE")

I just posted the side by side graphs of the NYSE time series and the log differences of the NYSE time series. Now I perform the ADF and KPSS tests on both. First is the ADF test.

adf.nya<-ur.df(nya$Close,type="trend",selectlags="BIC")
summary(adf.nya)
## 
## ############################################### 
## # 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 
## -688.63   -7.66    0.38    8.68  689.45 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.6065398  1.1373619  -1.413  0.15782    
## z.lag.1     -0.0009976  0.0003816  -2.614  0.00896 ** 
## tt           0.0009435  0.0003439   2.743  0.00609 ** 
## z.diff.lag  -0.0426340  0.0088977  -4.792 1.67e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 53.14 on 12614 degrees of freedom
## Multiple R-squared:  0.002447,   Adjusted R-squared:  0.00221 
## F-statistic: 10.32 on 3 and 12614 DF,  p-value: 8.874e-07
## 
## 
## Value of test-statistic is: -2.6139 3.3455 3.7824 
## 
## 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
adf.diffnya<-ur.df(difflognya,type="trend",selectlags="BIC")
summary(adf.diffnya)
## 
## ############################################### 
## # 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.211463 -0.004575  0.000215  0.004865  0.113162 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.985e-04  1.804e-04   1.100 0.271333    
## z.lag.1     -9.866e-01  1.230e-02 -80.193  < 2e-16 ***
## tt           4.397e-09  2.476e-08   0.178 0.859083    
## z.diff.lag   3.297e-02  8.901e-03   3.705 0.000213 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01013 on 12613 degrees of freedom
## Multiple R-squared:  0.4781, Adjusted R-squared:  0.4779 
## F-statistic:  3851 on 3 and 12613 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -80.1933 2143.657 3215.485 
## 
## 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

Next, I conduct KPSS tests on both the time series and the log differences of the NYSE time series.

kpss.nya<-kpss.test(nya$Close,null="Trend")
## Warning in kpss.test(nya$Close, null = "Trend"): p-value smaller than
## printed p-value
summary(kpss.nya)
##           Length Class  Mode     
## statistic 1      -none- numeric  
## parameter 1      -none- numeric  
## p.value   1      -none- numeric  
## method    1      -none- character
## data.name 1      -none- character
kpss.diffnya<-kpss.test(difflognya,null="Trend")
## Warning in kpss.test(difflognya, null = "Trend"): p-value greater than
## printed p-value
summary(kpss.diffnya)
##           Length Class  Mode     
## statistic 1      -none- numeric  
## parameter 1      -none- numeric  
## p.value   1      -none- numeric  
## method    1      -none- character
## data.name 1      -none- character

Category C

10-Year Treasury Constant Maturity Rate FRED/DGS10

The 10 year treasury rate does not necessarily have a trend over time. Taking the first differences should lead to a stationary or weakly stationary result.

teny<-Quandl("FRED/DGS10", type="zoo")
diffteny<-diff(teny,1)
par(mfrow=c(1,2))
plot(teny,xlab="Time", ylab="10Y Treasury Rate")
plot(diffteny,xlab="Time", ylab="First Differences 10Y")

Like in the previous examples, first I take the ADF of the two time series data.

adf.teny<-ur.df(teny,type="trend",selectlags="BIC")
summary(adf.teny)
## 
## ############################################### 
## # 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.74236 -0.02926 -0.00144  0.02869  0.63474 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.947e-03  2.234e-03   2.214   0.0268 *  
## z.lag.1     -4.349e-04  2.274e-04  -1.913   0.0558 .  
## tt          -3.503e-07  1.668e-07  -2.101   0.0357 *  
## z.diff.lag   7.462e-02  8.658e-03   8.619   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06714 on 13265 degrees of freedom
## Multiple R-squared:  0.005998,   Adjusted R-squared:  0.005773 
## F-statistic: 26.68 on 3 and 13265 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -1.9127 1.9392 2.8727 
## 
## 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
adf.difften<-ur.df(diffteny,type="trend",selectlags="BIC")
summary(adf.difften)
## 
## ############################################### 
## # 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.74444 -0.02920 -0.00079  0.02868  0.63177 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.303e-03  1.166e-03   1.117    0.264    
## z.lag.1     -9.178e-01  1.181e-02 -77.691   <2e-16 ***
## tt          -2.193e-07  1.522e-07  -1.441    0.150    
## z.diff.lag  -8.356e-03  8.683e-03  -0.962    0.336    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06715 on 13264 degrees of freedom
## Multiple R-squared:  0.4628, Adjusted R-squared:  0.4627 
## F-statistic:  3809 on 3 and 13264 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -77.6906 2011.943 3017.914 
## 
## 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

Next, I conduct KPSS tests on both time series, like in previous examples.

kpss.ten<-kpss.test(teny,null="Trend")
## Warning in kpss.test(teny, null = "Trend"): p-value smaller than printed p-
## value
summary(kpss.ten)
##           Length Class  Mode     
## statistic 1      -none- numeric  
## parameter 1      -none- numeric  
## p.value   1      -none- numeric  
## method    1      -none- character
## data.name 1      -none- character
kpss.difften<-kpss.test(diffteny,null="Trend")
## Warning in kpss.test(diffteny, null = "Trend"): p-value greater than
## printed p-value
summary(kpss.difften)
##           Length Class  Mode     
## statistic 1      -none- numeric  
## parameter 1      -none- numeric  
## p.value   1      -none- numeric  
## method    1      -none- character
## data.name 1      -none- character

This marks the end of Problem number 1.