Today

Time Series Data

Setup

Example: US Quarterly GDP Growth, 1947q2-2018q3 (Code)

#Library to download data
library(pdfetch)
#Download Seasonally Adjusted Quarterly Real US GDP Growth
#FRED Series number "A191RL1Q225SBEA" 
gdpgrowth<-pdfetch_FRED("A191RL1Q225SBEA")
#Format as Quarterly time series starting 1947q2
gdpg<-ts(gdpgrowth,start=c(1947,2),frequency=4)
plot(gdpg, main="Real US GDP Growth, 
  1947q2-2018q3",xlab="Quarter",ylab="Percent Change")

Example: US Quarterly GDP Growth, 1947q2-2018q3

Regression

Regression Assumptions

Implications

Lags, Differences, Etc.

Distributed Lags

Dependent Data

Autoregression

Moving Averages

Plot: AR, MA, and ARMA series (Code 1)

tl<-80 #Length of simulated series
#Initialize random number generator for reproducibility
set.seed(55) 
e1<-ts(rnorm(tl)) #standard normal shocks
theta<-0.7 #MA parameter
rho<-0.7 #AR parameter
yAR<-numeric(tl-1)
yMA<-numeric(tl)
yARMA<-numeric(tl)
yMA<-e1+theta*lag(e1)
for(s in 1:(tl-1)){
  #AR(1) initialized at 0
  yAR[s+1]<-rho*yAR[s]+e1[s]
  #ARMA(1,1) using same shocks
  yARMA[s+1]<-yARMA[s]+yMA[s]
}

Plot: AR, MA, and ARMA series (Code 2)

#Represent as same length time series
yAR<-ts(yAR[1:tl-1])
yARMA<-ts(yARMA[1:tl-1])
#Collect as Matrix
simulatedseries<-cbind(yAR,yMA,yARMA)
#Plot
ts.plot(simulatedseries,gpars=list(main=
  "AR(1),MA(1), and ARMA(1,1) Simulated data", 
  ylab="Series value",lty=c(1,2,3),
  col=c("red","black","blue")))
legend("topleft",bty="n",
  expression("AR(1): rho=0.7","MA(1): 
  theta=0.7","ARMA(1,1): rho=0.7, theta=0.7"),
  lty=1:3, col=c("red","black","blue"))

Plot: AR, MA, and ARMA series

Stationarity and Weak Dependence

Stationarity and Weak Dependence: Formal conditions

Limit theorems under weak dependence

Regression with dependent data

Time Series Regression: Assumptions

Time Series Regression: Results

Example: Monetary Policy Reaction Function (“Taylor Rule”) (Code 1)

#Download quarterly series from FRED
gdppot<-pdfetch_FRED("GDPPOT") # Potential GDP
fefr<-read.csv("Data/FEDFUNDS.csv") # Downloaded quarterly 
  #fed funds rate to file in directory
  # need this file to compile
ffr<-ts(fefr[,2],start=c(1954,3),frequency=4)
Lffr<-lag(ffr)
gdpdef<-pdfetch_FRED("GDPDEF") # GDP Price Deflator
gdpc1<-pdfetch_FRED("GDPC1") # Real GDP

Example: Monetary Policy Reaction Function (“Taylor Rule”) (Code 2)

gap<-ts(100*(gdpc1-gdppot)/gdppot,start=c(1949,2),
    frequency=4) #Output Gap
inf<-ts(100*(gdpdef-lag(gdpdef,4))/lag(gdpdef,4),
    start=c(1947,2),frequency=4) #Inflation
    # Change from 1 year ago
#Library for time series regression
library(dynlm)
taylorrule<-dynlm(ffr~L(ffr)+inf+gap)

Example: Monetary Policy Reaction Function (“Taylor Rule”)

taylorrule<-dynlm(ffr~L(ffr)+inf+gap)

Estimates (Code)

#Display results in table
library(stargazer)
stargazer(taylorrule,header=FALSE, 
  omit.stat=c("ser","adj.rsq"),type="html",
  title="Fed Funds Rate Policy Rule")

Estimates

Fed Funds Rate Policy Rule
Dependent variable:
ffr
L(ffr) 0.926***
(0.023)
inf 0.080**
(0.036)
gap 0.096***
(0.023)
Constant 0.172*
(0.100)
Observations 248
R2 0.945
F Statistic 1,401.172*** (df = 3; 244)
Note: p<0.1; p<0.05; p<0.01

Conclusion

Next Time