We obtain quarterly time series for labor productivity measured as Nonfarm Business Sector (Real Output Per Hour of All Persons) and for total hours worked measured as Nonfarm Business Sector (Hours of All Persons).
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
library("zoo")
library("xts")
library("urca")
library("vars")
## Loading required package: MASS
## Loading required package: strucchange
## Loading required package: sandwich
## Loading required package: lmtest
library("dygraphs")
library("stargazer")
##
## Please cite as:
## Hlavac, Marek (2015). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2. http://CRAN.R-project.org/package=stargazer
library("forecast")
Quandl.api_key("3fnnc4EE2uzFb1a44mAQ")
O <-Quandl("FRED/OPHNFB",collapse="quarter", type="zoo")
H <-Quandl("FRED/HOANBS",collapse="quarterly",type="zoo")
lO <- log(O)
lH <- log (H)
dlO <- diff(lO)
dlH <- diff(lH)
par(mfrow=c(1,2), cex=0.8)
plot(O, xlab="", ylab="", main="Real Output Per Hour of All Persons", col="blue")
lines(H, col="red", lty="dashed")
legend("topleft",c("output/hour", "hours worked"), bty = "n", col = c(4,2), lty = c(1,2))
plot(dlO, xlab="", ylab="", main="Real Output Per Hour of All Persons % change", col="blue", ylim=c(-0.14,0.14))
lines(dlH, col="red", lty="dashed")
lY <- cbind(lO, lH)
dlY <- cbind(dlO, dlH)
test <- ur.ers(lY, type="P-test", lag.max=12, model="trend")
summary(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: 25.9987
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
test1 <- ur.ers(dlY, type="P-test", lag.max=12, model="trend")
summary(test1)
##
## ###############################################
## # 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.7814
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
varp <- VAR(dlY, ic="AIC", lag.max=8, type="const")
varp
##
## VAR Estimation Results:
## =======================
##
## Estimated coefficients for equation dlO:
## ========================================
## Call:
## dlO = dlO.l1 + dlH.l1 + dlO.l2 + dlH.l2 + dlO.l3 + dlH.l3 + const
##
## dlO.l1 dlH.l1 dlO.l2 dlH.l2 dlO.l3
## -0.061099629 0.063118172 0.051485308 -0.196577779 0.005240038
## dlH.l3 const
## -0.192381110 0.006233742
##
##
## Estimated coefficients for equation dlH:
## ========================================
## Call:
## dlH = dlO.l1 + dlH.l1 + dlO.l2 + dlH.l2 + dlO.l3 + dlH.l3 + const
##
## dlO.l1 dlH.l1 dlO.l2 dlH.l2 dlO.l3
## 0.1065853542 0.6259177078 0.1047852502 -0.0181069034 0.0884737276
## dlH.l3 const
## -0.0441193518 -0.0002739886
summary(varp)
##
## VAR Estimation Results:
## =========================
## Endogenous variables: dlO, dlH
## Deterministic variables: const
## Sample size: 276
## Log Likelihood: 1939.243
## Roots of the characteristic polynomial:
## 0.7387 0.7387 0.4311 0.4311 0.4069 0.4069
## Call:
## VAR(y = dlY, type = "const", lag.max = 8, ic = "AIC")
##
##
## Estimation results for equation dlO:
## ====================================
## dlO = dlO.l1 + dlH.l1 + dlO.l2 + dlH.l2 + dlO.l3 + dlH.l3 + const
##
## Estimate Std. Error t value Pr(>|t|)
## dlO.l1 -0.0610996 0.0592136 -1.032 0.30307
## dlH.l1 0.0631182 0.0712786 0.886 0.37667
## dlO.l2 0.0514853 0.0559621 0.920 0.35840
## dlH.l2 -0.1965778 0.0840083 -2.340 0.02002 *
## dlO.l3 0.0052400 0.0550610 0.095 0.92425
## dlH.l3 -0.1923811 0.0731269 -2.631 0.00901 **
## const 0.0062337 0.0007462 8.353 3.56e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.00793 on 269 degrees of freedom
## Multiple R-Squared: 0.1176, Adjusted R-squared: 0.09788
## F-statistic: 5.973 on 6 and 269 DF, p-value: 7.068e-06
##
##
## Estimation results for equation dlH:
## ====================================
## dlH = dlO.l1 + dlH.l1 + dlO.l2 + dlH.l2 + dlO.l3 + dlH.l3 + const
##
## Estimate Std. Error t value Pr(>|t|)
## dlO.l1 0.1065854 0.0506809 2.103 0.0364 *
## dlH.l1 0.6259177 0.0610073 10.260 <2e-16 ***
## dlO.l2 0.1047853 0.0478979 2.188 0.0296 *
## dlH.l2 -0.0181069 0.0719026 -0.252 0.8014
## dlO.l3 0.0884737 0.0471267 1.877 0.0616 .
## dlH.l3 -0.0441194 0.0625892 -0.705 0.4815
## const -0.0002740 0.0006387 -0.429 0.6683
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.006787 on 269 degrees of freedom
## Multiple R-Squared: 0.4387, Adjusted R-squared: 0.4261
## F-statistic: 35.03 on 6 and 269 DF, p-value: < 2.2e-16
##
##
##
## Covariance matrix of residuals:
## dlO dlH
## dlO 6.288e-05 7.009e-06
## dlH 7.009e-06 4.606e-05
##
## Correlation matrix of residuals:
## dlO dlH
## dlO 1.0000 0.1302
## dlH 0.1302 1.0000
svar1<-VAR(dlY,ic="AIC", lag.max=8)
svar11<-BQ(svar1)
summary(svar11)
##
## SVAR Estimation Results:
## ========================
##
## Call:
## BQ(x = svar1)
##
## Type: Blanchard-Quah
## Sample size: 276
## Log Likelihood: 1932.152
##
## Estimated contemporaneous impact matrix:
## dlO dlH
## dlO 0.006523 0.004509
## dlH -0.003099 0.006038
##
## Estimated identified long run impact matrix:
## dlO dlH
## dlO 0.007195 0.00000
## dlH -0.002159 0.01384
##
## Covariance matrix of reduced form residuals (*100):
## dlO dlH
## dlO 0.0062881 0.0007009
## dlH 0.0007009 0.0046064
-The technology shocks will raise the real output per hour of all persons by 0.006523 and decline the nonfarm business sector by 0.003099. -The demand shocks will raise the real output per hour of all persons by 0.004509 and raise the nonfarm business sector by 0.006038. ##(d) - The technology shocks will raise the real output per hour of all persons by 0.007195 and decline the nonfarm business sector by 0.002159 - The demand shocks has no impact on the real output per hour of all persons but it will raise the nonfarm business sector by 0.01384. ## (e)
svar11.irfs <- irf(svar11, n.ahead=10)
par(mfcol=c(2,2), cex=0.6)
plot(svar11.irfs, plot.type="single")
svar11.fevd <- fevd(svar11, n.ahead=10)
svar11.fevd[[1]][c(1,3,6,10),]
## dlO dlH
## [1,] 0.6766369 0.3233631
## [2,] 0.6773475 0.3226525
## [3,] 0.6289225 0.3710775
## [4,] 0.6265654 0.3734346
par(mfcol=c(2,2), cex=0.6)
plot(svar11.fevd)
par(mfcol=c(2,2), cex=0.6)
plot(svar11.fevd, addbars=8)
##(f) - Compared to Gali (1999) the IRFs are different in this model. - For the Real Output per hour of all persons compared to GDP in Gali (1999) they have the same shape or path with different values or levels but the nonfarm business sector compared to hours in Gali (1999) they have the revere path. ## (g)
svar11.fevd <- fevd(svar11, n.ahead=10)
svar11.fevd[[1]][c(1,3,6,10),]
## dlO dlH
## [1,] 0.6766369 0.3233631
## [2,] 0.6773475 0.3226525
## [3,] 0.6289225 0.3710775
## [4,] 0.6265654 0.3734346
svar11.fevd[[2]][c(1,3,6,10),]
## dlO dlH
## [1,] 0.2085518 0.7914482
## [2,] 0.1488563 0.8511437
## [3,] 0.1542054 0.8457946
## [4,] 0.1544352 0.8455648