Direction

Transform the data and test using KPSS tests.

IND <- Quandl("FRED/INDPRO", type="ts")
CPI <- Quandl("FRED/CPIAUCSL", type="ts")

Data transformation:

y1t <- log(IND)
y2t <- log(CPI)
dy1t <- diff(y1t)
dy2t <- diff(y2t)

Now we have the log of industrial production index \(y_{1,t}\), log of consumer price index \(y_{2,t}\), also the first difference for both \(y_{1,t}\) and \(y_{2,t}\), i.e. \(\Delta y_{1,t} = y_{1,t}\) \(\Delta y_{2,t} = y_{2,t}\)

(a) Unit Root Test

ADF test for nonstationarity for \(y_{1,t}\) and \(y_{2,t}\):

y1t.urdf <- ur.df(y1t, selectlags = "BIC")
summary(y1t.urdf)

############################################### 
# Augmented Dickey-Fuller Test Unit Root Test # 
############################################### 

Test regression none 


Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.098543 -0.005566 -0.000158  0.005584  0.124578 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
z.lag.1    0.0003092  0.0001403   2.204   0.0277 *  
z.diff.lag 0.5096825  0.0251805  20.241   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.01656 on 1162 degrees of freedom
Multiple R-squared:  0.2711,    Adjusted R-squared:  0.2698 
F-statistic: 216.1 on 2 and 1162 DF,  p-value: < 2.2e-16


Value of test-statistic is: 2.204 

Critical values for test statistics: 
      1pct  5pct 10pct
tau1 -2.58 -1.95 -1.62
y2t.urdf <- ur.df(y2t, selectlags = "BIC")
summary(y2t.urdf)

############################################### 
# Augmented Dickey-Fuller Test Unit Root Test # 
############################################### 

Test regression none 


Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.014131 -0.001435 -0.000081  0.001332  0.016985 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
z.lag.1    2.580e-04  2.889e-05   8.928   <2e-16 ***
z.diff.lag 5.930e-01  2.806e-02  21.137   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.002864 on 826 degrees of freedom
Multiple R-squared:  0.6008,    Adjusted R-squared:  0.5998 
F-statistic: 621.4 on 2 and 826 DF,  p-value: < 2.2e-16


Value of test-statistic is: 8.9284 

Critical values for test statistics: 
      1pct  5pct 10pct
tau1 -2.58 -1.95 -1.62

Comparing the \(\tau\) statististics for both \(y_{1,t}\) and \(y_{2,t}\) that are less that its critical value in absolute term, I conclude \(y_{1,t}\) and \(y_{2,t}\) are non-stationary.

ADF test for\(\Delta y_{1,t}\) and \(\Delta y_{2,t}\):

dy1t.urdf <- ur.df(dy1t, selectlags = "BIC")
summary(dy1t.urdf)

############################################### 
# Augmented Dickey-Fuller Test Unit Root Test # 
############################################### 

Test regression none 


Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.098018 -0.004722  0.001089  0.006772  0.124297 

Coefficients:
           Estimate Std. Error t value Pr(>|t|)    
z.lag.1    -0.50498    0.02876 -17.557   <2e-16 ***
z.diff.lag  0.04342    0.02926   1.484    0.138    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.01659 on 1161 degrees of freedom
Multiple R-squared:  0.244, Adjusted R-squared:  0.2427 
F-statistic: 187.3 on 2 and 1161 DF,  p-value: < 2.2e-16


Value of test-statistic is: -17.5572 

Critical values for test statistics: 
      1pct  5pct 10pct
tau1 -2.58 -1.95 -1.62
dy2t.urdf <- ur.df(dy2t, selectlags = "BIC")
summary(dy1t.urdf)

############################################### 
# Augmented Dickey-Fuller Test Unit Root Test # 
############################################### 

Test regression none 


Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.098018 -0.004722  0.001089  0.006772  0.124297 

Coefficients:
           Estimate Std. Error t value Pr(>|t|)    
z.lag.1    -0.50498    0.02876 -17.557   <2e-16 ***
z.diff.lag  0.04342    0.02926   1.484    0.138    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.01659 on 1161 degrees of freedom
Multiple R-squared:  0.244, Adjusted R-squared:  0.2427 
F-statistic: 187.3 on 2 and 1161 DF,  p-value: < 2.2e-16


Value of test-statistic is: -17.5572 

Critical values for test statistics: 
      1pct  5pct 10pct
tau1 -2.58 -1.95 -1.62

Comparing the \(\tau\) statististics for both \(\Delta y_{1,t}\) and \(\Delta y_{2,t}\) that are greater that its critical value in absolute term, I conclude that \(\Delta y_{1,t}\) and \(\Delta y_{2,t}\) are stationary. We will use \(\Delta y_{1,t}\) and \(\Delta y_{2,t}\) for the VAR estimation.

