Question1: From Category A, I will choose Real Gross Private Domestic Investment

From Category B, I will choose NYSE Composite Index

From Category C, I will choose 10-year Treasury Constant Maturity Rate

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
#Real Gross Private Investment
pi<- Quandl("FRED/GPDIC1", type="ts")

str(pi)
##  Time-Series [1:276] from 1947 to 2016: 223 206 200 238 263 ...
zooreg(1:276, start=c(1947,1), frequency=4)
## 1947(1) 1947(2) 1947(3) 1947(4) 1948(1) 1948(2) 1948(3) 1948(4) 1949(1) 
##       1       2       3       4       5       6       7       8       9 
## 1949(2) 1949(3) 1949(4) 1950(1) 1950(2) 1950(3) 1950(4) 1951(1) 1951(2) 
##      10      11      12      13      14      15      16      17      18 
## 1951(3) 1951(4) 1952(1) 1952(2) 1952(3) 1952(4) 1953(1) 1953(2) 1953(3) 
##      19      20      21      22      23      24      25      26      27 
## 1953(4) 1954(1) 1954(2) 1954(3) 1954(4) 1955(1) 1955(2) 1955(3) 1955(4) 
##      28      29      30      31      32      33      34      35      36 
## 1956(1) 1956(2) 1956(3) 1956(4) 1957(1) 1957(2) 1957(3) 1957(4) 1958(1) 
##      37      38      39      40      41      42      43      44      45 
## 1958(2) 1958(3) 1958(4) 1959(1) 1959(2) 1959(3) 1959(4) 1960(1) 1960(2) 
##      46      47      48      49      50      51      52      53      54 
## 1960(3) 1960(4) 1961(1) 1961(2) 1961(3) 1961(4) 1962(1) 1962(2) 1962(3) 
##      55      56      57      58      59      60      61      62      63 
## 1962(4) 1963(1) 1963(2) 1963(3) 1963(4) 1964(1) 1964(2) 1964(3) 1964(4) 
##      64      65      66      67      68      69      70      71      72 
## 1965(1) 1965(2) 1965(3) 1965(4) 1966(1) 1966(2) 1966(3) 1966(4) 1967(1) 
##      73      74      75      76      77      78      79      80      81 
## 1967(2) 1967(3) 1967(4) 1968(1) 1968(2) 1968(3) 1968(4) 1969(1) 1969(2) 
##      82      83      84      85      86      87      88      89      90 
## 1969(3) 1969(4) 1970(1) 1970(2) 1970(3) 1970(4) 1971(1) 1971(2) 1971(3) 
##      91      92      93      94      95      96      97      98      99 
## 1971(4) 1972(1) 1972(2) 1972(3) 1972(4) 1973(1) 1973(2) 1973(3) 1973(4) 
##     100     101     102     103     104     105     106     107     108 
## 1974(1) 1974(2) 1974(3) 1974(4) 1975(1) 1975(2) 1975(3) 1975(4) 1976(1) 
##     109     110     111     112     113     114     115     116     117 
## 1976(2) 1976(3) 1976(4) 1977(1) 1977(2) 1977(3) 1977(4) 1978(1) 1978(2) 
##     118     119     120     121     122     123     124     125     126 
## 1978(3) 1978(4) 1979(1) 1979(2) 1979(3) 1979(4) 1980(1) 1980(2) 1980(3) 
##     127     128     129     130     131     132     133     134     135 
## 1980(4) 1981(1) 1981(2) 1981(3) 1981(4) 1982(1) 1982(2) 1982(3) 1982(4) 
##     136     137     138     139     140     141     142     143     144 
## 1983(1) 1983(2) 1983(3) 1983(4) 1984(1) 1984(2) 1984(3) 1984(4) 1985(1) 
##     145     146     147     148     149     150     151     152     153 
## 1985(2) 1985(3) 1985(4) 1986(1) 1986(2) 1986(3) 1986(4) 1987(1) 1987(2) 
##     154     155     156     157     158     159     160     161     162 
## 1987(3) 1987(4) 1988(1) 1988(2) 1988(3) 1988(4) 1989(1) 1989(2) 1989(3) 
##     163     164     165     166     167     168     169     170     171 
## 1989(4) 1990(1) 1990(2) 1990(3) 1990(4) 1991(1) 1991(2) 1991(3) 1991(4) 
##     172     173     174     175     176     177     178     179     180 
## 1992(1) 1992(2) 1992(3) 1992(4) 1993(1) 1993(2) 1993(3) 1993(4) 1994(1) 
##     181     182     183     184     185     186     187     188     189 
## 1994(2) 1994(3) 1994(4) 1995(1) 1995(2) 1995(3) 1995(4) 1996(1) 1996(2) 
##     190     191     192     193     194     195     196     197     198 
## 1996(3) 1996(4) 1997(1) 1997(2) 1997(3) 1997(4) 1998(1) 1998(2) 1998(3) 
##     199     200     201     202     203     204     205     206     207 
## 1998(4) 1999(1) 1999(2) 1999(3) 1999(4) 2000(1) 2000(2) 2000(3) 2000(4) 
##     208     209     210     211     212     213     214     215     216 
## 2001(1) 2001(2) 2001(3) 2001(4) 2002(1) 2002(2) 2002(3) 2002(4) 2003(1) 
##     217     218     219     220     221     222     223     224     225 
## 2003(2) 2003(3) 2003(4) 2004(1) 2004(2) 2004(3) 2004(4) 2005(1) 2005(2) 
##     226     227     228     229     230     231     232     233     234 
## 2005(3) 2005(4) 2006(1) 2006(2) 2006(3) 2006(4) 2007(1) 2007(2) 2007(3) 
##     235     236     237     238     239     240     241     242     243 
## 2007(4) 2008(1) 2008(2) 2008(3) 2008(4) 2009(1) 2009(2) 2009(3) 2009(4) 
##     244     245     246     247     248     249     250     251     252 
## 2010(1) 2010(2) 2010(3) 2010(4) 2011(1) 2011(2) 2011(3) 2011(4) 2012(1) 
##     253     254     255     256     257     258     259     260     261 
## 2012(2) 2012(3) 2012(4) 2013(1) 2013(2) 2013(3) 2013(4) 2014(1) 2014(2) 
##     262     263     264     265     266     267     268     269     270 
## 2014(3) 2014(4) 2015(1) 2015(2) 2015(3) 2015(4) 
##     271     272     273     274     275     276

