Data Obtained: -Real Output Per Hour of All Persons (roph) -total hours worked measured as Nonfarm Business Sector: Hours of All Persons. (thw)

obtain data on Real Output Per Hour of All Persons and for total hours worked measured as Nonfarm Business Sector

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
roph <- Quandl("FRED/OPHNFB", type="zoo")
thw <- Quandl("FRED/HOANBS", type="zoo")

log and log diff. change

logroph <- log(roph)
logthw <- log(thw)
dlroph <- diff(logroph)
dlthw <- diff(logthw)
par(mfrow=c(1,2), cex=0.8)
plot(roph, xlab="", ylab="", main="Real Output Per Hour of All Persons", col="blue")
lines(thw, col="red", lty="dashed")
legend("topleft",c("output/hour", "hours worked"), bty = "n", col = c(4,2), lty = c(1,2))

plot(dlroph, xlab="", ylab="", main="Real Output Per Hour of All Persons % change", col="blue", ylim=c(-0.14,0.14))
lines(dlthw, col="red", lty="dashed")

form dataset for VAR model

logcombdata <- cbind(logroph, logthw)
dlcombdata <- cbind(dlroph, dlthw)

ERS tes

Log test

library(urca)
test <- ur.ers(logcombdata, 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

1st Diff. test

test1 <- ur.ers(dlcombdata, 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

Estimate a bivariate reduced form VAR using AIC

library(vars)
## Loading required package: MASS
## Loading required package: strucchange
## Loading required package: sandwich
## Loading required package: lmtest
varp <- VAR(dlcombdata, ic="AIC", lag.max=8, type="const")
varp
## 
## VAR Estimation Results:
## ======================= 
## 
## Estimated coefficients for equation dlroph: 
## =========================================== 
## Call:
## dlroph = dlroph.l1 + dlthw.l1 + dlroph.l2 + dlthw.l2 + dlroph.l3 + dlthw.l3 + const 
## 
##    dlroph.l1     dlthw.l1    dlroph.l2     dlthw.l2    dlroph.l3 
## -0.061099629  0.063118172  0.051485308 -0.196577779  0.005240038 
##     dlthw.l3        const 
## -0.192381110  0.006233742 
## 
## 
## Estimated coefficients for equation dlthw: 
## ========================================== 
## Call:
## dlthw = dlroph.l1 + dlthw.l1 + dlroph.l2 + dlthw.l2 + dlroph.l3 + dlthw.l3 + const 
## 
##     dlroph.l1      dlthw.l1     dlroph.l2      dlthw.l2     dlroph.l3 
##  0.1065853542  0.6259177078  0.1047852502 -0.0181069034  0.0884737276 
##      dlthw.l3         const 
## -0.0441193518 -0.0002739886
summary(varp)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: dlroph, dlthw 
## 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 = dlcombdata, type = "const", lag.max = 8, ic = "AIC")
## 
## 
## Estimation results for equation dlroph: 
## ======================================= 
## dlroph = dlroph.l1 + dlthw.l1 + dlroph.l2 + dlthw.l2 + dlroph.l3 + dlthw.l3 + const 
## 
##             Estimate Std. Error t value Pr(>|t|)    
## dlroph.l1 -0.0610996  0.0592136  -1.032  0.30307    
## dlthw.l1   0.0631182  0.0712786   0.886  0.37667    
## dlroph.l2  0.0514853  0.0559621   0.920  0.35840    
## dlthw.l2  -0.1965778  0.0840083  -2.340  0.02002 *  
## dlroph.l3  0.0052400  0.0550610   0.095  0.92425    
## dlthw.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 dlthw: 
## ====================================== 
## dlthw = dlroph.l1 + dlthw.l1 + dlroph.l2 + dlthw.l2 + dlroph.l3 + dlthw.l3 + const 
## 
##             Estimate Std. Error t value Pr(>|t|)    
## dlroph.l1  0.1065854  0.0506809   2.103   0.0364 *  
## dlthw.l1   0.6259177  0.0610073  10.260   <2e-16 ***
## dlroph.l2  0.1047853  0.0478979   2.188   0.0296 *  
## dlthw.l2  -0.0181069  0.0719026  -0.252   0.8014    
## dlroph.l3  0.0884737  0.0471267   1.877   0.0616 .  
## dlthw.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:
##           dlroph     dlthw
## dlroph 6.288e-05 7.009e-06
## dlthw  7.009e-06 4.606e-05
## 
## Correlation matrix of residuals:
##        dlroph  dlthw
## dlroph 1.0000 0.1302
## dlthw  0.1302 1.0000

Blanchard and Quah approach to obtain an SVAR model

svar1<-VAR(dlcombdata,ic="AIC", lag.max=8)
mysvar1<-BQ(svar1)
summary(mysvar1)
## 
## SVAR Estimation Results:
## ======================== 
## 
## Call:
## BQ(x = svar1)
## 
## Type: Blanchard-Quah 
## Sample size: 276 
## Log Likelihood: 1932.152 
## 
## Estimated contemporaneous impact matrix:
##           dlroph    dlthw
## dlroph  0.006523 0.004509
## dlthw  -0.003099 0.006038
## 
## Estimated identified long run impact matrix:
##           dlroph   dlthw
## dlroph  0.007195 0.00000
## dlthw  -0.002159 0.01384
## 
## Covariance matrix of reduced form residuals (*100):
##           dlroph     dlthw
## dlroph 0.0062881 0.0007009
## dlthw  0.0007009 0.0046064

Result: -From the summary table of svarv, we came to know that one positive deviation technology shcock increases output by 0.006523 and lowers total hours worked by 0.003099. -Similarly, from the summary table of svarv, we came to know that one negative deviation technology shock increases output by 0.004509 while there is increase in total hours worked by 0.006038.

-The long run effect of non-technological shock on output shock is 0.000 and single deviation will increase the total hours worked by 0.007195. -The long run effect of non-technological shock on output will be negative and decrease by 0.002159 and single deviation will increase the index by 0.01384.

Plot the cumulative IRFs based on the SVAR model

mysvar1.irfs <- irf(mysvar1, n.ahead=30)
plot(mysvar1.irfs, plot.type="multiple")

library(vars)
irfvc <- irf(mysvar1, n.ahead = 30, cumulative = TRUE)
summary(irfvc)
##            Length Class  Mode     
## irf        2      -none- list     
## Lower      2      -none- list     
## Upper      2      -none- list     
## response   2      -none- character
## impulse    2      -none- character
## ortho      1      -none- logical  
## cumulative 1      -none- logical  
## runs       1      -none- numeric  
## ci         1      -none- numeric  
## boot       1      -none- logical  
## model      1      -none- character
vth <- fevd(mysvar1, n.ahead=60)
summary(vth)
##        Length Class  Mode   
## dlroph 120    -none- numeric
## dlthw  120    -none- numeric
plot(vth)

There are complete differences in the figures. This shift says that by reversing the path of variables, the path of description forecast error variance of each variable by exogenous shocks to other variable is affected. *compare your IRFs with Figure 2 from Gali (1999) AER.: it seems that the results are quite different its more fluctuated in the Gali figure then it is in this case.