Part A

From the given list of categories I chose “Real personal consumption expenditures per capita” to analyze. Task requires to identify whether log transformation is required, plotting the graphs and performing the ADF and KPSS tests on times series.

library(Quandl)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
rPCE <- Quandl("FRED/A794RX0Q048SBEA", type="zoo")
str(rPCE)
## 'zooreg' series from 1947 Q1 to 2015 Q4
##   Data: num [1:276] 8378 8479 8468 8431 8437 ...
##   Index: Class 'yearqtr'  num [1:276] 1947 1947 1948 1948 1948 ...
##   Frequency: 4
head(rPCE)
## 1947 Q1 1947 Q2 1947 Q3 1947 Q4 1948 Q1 1948 Q2 
##    8378    8479    8468    8431    8437    8501
tail(rPCE)
## 2014 Q3 2014 Q4 2015 Q1 2015 Q2 2015 Q3 2015 Q4 
##   34169   34455   34546   34789   34975   35078
plot(rPCE, xlab="Years", ylab="", main="Real personal consumption expenditures per capita")

Ploted graph of original data shows that time series most probably has exponential trend. Therefore it was log transformed and then the first difference of log series was taken. Resulting 2 graphs are as follows:

lrPCE<-log(rPCE)
dlrPCE<-diff(lrPCE)
par(mfrow=c(2,2))
plot(lrPCE,xlab="",ylab="",main="Log rPCE")
plot(dlrPCE,xlab="",ylab="",main="First differance of Log rPCEI")

Now we perform the ADF and KPSS tests:

library(tseries)
adf.test(lrPCE)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  lrPCE
## Dickey-Fuller = -1.1859, Lag order = 6, p-value = 0.9073
## alternative hypothesis: stationary
adf.test(dlrPCE)
## Warning in adf.test(dlrPCE): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  dlrPCE
## Dickey-Fuller = -5.7419, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary

Here we can see that with log transformed series we fail to reject the null hypothesis of non-stationarity. And the ADF test of log difference shows that the series is stationary.

Now let’s consider the KPSS tests:

kpss.test(lrPCE)
## Warning in kpss.test(lrPCE): p-value smaller than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  lrPCE
## KPSS Level = 6.9985, Truncation lag parameter = 3, p-value = 0.01
kpss.test(dlrPCE)
## Warning in kpss.test(dlrPCE): p-value greater than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  dlrPCE
## KPSS Level = 0.17343, Truncation lag parameter = 3, p-value = 0.1

According to KPSS of log difference we can reject the null hypothesis at 10% level, which signals that series is stationary after the log difference.

Part B

For this part I chose to analyze NYSE Composite Index (adjusted close rates).

NYSE <- Quandl("YAHOO/INDEX_NYA", type="zoo")
str(NYSE)
## 'zoo' series from 1965-12-31 to 2016-02-26
##   Data: num [1:12627, 1:6] 529 527 528 531 532 ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr [1:6] "Open" "High" "Low" "Close" ...
##   Index:  Date[1:12627], format: "1965-12-31" "1966-01-03" "1966-01-04" "1966-01-05" ...
head(NYSE)
##              Open   High    Low  Close Volume Adjusted Close
## 1965-12-31 528.69 528.69 528.69 528.69      0         528.69
## 1966-01-03 527.21 527.21 527.21 527.21      0         527.21
## 1966-01-04 527.84 527.84 527.84 527.84      0         527.84
## 1966-01-05 531.12 531.12 531.12 531.12      0         531.12
## 1966-01-06 532.07 532.07 532.07 532.07      0         532.07
## 1966-01-07 532.60 532.60 532.60 532.60      0         532.60
tail(NYSE)
##               Open    High     Low   Close     Volume Adjusted Close
## 2016-02-19 9465.18 9504.98 9406.54 9485.96 4142850000        9485.96
## 2016-02-22 9485.77 9623.64 9485.77 9616.32 4054710000        9616.32
## 2016-02-23 9582.76 9589.74 9485.36 9494.32 3890650000        9494.32
## 2016-02-24 9411.26 9517.75 9325.24 9506.07 4317250000        9506.07
## 2016-02-25 9534.74 9625.71 9506.24 9625.28 4118210000        9625.28
## 2016-02-26 9668.26 9682.93 9607.66 9619.80 4348510000        9619.80
NYSE_AC<-NYSE[,6]
plot(NYSE_AC, xlab="", ylab="", main="NYSE Composite Index")

