Econ 5316 time Series Econometrics(Spring 2017) / Homework6 Problem2 Keunyoung (Kay) Kim

1. Introduction

This Structural Vector Autoregression (SVAR) model is used to replicate the some of results of Gali (1999) AER. This model examine the response of hours worked and labor productivity to different shocks.

2.Data

To replicate some of his results, first we obtain quarterly time series for labor productivity measured as Non-farm Business Sector: Real Output Per Hour of All Persons FRED/OPHNFB and for total hours worked measured as Non farm Business Sector: Hours of All Persons FRED/HOANBS.

First, we construct the following two time series. \(y_{1,t} = 100 log OPHNFB_t\), which approximates the annualized growth rate of the U.S. real GDP, and \(y_{2,t} = 100 log HOANBS_t\), which approximates the inflation adjusted annual return of S&P 500. Each time series shows trend. After we do log transformation, trend still exist. Therefore we need to take differences for these log time series. We will conduct this process in question (a)

Methodology

We conduct SVAR model analysis to replicate some of the results of Gali (1991) AER paper.

(a)

From the graph above, we suspect variables have trend and are nonstationary. Therefore, we test the log transformed time series, the log of real output per hour \(y_{1,t} = 100 logOPHNFB_t\) and the log of hours \(y_{2,t} = 100 log HOANBS_t\) for the presence of unit root using ERS test.

## 
## ############################################### 
## # Elliot, Rothenberg and Stock Unit Root Test # 
## ############################################### 
## 
## Test of type P-test 
## detrending of series with intercept and trend 
## 
## Value of test-statistic is: 39.4292 
## 
## Critical values of P-test are:
##                 1pct 5pct 10pct
## critical values 3.96 5.62  6.89
## 
## ############################################### 
## # Elliot, Rothenberg and Stock Unit Root Test # 
## ############################################### 
## 
## Test of type P-test 
## detrending of series with intercept and trend 
## 
## Value of test-statistic is: 6.2285 
## 
## Critical values of P-test are:
##                 1pct 5pct 10pct
## critical values 3.96 5.62  6.89

The result above shows that Phillips-Perron(PP) ERS test reject the null hypothesis(No unit root). So we need to take differences to eliminate this.

## 
## ############################################### 
## # Elliot, Rothenberg and Stock Unit Root Test # 
## ############################################### 
## 
## Test of type P-test 
## detrending of series with intercept and trend 
## 
## Value of test-statistic is: 1.2933 
## 
## Critical values of P-test are:
##                 1pct 5pct 10pct
## critical values 3.96 5.62  6.89
## 
## ############################################### 
## # Elliot, Rothenberg and Stock Unit Root Test # 
## ############################################### 
## 
## Test of type P-test 
## detrending of series with intercept and trend 
## 
## Value of test-statistic is: 0.355 
## 
## Critical values of P-test are:
##                 1pct 5pct 10pct
## critical values 3.96 5.62  6.89

##     dlrLP      dlTH 
## 0.5344888 0.3650254
##         dlrLP          dlTH 
##  1.527658e-17 -4.788876e-17

The ERS unit root test to the first differences, \(y_{1,t}\) and \(y_{2,t}\) shows that both two variables did not have unit root anymore.

(b)

Now, we estimate a bivariate reduced form VAR for \(y_t\) = (\(y_{1,t}\),\(y_{2,t}\)), and use AIC information criteria to select number of lags. By the AIC Information criteria, we choose 3 as number of lags.

## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      3      2      2      3 
## 
## $criteria
##                 1          2          3          4          5          6
## AIC(n) -0.7760899 -0.8483417 -0.8587145 -0.8262272 -0.8067774 -0.7689206
## HQ(n)  -0.7329363 -0.7764191 -0.7580229 -0.6967665 -0.6485477 -0.5819219
## SC(n)  -0.6696580 -0.6709552 -0.6103734 -0.5069315 -0.4165271 -0.3077157
## FPE(n)  0.4602048  0.4281366  0.4237397  0.4377706  0.4464301  0.4637467
##                 7          8
## AIC(n) -0.7377502 -0.7504031
## HQ(n)  -0.5219825 -0.5058663
## SC(n)  -0.2055908 -0.1472890
## FPE(n)  0.4785592  0.4727097

