INTRODUCTION

Obtain quarterly time series for U.S. real GDP FRED/GDPC96, GDP deflator FRED/GDPDEF and quarterly closing value of S&P 500 Index YAHOO/INDEX_GSPC/CLOSE. Use them to construct the following two time series: y1,t which approximates the annualized growth rate of the U.S. real GDP, and y2,t which approximates the inflation adjusted annual return of S&P 500.

Import data

library(Quandl)
Quandl.api_key("KmxULt3z1Vz1neVxGioB")
library(forecast)
library(xts)
library(vars)
library(gdata)

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.

gdp<-Quandl("FRED/GDPC96", type="zoo")
gdp<-window(gdp,start="1961 Q1", end="2016 Q4")
lgdp<-log(gdp)
ldgdp<-diff(lgdp,1)*400
par(mfrow=c(1,2))
plot(gdp,xlab="Time", ylab="GDP")
plot(ldgdp,xlab="Time", ylab="First Diff Log GDP")

Then we find the first differences of the log of the GDP Deflator

gdpd<-Quandl("FRED/GDPDEF", type="zoo")
gdpd<-window(gdpd,start="1961 Q1", end="2016 Q4")
lgdpd<-log(gdpd)
ldgdpd<-diff(lgdpd,1)*400
par(mfrow=c(1,2))
plot(gdpd,xlab="Time", ylab="GDP Deflator")
plot(ldgdpd,xlab="Time", ylab="First Diff Log GDPDEF")

In order to find the real log return of the S&P 500, we must subtract the log differences of the S&P500 with the log differences of the GDP Deflator and multiply by 400.

snp<-Quandl("YAHOO/INDEX_GSPC", collapse="quarterly", type="zoo")
snp<-window(snp,start="1961 Q1", end="2016 Q4")
lsnp<-log(snp$Close)
ldsnp<-diff(lsnp,1)*400
par(mfrow=c(1,2))
plot(lsnp,xlab="Time", ylab="Log SNP 500")
plot(ldsnp,xlab="Time", ylab="First Diff Log SNP")

Now that we have all the components, lets merge them together and take out missing values.

y<-cbind(ldsnp,ldgdpd,ldgdp)
y<-na.trim(y)

We should subtract them to get \(y_{2,t}\).

y2<-y$ldsnp-y$ldgdpd
y1<-y$ldgdp
yy<-cbind(y1,y2)
plot(yy)

# (a) Estimate a bivariate reduced form VAR Now we look for \(y_t=(y_{1,t},y_{2,t})'\) for the period 1961Q1-2016Q4. Then we estimate a reduced form VAR.