(b) VAR Estimation

In estimating the reduced form VAR model, we’ll let vars to automatically choose the appropriate lags using post-estimation info criterions. We can estimate the VAR model using the following code:

y <- cbind(dy1t, dy2t)
y <- na.trim(y)
var <- VAR(y, lag.max=8, ic="AIC", type="const")
var

VAR Estimation Results:
======================= 

Estimated coefficients for equation dy1t: 
========================================= 
Call:
dy1t = dy1t.l1 + dy2t.l1 + dy1t.l2 + dy2t.l2 + dy1t.l3 + dy2t.l3 + dy1t.l4 + dy2t.l4 + dy1t.l5 + dy2t.l5 + dy1t.l6 + dy2t.l6 + dy1t.l7 + dy2t.l7 + const 

      dy1t.l1       dy2t.l1       dy1t.l2       dy2t.l2       dy1t.l3 
 0.3119228703  0.2181774249  0.0952428204 -0.0930330560  0.0809581628 
      dy2t.l3       dy1t.l4       dy2t.l4       dy1t.l5       dy2t.l5 
-0.0006986961  0.0404475882 -0.1110367505 -0.0773211659 -0.0249262474 
      dy1t.l6       dy2t.l6       dy1t.l7       dy2t.l7         const 
 0.0133328809 -0.2069329954  0.0297572787 -0.1086330658  0.0021726752 


Estimated coefficients for equation dy2t: 
========================================= 
Call:
dy2t = dy1t.l1 + dy2t.l1 + dy1t.l2 + dy2t.l2 + dy1t.l3 + dy2t.l3 + dy1t.l4 + dy2t.l4 + dy1t.l5 + dy2t.l5 + dy1t.l6 + dy2t.l6 + dy1t.l7 + dy2t.l7 + const 

      dy1t.l1       dy2t.l1       dy1t.l2       dy2t.l2       dy1t.l3 
-0.0058262613  0.4433806900  0.0290656163  0.0439567059  0.0067641397 
      dy2t.l3       dy1t.l4       dy2t.l4       dy1t.l5       dy2t.l5 
 0.0681148385 -0.0021679389  0.0404206993 -0.0199103348  0.0548126410 
      dy1t.l6       dy2t.l6       dy1t.l7       dy2t.l7         const 
 0.0241330113  0.0598067743  0.0038612591  0.0932928562  0.0004596373 
summary(var)

VAR Estimation Results:
========================= 
Endogenous variables: dy1t, dy2t 
Deterministic variables: const 
Sample size: 822 
Log Likelihood: 6452.474 
Roots of the characteristic polynomial:
0.9028 0.7865 0.7371 0.7371 0.7223 0.7223 0.6597 0.6597 0.6512 0.6512 0.6193 0.6193 0.4736 0.4736
Call:
VAR(y = y, type = "const", lag.max = 8, ic = "AIC")


Estimation results for equation dy1t: 
===================================== 
dy1t = dy1t.l1 + dy2t.l1 + dy1t.l2 + dy2t.l2 + dy1t.l3 + dy2t.l3 + dy1t.l4 + dy2t.l4 + dy1t.l5 + dy2t.l5 + dy1t.l6 + dy2t.l6 + dy1t.l7 + dy2t.l7 + const 

          Estimate Std. Error t value Pr(>|t|)    
dy1t.l1  0.3119229  0.0351873   8.865  < 2e-16 ***
dy2t.l1  0.2181774  0.1141490   1.911  0.05632 .  
dy1t.l2  0.0952428  0.0367932   2.589  0.00981 ** 
dy2t.l2 -0.0930331  0.1245860  -0.747  0.45544    
dy1t.l3  0.0809582  0.0369912   2.189  0.02891 *  
dy2t.l3 -0.0006987  0.1242586  -0.006  0.99551    
dy1t.l4  0.0404476  0.0370572   1.091  0.27538    
dy2t.l4 -0.1110368  0.1239133  -0.896  0.37048    
dy1t.l5 -0.0773212  0.0368772  -2.097  0.03633 *  
dy2t.l5 -0.0249262  0.1232141  -0.202  0.83973    
dy1t.l6  0.0133329  0.0368413   0.362  0.71752    
dy2t.l6 -0.2069330  0.1208461  -1.712  0.08721 .  
dy1t.l7  0.0297573  0.0350855   0.848  0.39661    
dy2t.l7 -0.1086331  0.1116065  -0.973  0.33067    
const    0.0021727  0.0004912   4.423 1.11e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


Residual standard error: 0.008703 on 807 degrees of freedom
Multiple R-Squared: 0.1932, Adjusted R-squared: 0.1792 
F-statistic:  13.8 on 14 and 807 DF,  p-value: < 2.2e-16 