Based on the lag 3, we estimate reduced form VAR(3) as followings.

## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: dlrLP, dlTH 
## Deterministic variables: const 
## Sample size: 185 
## Log Likelihood: -434.681 
## Roots of the characteristic polynomial:
## 0.7566 0.7566 0.4749 0.4749 0.4031 0.4031
## Call:
## VAR(y = y, lag.max = 8, ic = "AIC")
## 
## 
## Estimation results for equation dlrLP: 
## ====================================== 
## dlrLP = dlrLP.l1 + dlTH.l1 + dlrLP.l2 + dlTH.l2 + dlrLP.l3 + dlTH.l3 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)   
## dlrLP.l1 -0.058835   0.075067  -0.784  0.43421   
## dlTH.l1   0.046104   0.087242   0.528  0.59784   
## dlrLP.l2  0.065505   0.073406   0.892  0.37340   
## dlTH.l2  -0.147454   0.101712  -1.450  0.14890   
## dlrLP.l3 -0.008781   0.073486  -0.119  0.90502   
## dlTH.l3  -0.236004   0.088254  -2.674  0.00819 **
## const     0.003545   0.063624   0.056  0.95563   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.8653 on 178 degrees of freedom
## Multiple R-Squared: 0.1214,  Adjusted R-squared: 0.09174 
## F-statistic: 4.097 on 6 and 178 DF,  p-value: 0.0007069 
## 
## 
## Estimation results for equation dlTH: 
## ===================================== 
## dlTH = dlrLP.l1 + dlTH.l1 + dlrLP.l2 + dlTH.l2 + dlrLP.l3 + dlTH.l3 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## dlrLP.l1  0.088445   0.065080   1.359   0.1759    
## dlTH.l1   0.617909   0.075635   8.170 5.55e-14 ***
## dlrLP.l2  0.160813   0.063640   2.527   0.0124 *  
## dlTH.l2  -0.094627   0.088181  -1.073   0.2847    
## dlrLP.l3  0.087099   0.063710   1.367   0.1733    
## dlTH.l3  -0.048362   0.076513  -0.632   0.5282    
## const    -0.003621   0.055159  -0.066   0.9477    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.7502 on 178 degrees of freedom
## Multiple R-Squared: 0.422,   Adjusted R-squared: 0.4025 
## F-statistic: 21.66 on 6 and 178 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##        dlrLP   dlTH
## dlrLP 0.7487 0.1205
## dlTH  0.1205 0.5628
## 
## Correlation matrix of residuals:
##        dlrLP   dlTH
## dlrLP 1.0000 0.1856
## dlTH  0.1856 1.0000

(c)

In this analysis, we suppose that we want to analyze effects of two shocks - technology shocks and non-technology shocks on hours worked and labor productivity. So, we use Blanchard and Quah approach to obtain an SVAR model where we impose the condition that demand shocks do not affect real output per hour (i.e. labor productivity) \(y_{1,t}\) in the long run.
To use Blanchard and Quah technique, at least one variable must be nonstationary, I(0) variables do not have a permanent component.

(d)

The result below present the contemporaneous impact and the long run impact matrices for the SVAR.

## 
## SVAR Estimation Results:
## ======================== 
## 
## Call:
## BQ(x = myVAR)
## 
## Type: Blanchard-Quah 
## Sample size: 185 
## Log Likelihood: -441.816 
## 
## Estimated contemporaneous impact matrix:
##         dlrLP   dlTH
## dlrLP  0.7386 0.4508
## dlTH  -0.2653 0.7017
## 
## Estimated identified long run impact matrix:
##          dlrLP  dlTH
## dlrLP  0.74615 0.000
## dlTH  -0.02719 1.336
## 
## Covariance matrix of reduced form residuals (*100):
##       dlrLP  dlTH
## dlrLP 74.87 12.05
## dlTH  12.05 56.28

[Contemporaneous impact]

A positive one standard deviation technology shock increases labor productivity by 0.738% and lowers hours worked by 0.265 % points. A one standard deviation non-technology shock increases labor productivity by 0.450% and increases hours worked by 0.701%.

