Question 1

Excersie 1

A three-dimensional VAR(2)-process where the third variable does not Granger-cause the first variable was generated using the following model:

\[\left[ \begin{array}{c} y_{1t} \\ y_{2t} \\ y_{3t} \end{array} \right] = \left[ \begin{array}{c} 5 \\ 10 \\ 15 \end{array} \right] + \left[ \begin{array}{ccc} -0.5 & -0.1 & 0 \\ 0.2 & 0.5 & 0.2 \\ -0.4 & -0.6 & 0.1 \end{array} \right] \left[ \begin{array}{c} y_{1t-1} \\ y_{2t-1} \\ y_{3t-1} \end{array} \right] + \left[ \begin{array}{ccc} 0.3 & 0.1 & 0 \\ 0.1 & -0.3 & -0.1 \\ 0.3 & -0.2 & 0.3 \end{array} \right] \left[ \begin{array}{c} y_{1t-2} \\ y_{2t-2} \\ y_{3t-2} \end{array} \right] + \left[ \begin{array}{c} u_{1t} \\ u_{2t} \\ u_{3t} \end{array} \right]\]

In a three-equation model with 2 lags \(\{y_{3t}\}\) does not Granger-cause \(\{y_{1t}\}\), if and only if all of the coefficients of \(A_{13}(L)\) are equal to zero.

\[A_{13}^{(1)}=A_{13}^{(2)}=0\]

Setting lag polynomial A(L)

Apoly <- array(c(1.0, -0.5, 0.3, 0.0, 0.2, 0.1, 0.0, -0.4, 0.3, 
                 0.0, -0.1, 0.1, 1.0, 0.5, -0.3, 0.0, -0.6, -0.2, 
                 0.0, 0.0, 0.0, 0.0, 0.2, -0.1, 1.0, 0.1, 0.3), 
               c(3, 3, 3))

Setting the corvariance to identity matrix

B <- diag(3)

Setting constant terms to 5, 10, and 15

TRD <- c(5, 10, 15)

Generating the VAR(2) model

var2 <- ARMA(A = Apoly, B = B, TREND = TRD)
var2
## TREND=   5 10 15
## A(L) =
## 1-0.5L1+0.3L2    0-0.1L1+0.1L2    0    
## 0+0.2L1+0.1L2    1+0.5L1-0.3L2    0+0.2L1-0.1L2    
## 0-0.4L1+0.3L2    0-0.6L1-0.2L2    1+0.1L1+0.3L2    
## 
## B(L) =
## 1    0    0    
## 0    1    0    
## 0    0    1

Excersie 2

Simulating 250 observations of the VAR(2) model:

varsim <- simulate(var2, sampleT = 250, noise = list(w = matrix(rnorm(750), nrow = 250, ncol = 3)), 
                   rng = list(seed = c(123456))) 

Obtaining the generated series

vardat <- matrix(varsim$output, nrow = 250, ncol = 3) 
colnames(vardat) <- c("y1", "y2", "y3") 
plot.ts(vardat, main = "VAR(2) Model Simulation", xlab = "Sample") 

Determining an appropriate lag order

VARselect(vardat, lag.max = 3, type = "const") 
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      2      2      2      2 
## 
## $criteria
##                1           2           3
## AIC(n) 0.5168466 -0.18138552 -0.14248269
## HQ(n)  0.5854899 -0.06125981  0.02912548
## SC(n)  0.6873432  0.11698353  0.28375881
## FPE(n) 1.6767462  0.83415172  0.86731778
VARselect(vardat, lag.max = 3, type = NULL)
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      2      2      2      2 
## 
## $criteria
##                1           2           3
## AIC(n) 0.5168466 -0.18138552 -0.14248269
## HQ(n)  0.5854899 -0.06125981  0.02912548
## SC(n)  0.6873432  0.11698353  0.28375881
## FPE(n) 1.6767462  0.83415172  0.86731778