yy<-window(yy,start="1961 Q1", end="2016 Q4")
VARselect(yy, lag.max=10, type="const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      2      2      2      2 
## 
## $criteria
##                  1           2           3           4           5
## AIC(n)    9.194244    9.111315    9.133983    9.152568    9.170315
## HQ(n)     9.232509    9.175090    9.223268    9.267363    9.310620
## SC(n)     9.288928    9.269122    9.354913    9.436621    9.517491
## FPE(n) 9840.356985 9057.354027 9265.288983 9439.597216 9609.419568
##                  6           7            8            9           10
## AIC(n)    9.195459    9.205527     9.230736     9.240712     9.254377
## HQ(n)     9.361275    9.396853     9.447572     9.483057     9.522232
## SC(n)     9.605758    9.678949     9.767281     9.840379     9.917167
## FPE(n) 9855.284763 9956.635676 10213.001172 10318.178641 10463.645055

The model with the lowest AIC has the best fit. It looks like that would be (2)

Lets check what the correlation matrix looks like the following.

The residuals have a correlation of 16.37%. It is relatively low.

By using this correlation, we can assume that those are affected by exogenous shocks rahter than endogenous shocks.

var2<-VAR(yy,p=2,type="const")
summary(var2)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: y1, y2 
## Deterministic variables: const 
## Sample size: 221 
## Log Likelihood: -1623.27 
## Roots of the characteristic polynomial:
## 0.3919 0.2962 0.2481 0.2481
## Call:
## VAR(y = yy, p = 2, type = "const")
## 
## 
## Estimation results for equation y1: 
## =================================== 
## y1 = y1.l1 + y2.l1 + y1.l2 + y2.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)    
## y1.l1 0.212901   0.065005   3.275 0.001230 ** 
## y2.l1 0.016263   0.006044   2.691 0.007683 ** 
## y1.l2 0.170781   0.063333   2.697 0.007558 ** 
## y2.l2 0.023737   0.006146   3.862 0.000149 ***
## const 1.716223   0.293624   5.845 1.85e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 2.89 on 216 degrees of freedom
## Multiple R-Squared: 0.2345,  Adjusted R-squared: 0.2204 
## F-statistic: 16.55 on 4 and 216 DF,  p-value: 7.663e-12 
## 
## 
## Estimation results for equation y2: 
## =================================== 
## y2 = y1.l1 + y2.l1 + y1.l2 + y2.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)
## y1.l1  0.58495    0.73197   0.799    0.425
## y2.l1  0.10265    0.06805   1.508    0.133
## y1.l2 -0.87449    0.71314  -1.226    0.221
## y2.l2 -0.07971    0.06921  -1.152    0.251
## const  3.82831    3.30627   1.158    0.248
## 
## 
## Residual standard error: 32.54 on 216 degrees of freedom
## Multiple R-Squared: 0.02385, Adjusted R-squared: 0.005775 
## F-statistic: 1.319 on 4 and 216 DF,  p-value: 0.2637 
## 
## 
## 
## Covariance matrix of residuals:
##        y1      y2
## y1  8.351   15.39
## y2 15.392 1058.89
## 
## Correlation matrix of residuals:
##        y1     y2
## y1 1.0000 0.1637
## y2 0.1637 1.0000

(b) Granger Causality Tests

causality(var2,cause="y1")
## $Granger
## 
##  Granger causality H0: y1 do not Granger-cause y2
## 
## data:  VAR object var2
## F-Test = 0.83694, df1 = 2, df2 = 432, p-value = 0.4337
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: y1 and y2
## 
## data:  VAR object var2
## Chi-squared = 5.766, df = 1, p-value = 0.01634
causality(var2,cause="y2")
## $Granger
## 
##  Granger causality H0: y2 do not Granger-cause y1
## 
## data:  VAR object var2
## F-Test = 11.919, df1 = 2, df2 = 432, p-value = 9.151e-06
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: y2 and y1
## 
## data:  VAR object var2
## Chi-squared = 5.766, df = 1, p-value = 0.01634

So we see that there is no Granger Causality from \(Y_1\) to \(Y_2\), but we do see Granger Causality from \(Y_2\) to \(Y_1\). This means that we can use the S&P to predict real GDP, but not the other way around.

Discuss the economic intution behind your results of Granger causality test.

We can interpret the results that past values of inflation adjusted S&P500 returns have more effect than past real GDP because the GDP is calcualted about a month after each quarter ends while the S&P is continually changed by investors with real time information.

(c) Estimate a Restricted VAR Model

In the first model, we remove lags based on Granger Causality tests. We set our B0 matrix

B0 <- diag(2)
diag(B0) <- NA
B0[1, 2] <- NA
B0
##      [,1] [,2]
## [1,]   NA   NA
## [2,]    0   NA
svar2 <- SVAR(var2, estmethod="direct", Amat=B0, hessian=TRUE, method="BFGS")
summary(svar2)
## 
## SVAR Estimation Results:
## ======================== 
## 
## Call:
## SVAR(x = var2, estmethod = "direct", Amat = B0, hessian = TRUE, 
##     method = "BFGS")
## 
## Type: A-model 
## Sample size: 221 
## Log Likelihood: -1628.318 
## Method: direct 
## Number of iterations: 62 
## Convergence code: 0 
## 
## Estimated A matrix:
##        y1        y2
## y1 0.3508 -0.005098
## y2 0.0000  0.030732
## 
## Estimated standard errors for A matrix:
##         y1       y2
## y1 0.01668 0.002081
## y2 0.00000 0.001461
## 
## Estimated B matrix:
##    y1 y2
## y1  1  0
## y2  0  1
## 
## Covariance matrix of reduced form residuals (*100):
##        y1     y2
## y1  835.1   1539
## y2 1538.9 105882

This is the restricted VAR model based on removing the lag from \(Y_1\) to \(Y_2\) in the Granger Causality test.

Lets try restricting our variables by restricting the B1 matrix. Even though our dimensions is 2 rows and 4 columns, because of the intercept, we have to make it 5 columns.

mat.r<- matrix(1,nrow=2, ncol=5)
mat.r[2,c(1,3)]<-0
mat.r
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    1    1    1    1
## [2,]    0    1    0    1    1
var2.r <- restrict(var2, method="manual", resmat=mat.r)
summary(var2.r)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: y1, y2 
## Deterministic variables: const 
## Sample size: 221 
## Log Likelihood: -1624.146 
## Roots of the characteristic polynomial:
## 0.5332 0.3203 0.2815 0.2815
## Call:
## VAR(y = yy, p = 2, type = "const")
## 
## 
## Estimation results for equation y1: 
## =================================== 
## y1 = y1.l1 + y2.l1 + y1.l2 + y2.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)    
## y1.l1 0.212901   0.065005   3.275 0.001230 ** 
## y2.l1 0.016263   0.006044   2.691 0.007683 ** 
## y1.l2 0.170781   0.063333   2.697 0.007558 ** 
## y2.l2 0.023737   0.006146   3.862 0.000149 ***
## const 1.716223   0.293624   5.845 1.85e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 2.89 on 216 degrees of freedom
## Multiple R-Squared: 0.5843,  Adjusted R-squared: 0.5747 
## F-statistic: 60.73 on 5 and 216 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation y2: 
## =================================== 
## y2 = y2.l1 + y2.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)
## y2.l1  0.10828    0.06751   1.604    0.110
## y2.l2 -0.07922    0.06751  -1.173    0.242
## const  2.92103    2.20392   1.325    0.186
## 
## 
## Residual standard error: 32.52 on 218 degrees of freedom
## Multiple R-Squared: 0.02465, Adjusted R-squared: 0.01122 
## F-statistic: 1.836 on 3 and 218 DF,  p-value: 0.1415 
## 
## 
## 
## Covariance matrix of residuals:
##        y1      y2
## y1  8.351   15.39
## y2 15.392 1067.09
## 
## Correlation matrix of residuals:
##       y1    y2
## y1 1.000 0.163
## y2 0.163 1.000

We get different results when we restrict the B0 matrix vs. the B1 matrix.

Now we make the restricted getting rid of all variables with t-stat below 2.

mat.r2<- matrix(1,nrow=2, ncol=5)
mat.r2[1,c(3)]<-0
mat.r2[2,c(1,2,3,4)]<-0
mat.r2
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    1    0    1    1
## [2,]    0    0    0    0    1
var2.r2 <- restrict(var2, method="manual", resmat=mat.r2)
summary(var2.r2)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: y1, y2 
## Deterministic variables: const 
## Sample size: 221 
## Log Likelihood: -1630.276 
## Roots of the characteristic polynomial:
## 0.2716     0     0     0
## Call:
## VAR(y = yy, p = 2, type = "const")
## 
## 
## Estimation results for equation y1: 
## =================================== 
## y1 = y1.l1 + y2.l1 + y2.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)    
## y1.l1 0.271565   0.062135   4.371 1.92e-05 ***
## y2.l1 0.015802   0.006128   2.579   0.0106 *  
## y2.l2 0.024794   0.006222   3.985 9.21e-05 ***
## const 2.055691   0.269074   7.640 6.89e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 2.931 on 217 degrees of freedom
## Multiple R-Squared: 0.5703,  Adjusted R-squared: 0.5624 
## F-statistic: 72.01 on 4 and 217 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation y2: 
## =================================== 
## y2 = const 
## 
##       Estimate Std. Error t value Pr(>|t|)
## const    3.014      2.195   1.373    0.171
## 
## 
## Residual standard error: 32.63 on 220 degrees of freedom
## Multiple R-Squared: 0.008497,    Adjusted R-squared: 0.00399 
## F-statistic: 1.885 on 1 and 220 DF,  p-value: 0.1711 
## 
## 
## 
## Covariance matrix of residuals:
##        y1      y2
## y1  8.632   13.95
## y2 13.952 1084.76
## 
## Correlation matrix of residuals:
##        y1     y2
## y1 1.0000 0.1442
## y2 0.1442 1.0000
lm2 <- var2$varresult
lm.r <- var2.r$varresult
lm.r2 <- var2.r2$varresult
library(stargazer)
stargazer(lm2$y1, lm2$y2, lm.r$y1, lm.r$y2, lm.r2$y1, lm.r2$y2,
          type="text", column.labels=rep(colnames(yy), 3),
          dep.var.labels.include=FALSE)
## 
## =======================================================================================================================================================
##                                                                             Dependent variable:                                                        
##                     -----------------------------------------------------------------------------------------------------------------------------------
##                               y1                    y2                    y1                    y2                    y1                    y2         
##                               (1)                   (2)                   (3)                   (4)                   (5)                   (6)        
## -------------------------------------------------------------------------------------------------------------------------------------------------------
## y1.l1                      0.213***                0.585               0.213***                                    0.272***                            
##                             (0.065)               (0.732)               (0.065)                                     (0.062)                            
##                                                                                                                                                        
## y2.l1                      0.016***                0.103               0.016***                0.108                0.016**                            
##                             (0.006)               (0.068)               (0.006)               (0.068)               (0.006)                            
##                                                                                                                                                        
## y1.l2                      0.171***               -0.874               0.171***                                                                        
##                             (0.063)               (0.713)               (0.063)                                                                        
##                                                                                                                                                        
## y2.l2                      0.024***               -0.080               0.024***               -0.079               0.025***                            
##                             (0.006)               (0.069)               (0.006)               (0.068)               (0.006)                            
##                                                                                                                                                        
## const                      1.716***                3.828               1.716***                2.921               2.056***                3.014       
##                             (0.294)               (3.306)               (0.294)               (2.204)               (0.269)               (2.195)      
##                                                                                                                                                        
## -------------------------------------------------------------------------------------------------------------------------------------------------------
## Observations                  221                   221                   221                   221                   221                   221        
## R2                           0.235                 0.024                 0.584                 0.025                 0.570                 0.008       
## Adjusted R2                  0.220                 0.006                 0.575                 0.011                 0.562                 0.004       
## Residual Std. Error    2.890 (df = 216)      32.541 (df = 216)     2.890 (df = 216)      32.516 (df = 218)     2.931 (df = 217)      32.635 (df = 220) 
## F Statistic         16.545*** (df = 4; 216) 1.319 (df = 4; 216) 60.731*** (df = 5; 216) 1.836 (df = 3; 218) 72.014*** (df = 4; 217) 1.885 (df = 1; 220)
## =======================================================================================================================================================
## Note:                                                                                                                       *p<0.1; **p<0.05; ***p<0.01

We can see R square with significant p-value for coefficients in restricted model 1. As a result, we can assume the restricted models are better than original models.

(d) Plot IRFs and FEVD for the VAR Model Based on the Choleski Decomposition

plot the IRFs for the VAR model based on Choleski decomposition

var2.irfs <- irf(var2, n.ahead=40)
par(mfcol=c(2,2), cex=0.6)
plot(var2.irfs, plot.type="single")

FEVD

var2.fevd <- fevd(var2, n.ahead=40)
var2.fevd[[1]][c(1,4,8,40),]
##             y1        y2
## [1,] 1.0000000 0.0000000
## [2,] 0.8852589 0.1147411
## [3,] 0.8823555 0.1176445
## [4,] 0.8823529 0.1176471
var2.fevd[[2]][c(1,4,8,40),]
##              y1        y2
## [1,] 0.02678947 0.9732105
## [2,] 0.03599515 0.9640049
## [3,] 0.03616141 0.9638386
## [4,] 0.03616158 0.9638384
plot(var2.fevd)

plot(var2.fevd, addbars=8)

Reversing the order of y1 and y2 and run plot the IRF and the FEVD.

yy2<-cbind(y2,y1)
yy2<-window(yy2,start="1961 Q1", end="2016 Q4")
VARselect(yy2, lag.max=10)
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      2      2      2      2 
## 
## $criteria
##                  1           2           3           4           5
## AIC(n)    9.194244    9.111315    9.133983    9.152568    9.170315
## HQ(n)     9.232509    9.175090    9.223268    9.267363    9.310620
## SC(n)     9.288928    9.269122    9.354913    9.436621    9.517491
## FPE(n) 9840.356985 9057.354027 9265.288983 9439.597216 9609.419568
##                  6           7            8            9           10
## AIC(n)    9.195459    9.205527     9.230736     9.240712     9.254377
## HQ(n)     9.361275    9.396853     9.447572     9.483057     9.522232
## SC(n)     9.605758    9.678949     9.767281     9.840379     9.917167
## FPE(n) 9855.284763 9956.635676 10213.001172 10318.178641 10463.645055
var22<-VAR(yy2,p=2,type="const")
var22.irfs <- irf(var22, n.ahead=40)
par(mfcol=c(2,2), cex=0.6)
plot(var22.irfs, plot.type="single")

var22.fevd <- fevd(var22, n.ahead=40)
var22.fevd[[1]][c(1,4,8,40),]
##             y2          y1
## [1,] 1.0000000 0.000000000
## [2,] 0.9936460 0.006353988
## [3,] 0.9935366 0.006463439
## [4,] 0.9935365 0.006463549
var22.fevd[[2]][c(1,4,8,40),]
##              y2        y1
## [1,] 0.02678947 0.9732105
## [2,] 0.17162831 0.8283717
## [3,] 0.17507073 0.8249293
## [4,] 0.17507383 0.8249262
plot(var22.fevd)

plot(var22.fevd, addbars=8)

Conclusion

The result basically presents the same thing, except it is reversed. This indicates that S&P can predicts the GDP because the S&P is based on more real time economic data than the GDP is. GDP and S&P have a significant timing issue. The GDP is calcualted about a month after each quarter ends while the S&P is continually changed by investors with real time information. That is, GDP numbers are largely backward looking. Therefore, there is a consistent relationship between the two variables no matter which order we put the two variables in.

(e) Restimate VAR

li<-Quandl("FRED/USSLIND" , collapse="quarterly", type="zoo")
li<-window(li,start="1982 Q1", end="2016 Q4")
lli<-log(li)
ldli<-diff(lli,1)
par(mfrow=c(1,2))
plot(li,xlab="Time", ylab="LI")
plot(ldli,xlab="Time", ylab="First Diff Log LI")

Now that we have all the components, lets merge them together and take out missing values.

yr<-cbind(ldsnp,ldgdpd,ldgdp,ldli)
yr<-na.omit(yr)

We should subtract them to get \(y_{2,t}\).

yr2<-yr$ldsnp-yr$ldgdpd
yr1<-yr$ldgdp
yr3<-yr$ldli
yyr<-cbind(yr1,yr2,yr3)
plot(yyr)

(1) Estimate a bivariate reduced form VAR

Now we look for \(y_t=(y_{1,t},y_{2,t},y_{3,t})'\) for the period 1982Q1-2016Q4. Then we estimate a reduced form VAR.

yyr<-window(yyr,start="1982 Q1", end="2016 Q4")
yrvar <- VARselect(yyr, lag.max=10, type="const")
yrvar
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      2      1      1      2 
## 
## $criteria
##                 1          2          3          4          5          6
## AIC(n)   5.722807   5.662286   5.701982   5.822626   5.917523   5.947798
## HQ(n)    5.840338   5.867964   5.995809   6.204600   6.387645   6.506067
## SC(n)    6.012441   6.169146   6.426068   6.763937   7.076059   7.323560
## FPE(n) 305.789161 287.942971 299.877824 338.896717 373.631379 386.630487
##                 7          8          9         10
## AIC(n)   6.015370   6.100315   6.199587   6.249940
## HQ(n)    6.661787   6.834881   7.022300   7.160801
## SC(n)    7.608357   7.910528   8.227025   8.494604
## FPE(n) 415.912052 456.063616 508.358454 540.883646

The model with the lowest AIC has the best fit. It looks like that would be (2)

Lets check what the correlation matrix looks like

varr2<-VAR(yyr,p=yrvar$selection[1],type="const")
summary(varr2)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: yr1, yr2, yr3 
## Deterministic variables: const 
## Sample size: 121 
## Log Likelihood: -832.099 
## Roots of the characteristic polynomial:
## 0.6435 0.5229 0.4075 0.4075 0.2208 0.2208
## Call:
## VAR(y = yyr, p = yrvar$selection[1], type = "const")
## 
## 
## Estimation results for equation yr1: 
## ==================================== 
## yr1 = yr1.l1 + yr2.l1 + yr3.l1 + yr1.l2 + yr2.l2 + yr3.l2 + const 
## 
##        Estimate Std. Error t value Pr(>|t|)    
## yr1.l1 0.129503   0.089051   1.454 0.148622    
## yr2.l1 0.001229   0.005788   0.212 0.832208    
## yr3.l1 0.638114   0.558049   1.143 0.255238    
## yr1.l2 0.335792   0.088023   3.815 0.000222 ***
## yr2.l2 0.004932   0.005824   0.847 0.398925    
## yr3.l2 0.296301   0.538847   0.550 0.583478    
## const  1.595901   0.374600   4.260 4.22e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 1.808 on 114 degrees of freedom
## Multiple R-Squared: 0.2065,  Adjusted R-squared: 0.1647 
## F-statistic: 4.945 on 6 and 114 DF,  p-value: 0.0001565 
## 
## 
## Estimation results for equation yr2: 
## ==================================== 
## yr2 = yr1.l1 + yr2.l1 + yr3.l1 + yr1.l2 + yr2.l2 + yr3.l2 + const 
## 
##        Estimate Std. Error t value Pr(>|t|)
## yr1.l1  0.80073    1.43560   0.558    0.578
## yr2.l1 -0.04378    0.09331  -0.469    0.640
## yr3.l1 -0.53351    8.99640  -0.059    0.953
## yr1.l2  0.57543    1.41903   0.406    0.686
## yr2.l2 -0.04681    0.09390  -0.499    0.619
## yr3.l2 -3.34242    8.68685  -0.385    0.701
## const   3.41386    6.03899   0.565    0.573
## 
## 
## Residual standard error: 29.14 on 114 degrees of freedom
## Multiple R-Squared: 0.009043,    Adjusted R-squared: -0.04311 
## F-statistic: 0.1734 on 6 and 114 DF,  p-value: 0.9835 
## 
## 
## Estimation results for equation yr3: 
## ==================================== 
## yr3 = yr1.l1 + yr2.l1 + yr3.l1 + yr1.l2 + yr2.l2 + yr3.l2 + const 
## 
##          Estimate Std. Error t value Pr(>|t|)  
## yr1.l1 -0.0029765  0.0152168  -0.196   0.8453  
## yr2.l1  0.0014538  0.0009891   1.470   0.1444  
## yr3.l1 -0.0544390  0.0953579  -0.571   0.5692  
## yr1.l2 -0.0161267  0.0150411  -1.072   0.2859  
## yr2.l2 -0.0002902  0.0009953  -0.292   0.7711  
## yr3.l2 -0.1647440  0.0920768  -1.789   0.0762 .
## const   0.0464763  0.0640107   0.726   0.4693  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.3089 on 114 degrees of freedom
## Multiple R-Squared: 0.07152, Adjusted R-squared: 0.02265 
## F-statistic: 1.464 on 6 and 114 DF,  p-value: 0.197 
## 
## 
## 
## Covariance matrix of residuals:
##        yr1      yr2      yr3
## yr1 3.2678   2.1002  0.21362
## yr2 2.1002 849.2777 -0.01390
## yr3 0.2136  -0.0139  0.09542
## 
## Correlation matrix of residuals:
##         yr1       yr2       yr3
## yr1 1.00000  0.039866  0.382557
## yr2 0.03987  1.000000 -0.001544
## yr3 0.38256 -0.001544  1.000000

(2) Granger Causality Tests

causality(varr2,cause="yr1")
## $Granger
## 
##  Granger causality H0: yr1 do not Granger-cause yr2 yr3
## 
## data:  VAR object varr2
## F-Test = 0.51925, df1 = 4, df2 = 342, p-value = 0.7216
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: yr1 and yr2 yr3
## 
## data:  VAR object varr2
## Chi-squared = 15.598, df = 2, p-value = 0.0004101
causality(varr2,cause="yr2")
## $Granger
## 
##  Granger causality H0: yr2 do not Granger-cause yr1 yr3
## 
## data:  VAR object varr2
## F-Test = 0.88245, df1 = 4, df2 = 342, p-value = 0.4746
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: yr2 and yr1 yr3
## 
## data:  VAR object varr2
## Chi-squared = 0.23183, df = 2, p-value = 0.8905
causality(varr2,cause="yr3")
## $Granger
## 
##  Granger causality H0: yr3 do not Granger-cause yr1 yr2
## 
## data:  VAR object varr2
## F-Test = 0.4356, df1 = 4, df2 = 342, p-value = 0.7829
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: yr3 and yr1 yr2
## 
## data:  VAR object varr2
## Chi-squared = 15.474, df = 2, p-value = 0.0004365

So we see that there is no Granger Causality among \(Y_1\), \(Y_2\) and \(Y_3\). However, there is statistically significant instantaneous causality from \(Y_3\) to \(Y_1\) and \(Y_2\), and from \(Y_1\) to \(Y_2\) and \(Y_3\). This means that we can use the the six-month growth rate of the state’s coincident index to predict real GDP and S&P 500, or the GDP to predict the six-month growth rate of the state’s coincident index and S&P 500.

R0 <- matrix(1, nrow = 3, ncol = 7)
R0[1, c(2,3,5,6)] <- 0
R0[2, c(1,3,4,5)] <- 0
R0[3, c(1,2,4,5)] <- 0

This is the restricted VAR model based on removing the lag among y1, y2, and y3 in the Granger Causality test

varr2.r <- restrict(varr2, method = "manual", resmat = R0)
lmr2 <- varr2$varresult
lm.rr <- varr2.r$varresult
stargazer(lmr2$yr1, lmr2$yr2, lmr2$yr3, lm.rr$yr1, lm.rr$yr2, lm.rr$yr3,
          type="text", column.labels=rep(colnames(yyr), 3),
          dep.var.labels.include=FALSE)
## 
## ====================================================================================================================================================
##                                                                           Dependent variable:                                                       
##                     --------------------------------------------------------------------------------------------------------------------------------
##                              yr1                   yr2                 yr3                   yr1                    yr2                  yr3        
##                              (1)                   (2)                 (3)                   (4)                    (5)                  (6)        
## ----------------------------------------------------------------------------------------------------------------------------------------------------
## yr1.l1                      0.130                 0.801              -0.003                0.169**                                                  
##                            (0.089)               (1.436)             (0.015)               (0.084)                                                  
##                                                                                                                                                     
## yr2.l1                      0.001                -0.044               0.001                                        -0.036                           
##                            (0.006)               (0.093)             (0.001)                                      (0.092)                           
##                                                                                                                                                     
## yr3.l1                      0.638                -0.534              -0.054                                                            -0.056       
##                            (0.558)               (8.996)             (0.095)                                                           (0.090)      
##                                                                                                                                                     
## yr1.l2                     0.336***               0.575              -0.016                0.337***                                                 
##                            (0.088)               (1.419)             (0.015)               (0.083)                                                  
##                                                                                                                                                     
## yr2.l2                      0.005                -0.047              -0.0003                                                                        
##                            (0.006)               (0.094)             (0.001)                                                                        
##                                                                                                                                                     
## yr3.l2                      0.296                -3.342              -0.165*                                       -1.530             -0.195**      
##                            (0.539)               (8.687)             (0.092)                                      (8.186)              (0.088)      
##                                                                                                                                                     
## const                      1.596***               3.414               0.046                1.511***               7.394***             -0.006       
##                            (0.375)               (6.039)             (0.064)               (0.357)                (2.698)              (0.028)      
##                                                                                                                                                     
## ----------------------------------------------------------------------------------------------------------------------------------------------------
## Observations                 121                   121                 121                   121                    121                  121        
## R2                          0.207                 0.009               0.072                 0.769                  0.061                0.043       
## Adjusted R2                 0.165                -0.043               0.023                 0.764                  0.037                0.019       
## Residual Std. Error    1.808 (df = 114)     29.142 (df = 114)   0.309 (df = 114)       1.797 (df = 118)      28.751 (df = 118)    0.308 (df = 118)  
## F Statistic         4.945*** (df = 6; 114) 0.173 (df = 6; 114) 1.464 (df = 6; 114) 131.211*** (df = 3; 118) 2.542* (df = 3; 118) 1.767 (df = 3; 118)
## ====================================================================================================================================================
## Note:                                                                                                                    *p<0.1; **p<0.05; ***p<0.01

The number of significant coeffficient increases and R square does either from original models to restricted models. As a result, we can assume the restricted models are better than original models.

(f) Forcasting

var.forecasting <- predict(varr2.r, n.ahead = 4)
fanchart(var.forecasting)

2017:Q1

FRBNY <- 2.7
GDPnow <- 0.5
Wallstreet <- 1.4
Ours <- 3.022
forecastings = matrix(c(FRBNY, GDPnow, Wallstreet, Ours), ncol=1, byrow= TRUE)
rownames(forecastings) <- c("FRBNY","GDPnow","Wallstreet", "Ours")
colnames(forecastings) <- c("Forecasting")
forecastings <- as.table(forecastings)
forecastings
##            Forecasting
## FRBNY            2.700
## GDPnow           0.500
## Wallstreet       1.400
## Ours             3.022

Our forecasting value for GDP is 3.022 percent, which is more positive than other forecatings.