[Cumulative long run impact]

The long run cumulative effect of any non-technology shock on labor productivity is 0. The long run cumulative effect of a single positive one standard deviation technology shocks on labor productivity is to increase it by 0.746%

(e)

We plot the cumulative IRFs based on the SVAR model from (c) and analyze the effects of the two types of shocks on labor productivity and hours worked.

The plot above displays the estimated IRFs based on SVAR model with labor productivity and hours worked. In response to a positive technology shock of one-standard deviation, labor productivity shows an immediate increase of about 0.7%, eventually stabilizing at a level somewhat higher. Hours worked shows an immediate decrease of about 0.25% and the effect on hours vanished at quarter 5.

The right side of plot displays the estimated responses to a non-technology shock. While the effect on labor productivity disappears over time , the shock has a sizable permanent impact on hours, above 1.2%.

## 
## SVAR Estimation Results:
## ======================== 
## 
## Call:
## BQ(x = myVAR)
## 
## Type: Blanchard-Quah 
## Sample size: 185 
## Log Likelihood: -441.816 
## 
## Estimated contemporaneous impact matrix:
##         dlrLP   dlTH
## dlrLP  0.7386 0.4508
## dlTH  -0.2653 0.7017
## 
## Estimated identified long run impact matrix:
##          dlrLP  dlTH
## dlrLP  0.74615 0.000
## dlTH  -0.02719 1.336
## 
## Covariance matrix of reduced form residuals (*100):
##       dlrLP  dlTH
## dlrLP 74.87 12.05
## dlTH  12.05 56.28
##      dlrLP       dlTH 
##  0.7385512 -0.2652505
##     dlrLP      dlTH 
## 0.4508355 0.7017085
##       dlrLP        dlTH 
##  0.74614915 -0.02719191
##         dlrLP          dlTH 
## -5.100171e-13  1.336385e+00

(f)

We compare our IRFs above with Figure 2 from Gali (1999) AER(p.261) The magnitude of response are slightly different but the pattern and the direction of response are almost identical.

(g)

Finally, we construct the FEVD for the SVAR. In decomposition for \(y_1\), labor productivity, at 1 quarter horizon fluctuations are due to \(\varepsilon_{y1}\), about 70% and at 40 quarters horizon above 60% are due to \(\varepsilon_{y1}\) and less than 40% are due to \(\varepsilon_{y2}\), hours worked. In decomposition for \(y_2\), hours worked, at 1 quarter horizon fluctuations are due to \(\varepsilon_{y2}\), about 90% and at 40 quarters horizon about 90% are due to \(\varepsilon_{y2}\) and less than 20% are due to \(\varepsilon_{y1}\), labor productivity.

4.Conclusions

Our SVAR(3) model shows the response of labor productivity and hours worked to technology shock and non technology shock. The response of hours worked to the technology shock vanishes 5 quarters after shock hit the economy but the response of labor productivity stay high, above 0.6%. The response of labor productivity to the non-technology shock vanishes 10 quarters after shock, but the response of hours worked stay high around 1.3%. Overall this results are consistent with those of Gali (1999)

VAR(2) model of GDP growth rate and inflation adjusted annual return show that past annual return has information to predict today’s GDP growth and predict the GDP growth rate in 2017 1Q as 2.99% that is relatively higher than the forecast of Federal Banks of NY and Atlanta.


* R code for analysis

library(Quandl)
Quandl.api_key("XzdSwkDsE98Mxj3ixQzG")

# obtain data on real OUTPUT and Total Hours
rLP <- Quandl("FRED/OPHNFB", type="zoo")
TH <- Quandl("FRED/HOANBS", collapse="quarterly", type="zoo")

# construct approximate quarter-over-quarter OUTPUT growth rates
lrLP <- log(rLP)*100
lTH <- log(TH)*100

par(mfrow=c(2,2), cex=.6, mar=c(4,4,2,1))
plot(rLP, main="Real Output Per Hour: Labor Productivity")
plot(TH, main= "Total Hours")
plot(lrLP, main="(log) Labor Productivity")
plot(lTH, main= "(log) Total Hours")