This series also exhibit exponential growth, so I’m log transforming and taking first difference:

lNYSE<-log(NYSE_AC)
dlNYSE<-diff(lNYSE)
par(mfrow=c(2,2))
plot(lNYSE,xlab="",ylab="",main="Log NYSE")
plot(dlNYSE,xlab="",ylab="",main="First differance of Log NYSE")

ADF and KPSS tests are:

adf.test(lNYSE)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  lNYSE
## Dickey-Fuller = -2.3407, Lag order = 23, p-value = 0.434
## alternative hypothesis: stationary
adf.test(dlNYSE)
## Warning in adf.test(dlNYSE): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  dlNYSE
## Dickey-Fuller = -22.879, Lag order = 23, p-value = 0.01
## alternative hypothesis: stationary
kpss.test(lNYSE)
## Warning in kpss.test(lNYSE): p-value smaller than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  lNYSE
## KPSS Level = 48.107, Truncation lag parameter = 25, p-value = 0.01
kpss.test(dlNYSE)
## Warning in kpss.test(dlNYSE): p-value greater than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  dlNYSE
## KPSS Level = 0.1007, Truncation lag parameter = 25, p-value = 0.1

Again it’s clear that after taking the log difference data becomes stationary and we can reject the null hypothesis of non-stationarity.

Part C

For this part I chose “10-Year Treasury Constant Maturity Rate” to analyze.

DGS10 <- Quandl("FRED/DGS10", type="zoo")
str(DGS10)
## 'zoo' series from 1962-01-02 to 2016-02-25
##   Data: num [1:13522] 4.06 4.03 3.99 4.02 4.03 4.05 4.07 4.08 4.08 4.1 ...
##   Index:  Date[1:13522], format: "1962-01-02" "1962-01-03" "1962-01-04" "1962-01-05" ...
head(DGS10)
## 1962-01-02 1962-01-03 1962-01-04 1962-01-05 1962-01-08 1962-01-09 
##       4.06       4.03       3.99       4.02       4.03       4.05
tail(DGS10)
## 2016-02-18 2016-02-19 2016-02-22 2016-02-23 2016-02-24 2016-02-25 
##       1.75       1.76       1.77       1.74       1.75       1.71
plot(DGS10, xlab="", ylab="", main="10-Year Treasury Constant Maturity Rate (DGS10)")

For further analysis let’s take the first difference of the series:

dDGS10<-diff(DGS10)
plot(dDGS10,xlab="",ylab="",main="First Differance of  DGS10")

ADF and KPSS tests are:

adf.test(DGS10)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  DGS10
## Dickey-Fuller = -2.0881, Lag order = 23, p-value = 0.5411
## alternative hypothesis: stationary
adf.test(dDGS10)
## Warning in adf.test(dDGS10): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  dDGS10
## Dickey-Fuller = -22.177, Lag order = 23, p-value = 0.01
## alternative hypothesis: stationary
kpss.test(DGS10)
## Warning in kpss.test(DGS10): p-value smaller than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  DGS10
## KPSS Level = 17.389, Truncation lag parameter = 26, p-value = 0.01
kpss.test(dDGS10)
## Warning in kpss.test(dDGS10): p-value greater than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  dDGS10
## KPSS Level = 0.24106, Truncation lag parameter = 26, p-value = 0.1

Again we can see that after taking the first diffference we can reject the null hypothesis at 10% level.