Estimation results for equation dy2t: 
===================================== 
dy2t = dy1t.l1 + dy2t.l1 + dy1t.l2 + dy2t.l2 + dy1t.l3 + dy2t.l3 + dy1t.l4 + dy2t.l4 + dy1t.l5 + dy2t.l5 + dy1t.l6 + dy2t.l6 + dy1t.l7 + dy2t.l7 + const 

          Estimate Std. Error t value Pr(>|t|)    
dy1t.l1 -0.0058263  0.0108062  -0.539  0.58993    
dy2t.l1  0.4433807  0.0350559  12.648  < 2e-16 ***
dy1t.l2  0.0290656  0.0112994   2.572  0.01028 *  
dy2t.l2  0.0439567  0.0382611   1.149  0.25095    
dy1t.l3  0.0067641  0.0113602   0.595  0.55173    
dy2t.l3  0.0681148  0.0381606   1.785  0.07464 .  
dy1t.l4 -0.0021679  0.0113805  -0.190  0.84897    
dy2t.l4  0.0404207  0.0380545   1.062  0.28847    
dy1t.l5 -0.0199103  0.0113252  -1.758  0.07912 .  
dy2t.l5  0.0548126  0.0378398   1.449  0.14785    
dy1t.l6  0.0241330  0.0113142   2.133  0.03323 *  
dy2t.l6  0.0598068  0.0371126   1.611  0.10746    
dy1t.l7  0.0038613  0.0107750   0.358  0.72017    
dy2t.l7  0.0932929  0.0342750   2.722  0.00663 ** 
const    0.0004596  0.0001509   3.047  0.00239 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


Residual standard error: 0.002673 on 807 degrees of freedom
Multiple R-Squared: 0.4078, Adjusted R-squared: 0.3975 
F-statistic: 39.69 on 14 and 807 DF,  p-value: < 2.2e-16 



Covariance matrix of residuals:
          dy1t      dy2t
dy1t 7.575e-05 7.511e-07
dy2t 7.511e-07 7.144e-06

Correlation matrix of residuals:
        dy1t    dy2t
dy1t 1.00000 0.03229
dy2t 0.03229 1.00000

(c) SVAR Estimation

Implementing Blanchard - Quah approach in R using “BQ”:

svar <- BQ(var)
summary(svar)

SVAR Estimation Results:
======================== 

Call:
BQ(x = var)

Type: Blanchard-Quah 
Sample size: 822 
Log Likelihood: 6437.336 

Estimated contemporaneous impact matrix:
          dy1t     dy2t
dy1t  0.007721 0.004017
dy2t -0.001156 0.002410

Estimated identified long run impact matrix:
         dy1t    dy2t
dy1t  0.01706 0.00000
dy2t -0.00277 0.01228

Covariance matrix of reduced form residuals (*100):
          dy1t      dy2t
dy1t 7.575e-03 7.511e-05
dy2t 7.511e-05 7.144e-04

(d) Interpretation

In the long run, the cummulative effect of shocks in demand side to industrial production is zero, while the long run effect of 1 standard deviation shocks in productivy will increase industrial production by 0.01706%.

(e) Impulse Response Function for SVAR

svar.irfs <- irf(svar, n.ahead=40)
svar.irfs.c <- irf(svar, n.ahead=40, ci=.9, cumulative=TRUE)
svar.irfs$irf[[2]] <- -svar.irfs$irf[[2]]
svar.irfs$Lower[[2]] <- -svar.irfs$Lower[[2]]
svar.irfs$Upper[[2]] <- -svar.irfs$Upper[[2]]
svar.irfs.c$irf[[2]] <- -svar.irfs.c$irf[[2]]
svar.irfs.c$Lower[[2]] <- -svar.irfs.c$Lower[[2]]
svar.irfs.c$Upper[[2]] <- -svar.irfs.c$Upper[[2]]

setwd("C:/Users/evanu/OneDrive/Time Series/Homework 5")
source("plotIRF.R")
par(mfrow=c(2,2), cex=.9, mar=c(4,4,2,1))
plotIRF(svar.irfs.c, vnames="dy1t", vlabels="Industrial Production", slabels=c("Productivity  Shock","Demand shock"))
plotIRF(svar.irfs.c, vnames="dy2t", vlabels="CPI", slabels=c("Productivity Shock","Demand shock"))

```

(f) FEVD for SVAR

plot( fevd(svar, n.ahead=40) ,addbars=10 )

We can see that the majority of the variance of industrial production is due to the changes in its own value, and it is also holds in the long-run. The other way around for consumer price index, the majority of the variance in consumer price index is contributed by the variability in industrial production, and it is also holds in the long run.