#Q.a : ERS unit root test

library(urca)
lrLP.urers1 <- ur.ers(lrLP, type="P-test", model="trend")
summary(lrLP.urers1)
lTH.urers2 <- ur.ers(lTH, type="P-test", model="trend")
summary(lTH.urers2)

# construct approximate quarter-over-quarter OUTPUT growth rates
dlrLP <- diff(log(rLP))*100
dlTH <- diff(log(TH))*100


library(urca)
dlrLP.urers1 <- ur.ers(dlrLP, type="P-test", model="trend")
summary(dlrLP.urers1)
dlTH.urers2 <- ur.ers(dlTH, type="P-test", model="trend")
summary(dlTH.urers2)


# combine the two time series into a single data matrix
y <- cbind(dlrLP, dlTH)

# Blanchard and Quah use 1950Q2 to 1987Q4 as sample, to replicate their study we thus set
# Gali (1999) : bivariate model ( 23 ) is estimated using U.S. quarterly data covering the period 1948:1-1994:4
y <- window(y, start="1948 Q1", end="1994 Q4")
plot(y)

# demean the data
apply(y, 2, mean)
y <- sweep(y, 2, apply(y, 2, mean))
apply(y, 2, mean)
plot(y)



# Q.b  : AIC

library(vars)
VARselect(y, lag.max=8)

# first estimate reduced form VAR
myVAR <- VAR(y, ic="AIC", lag.max=8)
summary(myVAR)

# Q.c and Q.d 

# Blanchard-Quah long run restriction - row 1 column 2 element of the cumulative effect matrix is going to be restricted to 0
mySVAR <- BQ(myVAR)
summary(mySVAR)


# Q.e

# standard non-cumulative IRFs
myIRF <- irf(mySVAR, n.ahead=12, ci=.9)

# change signs for the non-technology shock IRFs so that they show effects of a positive shock, not a negative one
myIRF$irf[[2]] <- myIRF$irf[[2]]
myIRF$Lower[[2]] <- myIRF$Lower[[2]]
myIRF$Upper[[2]] <- myIRF$Upper[[2]]

# cumulative IRFs
myIRF.c <- irf(mySVAR, n.ahead=12, ci=.9, cumulative=TRUE)

# change the signs for the non-technology shock IRFs so that they show effects of a positive shock, not a negative one
myIRF.c$irf[[2]] <- myIRF.c$irf[[2]]
myIRF.c$Lower[[2]] <- myIRF.c$Lower[[2]]
myIRF.c$Upper[[2]] <- myIRF.c$Upper[[2]]

myIRF.c$irf[[1]] <- myIRF.c$irf[[1]]
myIRF.c$Lower[[1]] <- myIRF.c$Lower[[1]]
myIRF.c$Upper[[1]] <- myIRF.c$Upper[[1]]



# we want to get a graph with cumulative IRF for dlrLP but a standard non-cumulative IRF for TH
par(mfrow=c(2,2), cex=.6, mar=c(4,4,2,1))

# This source file should be in current working file : getwd()
source("plotIRF.r")
plotIRF(myIRF.c, lwd=2.5, ask=FALSE, vnames="dlrLP", vlabels="Labor Productiviey", slabels=c("technology shock","non-technology shock"))
plotIRF(myIRF.c, lwd=2.5, ask=FALSE, vnames="dlTH", vlabels="Total Hours", slabels=c("technology shock","non-technology shock"))


# note that by construction the contemporaneous impact matrix is identical to the elements of the IRFs for period 0 (impact period)
summary(mySVAR)
myIRF.c$irf[[1]][1,]
myIRF.c$irf[[2]][1,]
# and that the long run impact matrix from is essentially the same as the elements of the IRFs if the horizon is large enough, e.g. 100 periods
myIRF.c <- irf(mySVAR, n.ahead=100, ci=.9, cumulative=TRUE, boot=FALSE)
myIRF.c$irf[[1]][101,]
myIRF.c$irf[[2]][101,]


#Q.g
# FEVD
plot( fevd(mySVAR, n.ahead=40) ,addbars=10 )