Estimating the model

varsimest <- VAR(vardat, p = 2, type = "const", season = NULL, exogen = NULL)
varsimest <- VAR(vardat, type = "const", lag.max = 3, ic = "SC") # Selection according to AIC
summary(varsimest)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: y1, y2, y3 
## Deterministic variables: const 
## Sample size: 248 
## Log Likelihood: -1014.579 
## Roots of the characteristic polynomial:
## 0.8447 0.6935 0.6935 0.5674 0.5674 0.3909
## Call:
## VAR(y = vardat, type = "const", lag.max = 3, ic = "SC")
## 
## 
## Estimation results for equation y1: 
## =================================== 
## y1 = y1.l1 + y2.l1 + y3.l1 + y1.l2 + y2.l2 + y3.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)    
## y1.l1  0.51441    0.06206   8.289 8.02e-15 ***
## y2.l1  0.15761    0.05978   2.636  0.00892 ** 
## y3.l1  0.03098    0.04884   0.634  0.52648    
## y1.l2 -0.27445    0.06406  -4.285 2.65e-05 ***
## y2.l2 -0.01467    0.06798  -0.216  0.82929    
## y3.l2  0.04417    0.04700   0.940  0.34830    
## const  2.85013    1.25360   2.274  0.02387 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.9733 on 241 degrees of freedom
## Multiple R-Squared: 0.266,   Adjusted R-squared: 0.2478 
## F-statistic: 14.56 on 6 and 241 DF,  p-value: 3.586e-14 
## 
## 
## Estimation results for equation y2: 
## =================================== 
## y2 = y1.l1 + y2.l1 + y3.l1 + y1.l2 + y2.l2 + y3.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)    
## y1.l1 -0.24622    0.06096  -4.039 7.23e-05 ***
## y2.l1 -0.49199    0.05873  -8.377 4.51e-15 ***
## y3.l1 -0.31946    0.04798  -6.659 1.85e-10 ***
## y1.l2 -0.04724    0.06293  -0.751   0.4536    
## y2.l2  0.39694    0.06679   5.944 9.71e-09 ***
## y3.l2  0.10852    0.04617   2.350   0.0196 *  
## const 10.98080    1.23153   8.916  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.9561 on 241 degrees of freedom
## Multiple R-Squared: 0.588,   Adjusted R-squared: 0.5777 
## F-statistic: 57.33 on 6 and 241 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation y3: 
## =================================== 
## y3 = y1.l1 + y2.l1 + y3.l1 + y1.l2 + y2.l2 + y3.l2 + const 
## 
##       Estimate Std. Error t value Pr(>|t|)    
## y1.l1  0.37339    0.06099   6.123 3.71e-09 ***
## y2.l1  0.48029    0.05875   8.175 1.69e-14 ***
## y3.l1 -0.13324    0.04799  -2.776  0.00593 ** 
## y1.l2 -0.35776    0.06295  -5.683 3.80e-08 ***
## y2.l2  0.12328    0.06681   1.845  0.06621 .  
## y3.l2 -0.37265    0.04619  -8.068 3.37e-14 ***
## const 18.11876    1.23195  14.707  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.9565 on 241 degrees of freedom
## Multiple R-Squared: 0.5585,  Adjusted R-squared: 0.5475 
## F-statistic: 50.82 on 6 and 241 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##         y1       y2       y3
## y1 0.94726  0.09110  0.02705
## y2 0.09110  0.91420 -0.04062
## y3 0.02705 -0.04062  0.91482
## 
## Correlation matrix of residuals:
##         y1       y2       y3
## y1 1.00000  0.09789  0.02906
## y2 0.09789  1.00000 -0.04442
## y3 0.02906 -0.04442  1.00000
# Checking the roots
roots <- roots(varsimest)
roots
## [1] 0.8447123 0.6934515 0.6934515 0.5673669 0.5673669 0.3908880