The response of hours worked to different shocks has been studied extensively since Gali (1999) AER paper. To replicate some of his results, firast obtain quarterly time series for labor productivity measured as Nonfarm Business Sector: Real Output Per Hour of All Persons FRED/OPHNFB and for total hours worked measured as Nonfarm Business Sector: Hours of All Persons FRED/HOANBS.
library(Quandl)
Quandl.api_key("KmxULt3z1Vz1neVxGioB")
library(forecast)
library(xts)
library(vars)
library(gdata)
library(tseries)
First we find first differences of the log of the real GDP. For all of our datasets we will restrict it from 1961 Q1 to 2016 Q4.
lpo<-Quandl("FRED/OPHNFB", type="zoo")
twho<-Quandl("FRED/HOANBS", type="zoo")
lp<-window(lpo,start="1947 Q1", end="2016 Q3")
twh<-window(twho,start="1947 Q1", end="2016 Q3")
llp<-log(lp)*100
ltwh<-log(twh)*100
dllp<-diff(llp,1)
dltwh<-diff(ltwh,1)
par(mfrow=c(2,2))
plot(llp,xlab="Time", ylab="Log lp")
plot(ltwh,xlab="Time", ylab="Log twh")
plot(dllp,xlab="Time", ylab="First Diff Log lp")
plot(dltwh,xlab="Time", ylab="First Diff Log twh")
We can clearly see that log lp and log twh are not stationary. However, the first differences of both variables do look somewhat stationary. Lets conduct unit root tests on both.
adf.test(llp)
##
## Augmented Dickey-Fuller Test
##
## data: llp
## Dickey-Fuller = -2.2613, Lag order = 6, p-value = 0.466
## alternative hypothesis: stationary
adf.test(ltwh)
##
## Augmented Dickey-Fuller Test
##
## data: ltwh
## Dickey-Fuller = -1.9009, Lag order = 6, p-value = 0.6178
## alternative hypothesis: stationary
adf.test(dllp)
##
## Augmented Dickey-Fuller Test
##
## data: dllp
## Dickey-Fuller = -6.8766, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary
adf.test(dltwh)
##
## Augmented Dickey-Fuller Test
##
## data: dltwh
## Dickey-Fuller = -6.0408, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary
We see that the log variables have a unit root, however we can reject that there is a unit root for the first differences of the log of lp and twh.
y<-cbind(dllp,dltwh)
y<-na.trim(y)
y<-sweep(y,2,apply(y,2,mean))
VARselect(y,lag.max=8)
## $selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 3 2 2 3
##
## $criteria
## 1 2 3 4 5 6
## AIC(n) -1.1270541 -1.1970676 -1.1992020 -1.1770166 -1.176299 -1.1531729
## HQ(n) -1.0949437 -1.1435502 -1.1242777 -1.0806853 -1.058561 -1.0140277
## SC(n) -1.0470892 -1.0637927 -1.0126172 -0.9371218 -0.883094 -0.8066582
## FPE(n) 0.3239869 0.3020813 0.3014417 0.3082121 0.308446 0.3156807
## 7 8
## AIC(n) -1.1241883 -1.1419454
## HQ(n) -0.9636361 -0.9599863
## SC(n) -0.7243636 -0.6888108
## FPE(n) 0.3249905 0.3193039
var1<-VAR(y,p=3, type="const")
summary(var1)
##
## VAR Estimation Results:
## =========================
## Endogenous variables: dllp, dltwh
## Deterministic variables: const
## Sample size: 275
## Log Likelihood: -601.6
## Roots of the characteristic polynomial:
## 0.7389 0.7389 0.432 0.432 0.4072 0.4072
## Call:
## VAR(y = y, p = 3, type = "const")
##
##
## Estimation results for equation dllp:
## =====================================
## dllp = dllp.l1 + dltwh.l1 + dllp.l2 + dltwh.l2 + dllp.l3 + dltwh.l3 + const
##
## Estimate Std. Error t value Pr(>|t|)
## dllp.l1 -0.060912 0.059339 -1.027 0.30558
## dltwh.l1 0.063061 0.071411 0.883 0.37798
## dllp.l2 0.051195 0.056108 0.912 0.36236
## dltwh.l2 -0.196365 0.084178 -2.333 0.02040 *
## dllp.l3 0.004858 0.055239 0.088 0.92999
## dltwh.l3 -0.192445 0.073262 -2.627 0.00912 **
## const -0.005959 0.047908 -0.124 0.90111
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.7944 on 268 degrees of freedom
## Multiple R-Squared: 0.1175, Adjusted R-squared: 0.0977
## F-statistic: 5.945 on 6 and 268 DF, p-value: 7.579e-06
##
##
## Estimation results for equation dltwh:
## ======================================
## dltwh = dllp.l1 + dltwh.l1 + dllp.l2 + dltwh.l2 + dllp.l3 + dltwh.l3 + const
##
## Estimate Std. Error t value Pr(>|t|)
## dllp.l1 0.106385 0.050788 2.095 0.0371 *
## dltwh.l1 0.625979 0.061119 10.242 <2e-16 ***
## dllp.l2 0.105095 0.048022 2.188 0.0295 *
## dltwh.l2 -0.018335 0.072046 -0.254 0.7993
## dllp.l3 0.088883 0.047278 1.880 0.0612 .
## dltwh.l3 -0.044051 0.062704 -0.703 0.4830
## const -0.002493 0.041003 -0.061 0.9516
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.6799 on 268 degrees of freedom
## Multiple R-Squared: 0.4387, Adjusted R-squared: 0.4261
## F-statistic: 34.91 on 6 and 268 DF, p-value: < 2.2e-16
##
##
##
## Covariance matrix of residuals:
## dllp dltwh
## dllp 0.6311 0.0704
## dltwh 0.0704 0.4623
##
## Correlation matrix of residuals:
## dllp dltwh
## dllp 1.0000 0.1303
## dltwh 0.1303 1.0000
When lags are 3, AIC is the lowest. So while we use the AIC to select 3 lags, the output does not look good.
We suppose that we want to analyze effects of two shocks - technology shocks and demand shocks on hours worked. We impose a B0 matrix with a restriction on the upper right half. We assume that twh would be a demand shock.
svar1<-VAR(y,ic="AIC", lag.max=8)
mysvar1<-BQ(svar1)
summary(mysvar1)
##
## SVAR Estimation Results:
## ========================
##
## Call:
## BQ(x = svar1)
##
## Type: Blanchard-Quah
## Sample size: 275
## Log Likelihood: -608.69
##
## Estimated contemporaneous impact matrix:
## dllp dltwh
## dllp 0.6536 0.4516
## dltwh -0.3103 0.6050
##
## Estimated identified long run impact matrix:
## dllp dltwh
## dllp 0.7202 0.000
## dltwh -0.2153 1.386
##
## Covariance matrix of reduced form residuals (*100):
## dllp dltwh
## dllp 63.11 7.04
## dltwh 7.04 46.23
Here on impact a positive one standard deviation technology shock increases lp by 0.6536% and lowers twh by 0.3103 percentage points. A negative one standard deviation non-technology shock increases lp on impact by 0.4516%, also increases twh by 0.605 percentage points
The long run impact matrix of has same effect, but stronger or weaker. The long run cumulative effect of a single positive one standard deviation technology shocks on lp is to increase it by 0.7202 percentage.
var1.irfs <- irf(var1, n.ahead=40, cumulative=TRUE)
par(mfcol=c(2,2))
plot(var1.irfs, plot.type="single")
In case of a positive one standard deviation shock to technology, at the peak lp increases by about 0.8% and twh increases by roughly 0.6 percentage points In case of a positive one standard deviation non-technology(Demand) shock, at the peak lp decreases by about 0.5% and twh increases by roughly 1.5 percentage points
The value and timing of peak points are little bit different, but overall, our results follow the results of Gali (1999).
var1.fevd <- fevd(var1, n.ahead=40)
var1.fevd[[1]][c(1,4,8,40),]
## dllp dltwh
## [1,] 1.0000000 0.00000000
## [2,] 0.9287194 0.07128056
## [3,] 0.9029579 0.09704211
## [4,] 0.9012622 0.09873779
var1.fevd[[2]][c(1,4,8,40),]
## dllp dltwh
## [1,] 0.01698596 0.9830140
## [2,] 0.10377237 0.8962276
## [3,] 0.11375913 0.8862409
## [4,] 0.11509578 0.8849042
plot(var1.fevd)
plot(var1.fevd, addbars=8)
The overall fluctuations are some what explained by external shocks, and large part of it is explained by internal shocks. This holds in both the short term and the long term. This may be because twh is determined by lp partially but not critically because employers may want to maintain twh to get more profit by using increased lp.