image:

lnpi <- log(pi)

par(mfrow=c(2,2))

plot(pi, xlab = "period", ylab = "Private Investment", main= "Real Gross Private Investment")

plot(lnpi, xlab = "Period", ylab = "log(Investment)")

plot(diff(pi))
plot(diff(lnpi))

library(tseries)
adf.test(pi)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  pi
## Dickey-Fuller = -2.7222, Lag order = 6, p-value = 0.2718
## alternative hypothesis: stationary
adf.test(lnpi) 
## 
##  Augmented Dickey-Fuller Test
## 
## data:  lnpi
## Dickey-Fuller = -2.6039, Lag order = 6, p-value = 0.3216
## alternative hypothesis: stationary
adf.test(diff(pi))
## Warning in adf.test(diff(pi)): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  diff(pi)
## Dickey-Fuller = -5.3713, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary
adf.test(diff(lnpi))
## Warning in adf.test(diff(lnpi)): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  diff(lnpi)
## Dickey-Fuller = -7.3938, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary
kpss.test(pi,null  ="Trend")
## Warning in kpss.test(pi, null = "Trend"): p-value smaller than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  pi
## KPSS Trend = 1.0029, Truncation lag parameter = 3, p-value = 0.01
kpss.test(lnpi, null = "Trend")
## Warning in kpss.test(lnpi, null = "Trend"): p-value smaller than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  lnpi
## KPSS Trend = 0.44857, Truncation lag parameter = 3, p-value = 0.01
kpss.test(diff(pi), null = "Level")
## Warning in kpss.test(diff(pi), null = "Level"): p-value greater than
## printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  diff(pi)
## KPSS Level = 0.17082, Truncation lag parameter = 3, p-value = 0.1
kpss.test(diff(lnpi), null="Level")
## Warning in kpss.test(diff(lnpi), null = "Level"): p-value greater than
## printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  diff(lnpi)
## KPSS Level = 0.03644, Truncation lag parameter = 3, p-value = 0.1

Category B: NYSE

library("Quandl")
ny <- Quandl("YAHOO/INDEX_NY")
tail(ny)
##            Date    Open    High     Low   Close Volume Adjusted Close
## 3044 2004-01-20 5708.74 5725.34 5693.47 5701.47   1700        5701.47
## 3045 2004-01-16 5683.17 5708.89 5680.70 5707.60      0        5707.60
## 3046 2004-01-15 5667.44 5704.04 5643.79 5681.52      0        5681.52
## 3047 2004-01-14 5622.37 5667.89 5622.37 5667.55      0        5667.55
## 3048 2004-01-13 5653.33 5661.72 5593.27 5622.37      0        5622.37
## 3049 2004-01-12 5630.43 5655.28 5627.70 5653.31   1700        5653.31
ny <- rev(ny[,7])
tny<-ts(ny)
head(ny)
## [1] 5653.31 5622.37 5667.55 5681.52 5707.60 5701.47
str(tny)
##  Time-Series [1:3049] from 1 to 3049: 5653 5622 5668 5682 5708 ...
par(mfrow= c(1,2))
plot(tny, xlab = "Period", ylab ="Closing Price", main= "NYSE Composite Index")
plot(diff(tny))

adf.test(tny)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  tny
## Dickey-Fuller = -1.4514, Lag order = 14, p-value = 0.8106
## alternative hypothesis: stationary
adf.test(diff(tny))
## Warning in adf.test(diff(tny)): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  diff(tny)
## Dickey-Fuller = -15.6, Lag order = 14, p-value = 0.01
## alternative hypothesis: stationary
kpss.test(tny, null= "Trend")
## Warning in kpss.test(tny, null = "Trend"): p-value smaller than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  tny
## KPSS Trend = 3.8366, Truncation lag parameter = 12, p-value = 0.01
kpss.test(diff(tny), null="Level")
## Warning in kpss.test(diff(tny), null = "Level"): p-value greater than
## printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  diff(tny)
## KPSS Level = 0.12761, Truncation lag parameter = 12, p-value = 0.1

Category C: 10-Year Treasury Constant Maturity

tm <- Quandl("FRED/DGS10", type="zoo")
head(tm)
## 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
par(mfrow=c(1,2))
plot(tm,xlab=" Period", ylab = "Treasury Rate")
plot(diff(tm))

adf.test(tm)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  tm
## Dickey-Fuller = -2.0945, Lag order = 23, p-value = 0.5384
## alternative hypothesis: stationary
kpss.test(tm, null="Trend")
## Warning in kpss.test(tm, null = "Trend"): p-value smaller than printed p-
## value
## 
##  KPSS Test for Trend Stationarity
## 
## data:  tm
## KPSS Trend = 9.2783, Truncation lag parameter = 26, p-value = 0.01
kpss.test(diff(tm), null="Level")
## Warning in kpss.test(diff(tm), null = "Level"): p-value greater than
## printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  diff(tm)
## KPSS Level = 0.23875, Truncation lag parameter = 26, p-value = 0.1