Modelo de Vectores Autorregresivos (VAR: Vector autoregressive models)

Definición

Dado un conjunto de K variables endogenas \((y_{1t},...,y_{kt},...,y_{Kt})\) for k = 1,…K. The VAR(p)-process is then defined as:

\(y_t = (A_1y_{t-1}+...+A_py_{t-p},...,yKt)\) for k = 1,…K. The VAR(p)-process is then defined as:

library(vars)
## Loading required package: MASS
## Loading required package: strucchange
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: sandwich
## Loading required package: urca
## Loading required package: lmtest
data(Canada)
Canada=as.data.frame(Canada)

layout(matrix(1:4, nrow = 2, ncol = 2))

plot.ts(Canada$e, main = "Employment", ylab = "", xlab = "")
plot.ts(Canada$prod, main = "Productivity", ylab = "", xlab = "")
plot.ts(Canada$rw, main = "Real Wage", ylab = "", xlab = "")
plot.ts(Canada$U, main = "Unemployment Rate", ylab = "", xlab = "")

Para seleccionar el Rezago del modelo se utiliza la siguiente función

VARselect(Canada, lag.max = 5, type = "const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      3      2      2      3 
## 
## $criteria
##                   1           2            3            4            5
## AIC(n) -5.817851996 -6.35093701 -6.397756084 -6.145942174 -5.926500201
## HQ(n)  -5.577529641 -5.91835677 -5.772917961 -5.328846166 -4.917146309
## SC(n)  -5.217991781 -5.27118862 -4.838119523 -4.106417440 -3.407087295
## FPE(n)  0.002976003  0.00175206  0.001685528  0.002201523  0.002811116
var.2c <- VAR(Canada, p = 2, type = "const")
summary(var.2c)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: e, prod, rw, U 
## Deterministic variables: const 
## Sample size: 82 
## Log Likelihood: -175.819 
## Roots of the characteristic polynomial:
## 0.995 0.9081 0.9081 0.7381 0.7381 0.1856 0.1429 0.1429
## Call:
## VAR(y = Canada, p = 2, type = "const")
## 
## 
## Estimation results for equation e: 
## ================================== 
## e = e.l1 + prod.l1 + rw.l1 + U.l1 + e.l2 + prod.l2 + rw.l2 + U.l2 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## e.l1     1.638e+00  1.500e-01  10.918  < 2e-16 ***
## prod.l1  1.673e-01  6.114e-02   2.736  0.00780 ** 
## rw.l1   -6.312e-02  5.524e-02  -1.143  0.25692    
## U.l1     2.656e-01  2.028e-01   1.310  0.19444    
## e.l2    -4.971e-01  1.595e-01  -3.116  0.00262 ** 
## prod.l2 -1.017e-01  6.607e-02  -1.539  0.12824    
## rw.l2    3.844e-03  5.552e-02   0.069  0.94499    
## U.l2     1.327e-01  2.073e-01   0.640  0.52418    
## const   -1.370e+02  5.585e+01  -2.453  0.01655 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.3628 on 73 degrees of freedom
## Multiple R-Squared: 0.9985,  Adjusted R-squared: 0.9984 
## F-statistic:  6189 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation prod: 
## ===================================== 
## prod = e.l1 + prod.l1 + rw.l1 + U.l1 + e.l2 + prod.l2 + rw.l2 + U.l2 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## e.l1      -0.17277    0.26977  -0.640  0.52390    
## prod.l1    1.15043    0.10995  10.464 3.57e-16 ***
## rw.l1      0.05130    0.09934   0.516  0.60710    
## U.l1      -0.47850    0.36470  -1.312  0.19362    
## e.l2       0.38526    0.28688   1.343  0.18346    
## prod.l2   -0.17241    0.11881  -1.451  0.15104    
## rw.l2     -0.11885    0.09985  -1.190  0.23778    
## U.l2       1.01592    0.37285   2.725  0.00805 ** 
## const   -166.77552  100.43388  -1.661  0.10109    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.6525 on 73 degrees of freedom
## Multiple R-Squared: 0.9787,  Adjusted R-squared: 0.9764 
## F-statistic: 419.3 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation rw: 
## =================================== 
## rw = e.l1 + prod.l1 + rw.l1 + U.l1 + e.l2 + prod.l2 + rw.l2 + U.l2 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## e.l1     -0.268833   0.322619  -0.833    0.407    
## prod.l1  -0.081065   0.131487  -0.617    0.539    
## rw.l1     0.895478   0.118800   7.538 1.04e-10 ***
## U.l1      0.012130   0.436149   0.028    0.978    
## e.l2      0.367849   0.343087   1.072    0.287    
## prod.l2  -0.005181   0.142093  -0.036    0.971    
## rw.l2     0.052677   0.119410   0.441    0.660    
## U.l2     -0.127708   0.445892  -0.286    0.775    
## const   -33.188339 120.110525  -0.276    0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.7803 on 73 degrees of freedom
## Multiple R-Squared: 0.9989,  Adjusted R-squared: 0.9987 
## F-statistic:  8009 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation U: 
## ================================== 
## U = e.l1 + prod.l1 + rw.l1 + U.l1 + e.l2 + prod.l2 + rw.l2 + U.l2 + const 
## 
##          Estimate Std. Error t value Pr(>|t|)    
## e.l1     -0.58076    0.11563  -5.023 3.49e-06 ***
## prod.l1  -0.07812    0.04713  -1.658 0.101682    
## rw.l1     0.01866    0.04258   0.438 0.662463    
## U.l1      0.61893    0.15632   3.959 0.000173 ***
## e.l2      0.40982    0.12296   3.333 0.001352 ** 
## prod.l2   0.05212    0.05093   1.023 0.309513    
## rw.l2     0.04180    0.04280   0.977 0.331928    
## U.l2     -0.07117    0.15981  -0.445 0.657395    
## const   149.78056   43.04810   3.479 0.000851 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.2797 on 73 degrees of freedom
## Multiple R-Squared: 0.9726,  Adjusted R-squared: 0.9696 
## F-statistic:   324 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##              e      prod       rw        U
## e     0.131635 -0.007469 -0.04210 -0.06909
## prod -0.007469  0.425711  0.06461  0.01392
## rw   -0.042099  0.064613  0.60886  0.03422
## U    -0.069087  0.013923  0.03422  0.07821
## 
## Correlation matrix of residuals:
##             e     prod      rw       U
## e     1.00000 -0.03155 -0.1487 -0.6809
## prod -0.03155  1.00000  0.1269  0.0763
## rw   -0.14870  0.12691  1.0000  0.1568
## U    -0.68090  0.07630  0.1568  1.0000
plot(var.2c)

Raices del modelo

roots(var.2c)
## [1] 0.9950338 0.9081062 0.9081062 0.7380565 0.7380565 0.1856381 0.1428889
## [8] 0.1428889

Las dos primeras están cercanas a 1.

Respuesta al impulso

Canada2 <- Canada[, c(3, 1, 4, 2)]
var.2c.alt <- VAR(Canada2, p = 2, type = "const")
summary(var.2c.alt)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: rw, e, U, prod 
## Deterministic variables: const 
## Sample size: 82 
## Log Likelihood: -175.819 
## Roots of the characteristic polynomial:
## 0.995 0.9081 0.9081 0.7381 0.7381 0.1856 0.1429 0.1429
## Call:
## VAR(y = Canada2, p = 2, type = "const")
## 
## 
## Estimation results for equation rw: 
## =================================== 
## rw = rw.l1 + e.l1 + U.l1 + prod.l1 + rw.l2 + e.l2 + U.l2 + prod.l2 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## rw.l1     0.895478   0.118800   7.538 1.04e-10 ***
## e.l1     -0.268833   0.322619  -0.833    0.407    
## U.l1      0.012130   0.436149   0.028    0.978    
## prod.l1  -0.081065   0.131487  -0.617    0.539    
## rw.l2     0.052677   0.119410   0.441    0.660    
## e.l2      0.367849   0.343087   1.072    0.287    
## U.l2     -0.127708   0.445892  -0.286    0.775    
## prod.l2  -0.005181   0.142093  -0.036    0.971    
## const   -33.188339 120.110525  -0.276    0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.7803 on 73 degrees of freedom
## Multiple R-Squared: 0.9989,  Adjusted R-squared: 0.9987 
## F-statistic:  8009 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation e: 
## ================================== 
## e = rw.l1 + e.l1 + U.l1 + prod.l1 + rw.l2 + e.l2 + U.l2 + prod.l2 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## rw.l1   -6.312e-02  5.524e-02  -1.143  0.25692    
## e.l1     1.638e+00  1.500e-01  10.918  < 2e-16 ***
## U.l1     2.656e-01  2.028e-01   1.310  0.19444    
## prod.l1  1.673e-01  6.114e-02   2.736  0.00780 ** 
## rw.l2    3.844e-03  5.552e-02   0.069  0.94499    
## e.l2    -4.971e-01  1.595e-01  -3.116  0.00262 ** 
## U.l2     1.327e-01  2.073e-01   0.640  0.52418    
## prod.l2 -1.017e-01  6.607e-02  -1.539  0.12824    
## const   -1.370e+02  5.585e+01  -2.453  0.01655 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.3628 on 73 degrees of freedom
## Multiple R-Squared: 0.9985,  Adjusted R-squared: 0.9984 
## F-statistic:  6189 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation U: 
## ================================== 
## U = rw.l1 + e.l1 + U.l1 + prod.l1 + rw.l2 + e.l2 + U.l2 + prod.l2 + const 
## 
##          Estimate Std. Error t value Pr(>|t|)    
## rw.l1     0.01866    0.04258   0.438 0.662463    
## e.l1     -0.58076    0.11563  -5.023 3.49e-06 ***
## U.l1      0.61893    0.15632   3.959 0.000173 ***
## prod.l1  -0.07812    0.04713  -1.658 0.101682    
## rw.l2     0.04180    0.04280   0.977 0.331928    
## e.l2      0.40982    0.12296   3.333 0.001352 ** 
## U.l2     -0.07117    0.15981  -0.445 0.657395    
## prod.l2   0.05212    0.05093   1.023 0.309513    
## const   149.78056   43.04810   3.479 0.000851 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.2797 on 73 degrees of freedom
## Multiple R-Squared: 0.9726,  Adjusted R-squared: 0.9696 
## F-statistic:   324 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation prod: 
## ===================================== 
## prod = rw.l1 + e.l1 + U.l1 + prod.l1 + rw.l2 + e.l2 + U.l2 + prod.l2 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)    
## rw.l1      0.05130    0.09934   0.516  0.60710    
## e.l1      -0.17277    0.26977  -0.640  0.52390    
## U.l1      -0.47850    0.36470  -1.312  0.19362    
## prod.l1    1.15043    0.10995  10.464 3.57e-16 ***
## rw.l2     -0.11885    0.09985  -1.190  0.23778    
## e.l2       0.38526    0.28688   1.343  0.18346    
## U.l2       1.01592    0.37285   2.725  0.00805 ** 
## prod.l2   -0.17241    0.11881  -1.451  0.15104    
## const   -166.77552  100.43388  -1.661  0.10109    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.6525 on 73 degrees of freedom
## Multiple R-Squared: 0.9787,  Adjusted R-squared: 0.9764 
## F-statistic: 419.3 on 8 and 73 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##            rw         e        U      prod
## rw    0.60886 -0.042099  0.03422  0.064613
## e    -0.04210  0.131635 -0.06909 -0.007469
## U     0.03422 -0.069087  0.07821  0.013923
## prod  0.06461 -0.007469  0.01392  0.425711
## 
## Correlation matrix of residuals:
##           rw        e       U     prod
## rw    1.0000 -0.14870  0.1568  0.12691
## e    -0.1487  1.00000 -0.6809 -0.03155
## U     0.1568 -0.68090  1.0000  0.07630
## prod  0.1269 -0.03155  0.0763  1.00000
irf.rw.eU <- irf(var.2c.alt, impulse = "rw", response = c("e","U"), boot = TRUE)

names(irf.rw.eU)
##  [1] "irf"        "Lower"      "Upper"      "response"   "impulse"   
##  [6] "ortho"      "cumulative" "runs"       "ci"         "boot"      
## [11] "model"
plot(irf.rw.eU)