Se utilizarƔn los datos USCHANGE.
#SI SON DATOS
#CARGAR EL DATASET
macro <- uschange
head(macro)
## Consumption Income Production Savings Unemployment
## 1970 Q1 0.6159862 0.9722610 -2.4527003 4.8103115 0.9
## 1970 Q2 0.4603757 1.1690847 -0.5515251 7.2879923 0.5
## 1970 Q3 0.8767914 1.5532705 -0.3587079 7.2890131 0.5
## 1970 Q4 -0.2742451 -0.2552724 -2.1854549 0.9852296 0.7
## 1971 Q1 1.8973708 1.9871536 1.9097341 3.6577706 -0.1
## 1971 Q2 0.9119929 1.4473342 0.9015358 6.0513418 -0.1
#aqui tenemos las variables a utilizar que son 5
#CRENANDO EL MODELO
#utilizaremos 3 variables, las siguientes:
sv <- cbind("Consumption", "Income", "Production ")
colnames(sv) <- cbind( "Consumption", "Income", "Production")
#Búsqueda de parÔmetros
#lag.max es el maximo de aƱos que puede irse para atras.
lagselect <- VARselect(uschange[,1:3], lag.max=8,type="const")
#aqui nos dice cuanto tiene que valer P.Los parametros mƔs confiables son HQ(n) y SC(n).
lagselect
## $selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 3 1 1 3
##
## $criteria
## 1 2 3 4 5 6
## AIC(n) -1.3394387 -1.3977078 -1.4318152 -1.4186845 -1.4218510 -1.3638700
## HQ(n) -1.2527933 -1.2460785 -1.2152018 -1.1370871 -1.0752696 -0.9523046
## SC(n) -1.1257592 -1.0237687 -0.8976165 -0.7242262 -0.5671330 -0.3488924
## FPE(n) 0.2619985 0.2471924 0.2389584 0.2422183 0.2416135 0.2562859
## 7 8
## AIC(n) -1.3640914 -1.336510404
## HQ(n) -0.8875420 -0.794976991
## SC(n) -0.1888542 -0.001013558
## FPE(n) 0.2565724 0.264213694
lagselect$selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 3 1 1 3
lagselect$criteria
## 1 2 3 4 5 6
## AIC(n) -1.3394387 -1.3977078 -1.4318152 -1.4186845 -1.4218510 -1.3638700
## HQ(n) -1.2527933 -1.2460785 -1.2152018 -1.1370871 -1.0752696 -0.9523046
## SC(n) -1.1257592 -1.0237687 -0.8976165 -0.7242262 -0.5671330 -0.3488924
## FPE(n) 0.2619985 0.2471924 0.2389584 0.2422183 0.2416135 0.2562859
## 7 8
## AIC(n) -1.3640914 -1.336510404
## HQ(n) -0.8875420 -0.794976991
## SC(n) -0.1888542 -0.001013558
## FPE(n) 0.2565724 0.264213694
#como se repite 1 y 3 habran solo 2 modelos
#CREACION DEL MODELO
#como el sistema me recomendo p=1 Y 3, por que el 1 se repite en ambos parametros confiable
#aun asĆ tambien se prueba con el parametro 3
modelo1<-VAR(uschange[,1:3],p=1,type=c("const"))
modelo1
##
## VAR Estimation Results:
## =======================
##
## Estimated coefficients for equation Consumption:
## ================================================
## Call:
## Consumption = Consumption.l1 + Income.l1 + Production.l1 + const
##
## Consumption.l1 Income.l1 Production.l1 const
## 0.305100647 0.095172416 -0.007064414 0.454650735
##
##
## Estimated coefficients for equation Income:
## ===========================================
## Call:
## Income = Consumption.l1 + Income.l1 + Production.l1 + const
##
## Consumption.l1 Income.l1 Production.l1 const
## 0.6012357 -0.2464750 -0.0704009 0.4801525
##
##
## Estimated coefficients for equation Production:
## ===============================================
## Call:
## Production = Consumption.l1 + Income.l1 + Production.l1 + const
##
## Consumption.l1 Income.l1 Production.l1 const
## 0.81260527 -0.03900531 0.40147572 -0.25872051
modelo3<-VAR(uschange[,1:3],p=3,type=c("const"))
modelo3
##
## VAR Estimation Results:
## =======================
##
## Estimated coefficients for equation Consumption:
## ================================================
## Call:
## Consumption = Consumption.l1 + Income.l1 + Production.l1 + Consumption.l2 + Income.l2 + Production.l2 + Consumption.l3 + Income.l3 + Production.l3 + const
##
## Consumption.l1 Income.l1 Production.l1 Consumption.l2 Income.l2
## 0.244723318 0.071547629 -0.067961564 0.279907354 -0.037718795
## Production.l2 Consumption.l3 Income.l3 Production.l3 const
## -0.047519326 0.290442590 -0.031534846 0.007272457 0.195136520
##
##
## Estimated coefficients for equation Income:
## ===========================================
## Call:
## Income = Consumption.l1 + Income.l1 + Production.l1 + Consumption.l2 + Income.l2 + Production.l2 + Consumption.l3 + Income.l3 + Production.l3 + const
##
## Consumption.l1 Income.l1 Production.l1 Consumption.l2 Income.l2
## 0.60502493 -0.29978239 -0.14642320 0.18335970 -0.09607254
## Production.l2 Consumption.l3 Income.l3 Production.l3 const
## -0.01222773 0.22258399 -0.09187316 0.14745667 0.31007805
##
##
## Estimated coefficients for equation Production:
## ===============================================
## Call:
## Production = Consumption.l1 + Income.l1 + Production.l1 + Consumption.l2 + Income.l2 + Production.l2 + Consumption.l3 + Income.l3 + Production.l3 + const
##
## Consumption.l1 Income.l1 Production.l1 Consumption.l2 Income.l2
## 0.77291963 -0.10822633 0.45384854 0.16983825 -0.11707353
## Production.l2 Consumption.l3 Income.l3 Production.l3 const
## -0.14368802 0.08864545 0.08229012 0.04149671 -0.32112590
#De estos hay que tomar el mƔs pequeƱo, entonces el mejor es el modelo 1 por que
#al ejectutar la siguiente linea el valor mƔs pequeƱo es de 1 con -656.2377
aic1<-summary(modelo1)$logLik
aic1
## [1] -656.2377
aic2<-summary(modelo3)$logLik
aic2
## [1] -624.8263
#USAREMOS EL MODELO 1
#Si es menor que 0.05 existe causalidad
GrangerConsumption <-causality(modelo1, cause = 'Consumption')
GrangerConsumption
## $Granger
##
## Granger causality H0: Consumption do not Granger-cause Income
## Production
##
## data: VAR object modelo1
## F-Test = 19.441, df1 = 2, df2 = 546, p-value = 6.982e-09
##
##
## $Instant
##
## H0: No instantaneous causality between: Consumption and Income
## Production
##
## data: VAR object modelo1
## Chi-squared = 46.671, df = 2, p-value = 7.336e-11
GrangerIncome <-causality(modelo1, cause = 'Income')
GrangerIncome
## $Granger
##
## Granger causality H0: Income do not Granger-cause Consumption
## Production
##
## data: VAR object modelo1
## F-Test = 2.7691, df1 = 2, df2 = 546, p-value = 0.0636
##
##
## $Instant
##
## H0: No instantaneous causality between: Income and Consumption
## Production
##
## data: VAR object modelo1
## Chi-squared = 24.678, df = 2, p-value = 4.377e-06
GrangerProduction <-causality(modelo1, cause = 'Production')
GrangerProduction
## $Granger
##
## Granger causality H0: Production do not Granger-cause Consumption
## Income
##
## data: VAR object modelo1
## F-Test = 1.066, df1 = 2, df2 = 546, p-value = 0.3451
##
##
## $Instant
##
## H0: No instantaneous causality between: Production and Consumption
## Income
##
## data: VAR object modelo1
## Chi-squared = 38.816, df = 2, p-value = 3.727e-09
# la de produccion no tiene causalidad
#SUMMARY DEL MODELO A USAR
summary(modelo1)
##
## VAR Estimation Results:
## =========================
## Endogenous variables: Consumption, Income, Production
## Deterministic variables: const
## Sample size: 186
## Log Likelihood: -656.238
## Roots of the characteristic polynomial:
## 0.418 0.418 0.3474
## Call:
## VAR(y = uschange[, 1:3], p = 1, type = c("const"))
##
##
## Estimation results for equation Consumption:
## ============================================
## Consumption = Consumption.l1 + Income.l1 + Production.l1 + const
##
## Estimate Std. Error t value Pr(>|t|)
## Consumption.l1 0.305101 0.086400 3.531 0.000524 ***
## Income.l1 0.095172 0.052967 1.797 0.074023 .
## Production.l1 -0.007064 0.034989 -0.202 0.840220
## const 0.454651 0.072181 6.299 2.19e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.6151 on 182 degrees of freedom
## Multiple R-Squared: 0.1378, Adjusted R-squared: 0.1236
## F-statistic: 9.695 on 3 and 182 DF, p-value: 5.734e-06
##
##
## Estimation results for equation Income:
## =======================================
## Income = Consumption.l1 + Income.l1 + Production.l1 + const
##
## Estimate Std. Error t value Pr(>|t|)
## Consumption.l1 0.60124 0.12318 4.881 2.30e-06 ***
## Income.l1 -0.24648 0.07551 -3.264 0.00131 **
## Production.l1 -0.07040 0.04988 -1.411 0.15985
## const 0.48015 0.10290 4.666 5.94e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.8769 on 182 degrees of freedom
## Multiple R-Squared: 0.1322, Adjusted R-squared: 0.1179
## F-statistic: 9.239 on 3 and 182 DF, p-value: 1.016e-05
##
##
## Estimation results for equation Production:
## ===========================================
## Production = Consumption.l1 + Income.l1 + Production.l1 + const
##
## Estimate Std. Error t value Pr(>|t|)
## Consumption.l1 0.81261 0.16413 4.951 1.68e-06 ***
## Income.l1 -0.03901 0.10062 -0.388 0.6987
## Production.l1 0.40148 0.06647 6.040 8.47e-09 ***
## const -0.25872 0.13711 -1.887 0.0608 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 1.168 on 182 degrees of freedom
## Multiple R-Squared: 0.4289, Adjusted R-squared: 0.4195
## F-statistic: 45.55 on 3 and 182 DF, p-value: < 2.2e-16
##
##
##
## Covariance matrix of residuals:
## Consumption Income Production
## Consumption 0.3784 0.2091 0.3674
## Income 0.2091 0.7690 0.2493
## Production 0.3674 0.2493 1.3653
##
## Correlation matrix of residuals:
## Consumption Income Production
## Consumption 1.0000 0.3876 0.5112
## Income 0.3876 1.0000 0.2433
## Production 0.5112 0.2433 1.0000
#Aqui nos dice: Las variables endogenas que estamos utilizando que son Consumption, Income y production
# La unica variable determinista que es una constante
# El tamaƱo de la muestra qu eson 186 datos
# El criterio parecido al AIC nos da -656.238 , mientras menor mejor
# Las raices de las caracterisicas polinomial tenemos 0.418 0.418 0.3474. como
# no son 1 (maximo es 1) nos dice que nuestro modelo es estacionario.
#CREACION DE LA MATRIZ
#Setting the Restrictions
amat <- diag(3)
amat[2,1] <- NA
amat[3,1] <- NA
amat[3,2] <- NA
amat
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] NA 1 0
## [3,] NA NA 1
#Buidling the Model
#Ahora ordenamos las variables segĆŗn el efecto que tiene sobre otra
#aqui se propone el orden
y <-uschange[,1]
pi <-uschange[,2]
r <-uschange[,3]
sv <- cbind(y,pi, r)
colnames(sv) <- cbind( "Consumption", "Income", "Production")
lagselect <- VARselect(sv, lag.max = 8, type = "both")
#ahora miramos cual podemos usar como mejor opcion , recordando que los mas aconsejables son HQ(n) SC(n)
lagselect$selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 3 1 1 3
lagselect$criteria
## 1 2 3 4 5 6
## AIC(n) -1.3184819 -1.3708598 -1.4027937 -1.3916342 -1.3945572 -1.3370508
## HQ(n) -1.2101753 -1.1975691 -1.1645190 -1.0883755 -1.0263145 -0.9038241
## SC(n) -1.0513826 -0.9435008 -0.8151751 -0.6437560 -0.4864194 -0.2686533
## FPE(n) 0.2675528 0.2539340 0.2460234 0.2489075 0.2483703 0.2633582
## 7 8
## AIC(n) -1.3370800 -1.31126773
## HQ(n) -0.8388692 -0.74807298
## SC(n) -0.1084229 0.07764899
## FPE(n) 0.2637392 0.27115628
#aqui creamos con valor P=1 por el inciso anterior
Model1 <- VAR(sv, p = 1, season = NULL, exog = NULL, type = "const")
#AQUI MIRAMOS PARA VER SI SON CAUSALES CON LA PRUEBA DE GRANGER
#GRANGER menor que 0.05 para que exista causalidad
GrangerConsumption <-causality(Model1, cause = 'Consumption')
GrangerConsumption
## $Granger
##
## Granger causality H0: Consumption do not Granger-cause Income
## Production
##
## data: VAR object Model1
## F-Test = 19.441, df1 = 2, df2 = 546, p-value = 6.982e-09
##
##
## $Instant
##
## H0: No instantaneous causality between: Consumption and Income
## Production
##
## data: VAR object Model1
## Chi-squared = 46.671, df = 2, p-value = 7.336e-11
# aqui no es causal
GrangerIncome <-causality(Model1, cause = 'Income')
GrangerIncome
## $Granger
##
## Granger causality H0: Income do not Granger-cause Consumption
## Production
##
## data: VAR object Model1
## F-Test = 2.7691, df1 = 2, df2 = 546, p-value = 0.0636
##
##
## $Instant
##
## H0: No instantaneous causality between: Income and Consumption
## Production
##
## data: VAR object Model1
## Chi-squared = 24.678, df = 2, p-value = 4.377e-06
# aqui es causal
GrangerProduction <-causality(Model1, cause = 'Production')
GrangerProduction
## $Granger
##
## Granger causality H0: Production do not Granger-cause Consumption
## Income
##
## data: VAR object Model1
## F-Test = 1.066, df1 = 2, df2 = 546, p-value = 0.3451
##
##
## $Instant
##
## H0: No instantaneous causality between: Production and Consumption
## Income
##
## data: VAR object Model1
## Chi-squared = 38.816, df = 2, p-value = 3.727e-09
# aqui es causal
#ahora debemos saber cual es causal de cual
SVARMod1 <- SVAR(Model1, Amat = amat, Bmat = NULL, hessian = TRUE, estmethod =
c("scoring", "direct"))
SVARMod1
##
## SVAR Estimation Results:
## ========================
##
##
## Estimated A matrix:
## Consumption Income Production
## Consumption 1.0000 0.00000 0
## Income -0.5526 1.00000 0
## Production -0.9320 -0.07075 1
#Aqui esta nuestra matriz. se lee que por cada unidad que Consumption se mueva, Income se mueve 0.2111 unidades
#AHORA VAMOS A VALIDAR SI ES REAL O NO SIRVEN LAS INTERACCIONES.
#Impulse Response Functions
#no tiene va en respuesta y la que si tiene en impulso
SVARog <- irf(SVARMod1, impulse = "Income", response = "Consumption", n.ahead = 50)
SVARog
##
## Impulse response coefficients
## $Income
## Consumption
## [1,] 0.000000e+00
## [2,] 9.467259e-02
## [3,] 5.027863e-03
## [4,] 1.233815e-02
## [5,] 4.630068e-04
## [6,] 1.214341e-03
## [7,] -1.411214e-04
## [8,] 3.555339e-05
## [9,] -7.229003e-05
## [10,] -2.093060e-05
## [11,] -1.944287e-05
## [12,] -6.774348e-06
## [13,] -3.905290e-06
## [14,] -1.334068e-06
## [15,] -6.161635e-07
## [16,] -1.877282e-07
## [17,] -7.064740e-08
## [18,] -1.498510e-08
## [19,] -2.981239e-09
## [20,] 1.329536e-09
## [21,] 1.205567e-09
## [22,] 8.764141e-10
## [23,] 4.501993e-10
## [24,] 2.267679e-10
## [25,] 9.881326e-11
## [26,] 4.215141e-11
## [27,] 1.609343e-11
## [28,] 5.870486e-12
## [29,] 1.846745e-12
## [30,] 4.945152e-13
## [31,] 6.676640e-14
## [32,] -2.900571e-14
## [33,] -3.629051e-14
## [34,] -2.382112e-14
## [35,] -1.304240e-14
## [36,] -6.320562e-15
## [37,] -2.843318e-15
## [38,] -1.185882e-15
## [39,] -4.630740e-16
## [40,] -1.660569e-16
## [41,] -5.346010e-17
## [42,] -1.407427e-17
## [43,] -2.057557e-18
## [44,] 8.077811e-19
## [45,] 1.008031e-18
## [46,] 6.742162e-19
## [47,] 3.679190e-19
## [48,] 1.794895e-19
## [49,] 8.062028e-20
## [50,] 3.376855e-20
## [51,] 1.317960e-20
##
##
## Lower Band, CI= 0.95
## $Income
## Consumption
## [1,] -5.062006e-18
## [2,] 6.201011e-03
## [3,] -2.131180e-02
## [4,] -6.662065e-04
## [5,] -1.113931e-02
## [6,] -2.646297e-03
## [7,] -3.926346e-03
## [8,] -1.512641e-03
## [9,] -1.138994e-03
## [10,] -3.288468e-04
## [11,] -2.238131e-04
## [12,] -3.509901e-05
## [13,] -6.127530e-05
## [14,] -8.634310e-06
## [15,] -1.631180e-05
## [16,] -1.635900e-06
## [17,] -5.028416e-06
## [18,] -5.420286e-07
## [19,] -1.679246e-06
## [20,] -1.827706e-07
## [21,] -4.089595e-07
## [22,] -5.420308e-08
## [23,] -1.363491e-07
## [24,] -1.481409e-08
## [25,] -3.445701e-08
## [26,] -1.617319e-09
## [27,] -1.243247e-08
## [28,] -1.798666e-09
## [29,] -3.731825e-09
## [30,] -1.489091e-10
## [31,] -8.432223e-10
## [32,] -3.264995e-11
## [33,] -1.541538e-10
## [34,] -1.057934e-11
## [35,] -5.927045e-11
## [36,] -2.735008e-12
## [37,] -2.065625e-11
## [38,] -1.638496e-12
## [39,] -7.851412e-12
## [40,] -1.737732e-12
## [41,] -2.712716e-12
## [42,] -4.672303e-14
## [43,] -6.724054e-13
## [44,] -1.195588e-14
## [45,] -1.472033e-13
## [46,] -4.215910e-15
## [47,] -2.495273e-14
## [48,] -1.785285e-15
## [49,] -1.243512e-14
## [50,] -3.274190e-16
## [51,] -3.614846e-15
##
##
## Upper Band, CI= 0.95
## $Income
## Consumption
## [1,] 1.888884e-17
## [2,] 2.082164e-01
## [3,] 2.619550e-02
## [4,] 4.259439e-02
## [5,] 8.554227e-03
## [6,] 9.205994e-03
## [7,] 2.497570e-03
## [8,] 2.135572e-03
## [9,] 8.181681e-04
## [10,] 6.701461e-04
## [11,] 3.902319e-04
## [12,] 2.919502e-04
## [13,] 1.186092e-04
## [14,] 7.420099e-05
## [15,] 3.592112e-05
## [16,] 2.310459e-05
## [17,] 1.412549e-05
## [18,] 8.743510e-06
## [19,] 5.050286e-06
## [20,] 3.053303e-06
## [21,] 1.877306e-06
## [22,] 1.156061e-06
## [23,] 7.129941e-07
## [24,] 4.403948e-07
## [25,] 2.724157e-07
## [26,] 1.687488e-07
## [27,] 1.046766e-07
## [28,] 6.501906e-08
## [29,] 4.043838e-08
## [30,] 2.518191e-08
## [31,] 1.570017e-08
## [32,] 9.799858e-09
## [33,] 6.123688e-09
## [34,] 3.830563e-09
## [35,] 2.398540e-09
## [36,] 1.503297e-09
## [37,] 9.430500e-10
## [38,] 5.921018e-10
## [39,] 3.720569e-10
## [40,] 2.339668e-10
## [41,] 1.472353e-10
## [42,] 9.271796e-11
## [43,] 5.842419e-11
## [44,] 3.683676e-11
## [45,] 2.323880e-11
## [46,] 1.466812e-11
## [47,] 9.262936e-12
## [48,] 5.852246e-12
## [49,] 3.698988e-12
## [50,] 2.338930e-12
## [51,] 1.479496e-12
plot(SVARog)
#despues de 50 ciclos podemos ver que si se estabilizo
SVARinf <- irf(SVARMod1, impulse = "Production", response = "Consumption", n.ahead = 20)
SVARinf
##
## Impulse response coefficients
## $Production
## Consumption
## [1,] 0.000000e+00
## [2,] -7.064414e-03
## [3,] -1.169177e-02
## [4,] -6.127446e-03
## [5,] -3.628504e-03
## [6,] -1.608674e-03
## [7,] -7.524655e-04
## [8,] -2.963185e-04
## [9,] -1.183755e-04
## [10,] -4.017054e-05
## [11,] -1.303207e-05
## [12,] -3.064855e-06
## [13,] -3.519346e-07
## [14,] 3.045251e-07
## [15,] 2.888689e-07
## [16,] 1.865157e-07
## [17,] 9.792102e-08
## [18,] 4.727063e-08
## [19,] 2.079743e-08
## [20,] 8.631029e-09
## [21,] 3.304266e-09
##
##
## Lower Band, CI= 0.95
## $Production
## Consumption
## [1,] 0.000000e+00
## [2,] -7.709058e-02
## [3,] -6.545712e-02
## [4,] -3.766562e-02
## [5,] -1.694574e-02
## [6,] -8.136338e-03
## [7,] -3.437458e-03
## [8,] -1.140810e-03
## [9,] -3.554691e-04
## [10,] -1.299125e-04
## [11,] -8.490778e-05
## [12,] -3.098921e-05
## [13,] -2.158384e-05
## [14,] -1.056082e-05
## [15,] -5.072481e-06
## [16,] -5.180487e-06
## [17,] -3.514441e-06
## [18,] -1.960588e-06
## [19,] -8.932706e-07
## [20,] -3.485802e-07
## [21,] -1.468092e-07
##
##
## Upper Band, CI= 0.95
## $Production
## Consumption
## [1,] 0.000000e+00
## [2,] 4.906278e-02
## [3,] 3.367654e-02
## [4,] 2.375605e-02
## [5,] 1.417688e-02
## [6,] 8.810078e-03
## [7,] 5.169654e-03
## [8,] 3.345852e-03
## [9,] 1.845079e-03
## [10,] 1.125784e-03
## [11,] 6.869756e-04
## [12,] 4.240621e-04
## [13,] 2.596108e-04
## [14,] 1.598713e-04
## [15,] 9.805904e-05
## [16,] 6.032766e-05
## [17,] 3.704460e-05
## [18,] 2.278351e-05
## [19,] 1.400051e-05
## [20,] 8.610777e-06
## [21,] 5.294064e-06
plot(SVARinf)
#despues de 20 ciclos podemos ver que si se estabilizo
SVARrrp <- irf(SVARMod1, impulse = "Income", response = "Production", n.ahead = 20)
SVARrrp
##
## Impulse response coefficients
## $Income
## Production
## [1,] 7.075305e-02
## [2,] -1.059968e-02
## [3,] 8.248405e-02
## [4,] 3.253425e-02
## [5,] 2.434659e-02
## [6,] 9.640528e-03
## [7,] 5.038987e-03
## [8,] 1.861548e-03
## [9,] 8.049406e-04
## [10,] 2.616292e-04
## [11,] 9.262320e-05
## [12,] 2.146363e-05
## [13,] 3.803572e-06
## [14,] -1.599002e-06
## [15,] -1.635689e-06
## [16,] -1.152759e-06
## [17,] -6.065361e-07
## [18,] -3.018543e-07
## [19,] -1.331421e-07
## [20,] -5.640810e-08
## [21,] -2.173062e-08
##
##
## Lower Band, CI= 0.95
## $Income
## Production
## [1,] -9.328701e-02
## [2,] -2.195686e-01
## [3,] -6.195336e-03
## [4,] -2.144223e-02
## [5,] -1.670578e-03
## [6,] -2.249074e-03
## [7,] -1.217188e-03
## [8,] -1.383090e-03
## [9,] -9.125341e-04
## [10,] -4.840558e-04
## [11,] -3.041865e-04
## [12,] -2.101203e-04
## [13,] -1.142417e-04
## [14,] -5.279443e-05
## [15,] -1.990178e-05
## [16,] -9.316466e-06
## [17,] -5.196006e-06
## [18,] -2.336318e-06
## [19,] -1.073843e-06
## [20,] -4.926638e-07
## [21,] -1.753654e-07
##
##
## Upper Band, CI= 0.95
## $Income
## Production
## [1,] 3.356218e-01
## [2,] 2.395690e-01
## [3,] 1.392235e-01
## [4,] 7.919507e-02
## [5,] 4.918986e-02
## [6,] 2.430354e-02
## [7,] 1.429181e-02
## [8,] 7.685309e-03
## [9,] 4.328684e-03
## [10,] 2.398165e-03
## [11,] 1.402229e-03
## [12,] 8.087351e-04
## [13,] 4.703944e-04
## [14,] 2.733757e-04
## [15,] 1.597690e-04
## [16,] 9.329766e-05
## [17,] 5.450819e-05
## [18,] 3.183707e-05
## [19,] 1.859859e-05
## [20,] 1.086394e-05
## [21,] 6.346340e-06
plot(SVARrrp)
#despues de 20 ciclos podemos ver que si se estabilizo
SVARrr <- irf(SVARMod1, impulse = "Production", response = "Income", n.ahead = 20)
SVARrr
##
## Impulse response coefficients
## $Production
## Income
## [1,] 0.000000e+00
## [2,] -7.040090e-02
## [3,] -1.515957e-02
## [4,] -1.442965e-02
## [5,] -3.971326e-03
## [6,] -2.435043e-03
## [7,] -6.650750e-04
## [8,] -3.228060e-04
## [9,] -7.115193e-05
## [10,] -2.655184e-05
## [11,] -1.579359e-07
## [12,] 1.434370e-06
## [13,] 2.254806e-06
## [14,] 1.198910e-06
## [15,] 7.033205e-07
## [16,] 3.136942e-07
## [17,] 1.460370e-07
## [18,] 5.772040e-08
## [19,] 2.298121e-08
## [20,] 7.821890e-09
## [21,] 2.528966e-09
##
##
## Lower Band, CI= 0.95
## $Production
## Income
## [1,] 0.000000e+00
## [2,] -1.611116e-01
## [3,] -6.276728e-02
## [4,] -4.356158e-02
## [5,] -1.491102e-02
## [6,] -7.909657e-03
## [7,] -2.148055e-03
## [8,] -1.279488e-03
## [9,] -4.687214e-04
## [10,] -3.078287e-04
## [11,] -1.006752e-04
## [12,] -4.424519e-05
## [13,] -2.051031e-05
## [14,] -1.565816e-05
## [15,] -9.915233e-06
## [16,] -6.562554e-06
## [17,] -3.698015e-06
## [18,] -2.146488e-06
## [19,] -1.125781e-06
## [20,] -4.733965e-07
## [21,] -1.743803e-07
##
##
## Upper Band, CI= 0.95
## $Production
## Income
## [1,] 0.000000e+00
## [2,] 3.130467e-02
## [3,] 2.656662e-02
## [4,] 1.395827e-02
## [5,] 9.430819e-03
## [6,] 4.912797e-03
## [7,] 3.303403e-03
## [8,] 1.930338e-03
## [9,] 1.357466e-03
## [10,] 8.443139e-04
## [11,] 5.273360e-04
## [12,] 3.069269e-04
## [13,] 1.695474e-04
## [14,] 9.703698e-05
## [15,] 5.895399e-05
## [16,] 3.576869e-05
## [17,] 2.172017e-05
## [18,] 1.318435e-05
## [19,] 8.005506e-06
## [20,] 4.860551e-06
## [21,] 2.951497e-06
plot(SVARrr)
#despues de 20 ciclos podemos ver que si se estabilizo
#Forecast Error Variance Decomposition
SVARfevd <- fevd(SVARMod1, n.ahead = 20)
SVARfevd
## $Consumption
## Consumption Income Production
## [1,] 1.0000000 0.000000000 0.000000e+00
## [2,] 0.9920388 0.007917102 4.408288e-05
## [3,] 0.9920280 0.007809874 1.621407e-04
## [4,] 0.9918753 0.007930233 1.944721e-04
## [5,] 0.9918647 0.007929463 2.058702e-04
## [6,] 0.9918612 0.007930707 2.081142e-04
## [7,] 0.9918607 0.007930717 2.086051e-04
## [8,] 0.9918606 0.007930712 2.086812e-04
## [9,] 0.9918606 0.007930714 2.086932e-04
## [10,] 0.9918606 0.007930714 2.086946e-04
## [11,] 0.9918606 0.007930714 2.086948e-04
## [12,] 0.9918606 0.007930714 2.086948e-04
## [13,] 0.9918606 0.007930714 2.086948e-04
## [14,] 0.9918606 0.007930714 2.086948e-04
## [15,] 0.9918606 0.007930714 2.086948e-04
## [16,] 0.9918606 0.007930714 2.086948e-04
## [17,] 0.9918606 0.007930714 2.086948e-04
## [18,] 0.9918606 0.007930714 2.086948e-04
## [19,] 0.9918606 0.007930714 2.086948e-04
## [20,] 0.9918606 0.007930714 2.086948e-04
##
## $Income
## Consumption Income Production
## [1,] 0.2339015 0.7660985 0.000000000
## [2,] 0.3022299 0.6945325 0.003237589
## [3,] 0.2997938 0.6968523 0.003353869
## [4,] 0.2997763 0.6967391 0.003484588
## [5,] 0.2997914 0.6967145 0.003494098
## [6,] 0.2997946 0.6967075 0.003497822
## [7,] 0.2998034 0.6966986 0.003498058
## [8,] 0.2998049 0.6966970 0.003498116
## [9,] 0.2998054 0.6966965 0.003498116
## [10,] 0.2998055 0.6966964 0.003498116
## [11,] 0.2998055 0.6966964 0.003498116
## [12,] 0.2998055 0.6966964 0.003498116
## [13,] 0.2998055 0.6966964 0.003498116
## [14,] 0.2998055 0.6966964 0.003498116
## [15,] 0.2998055 0.6966964 0.003498116
## [16,] 0.2998055 0.6966964 0.003498116
## [17,] 0.2998055 0.6966964 0.003498116
## [18,] 0.2998055 0.6966964 0.003498116
## [19,] 0.2998055 0.6966964 0.003498116
## [20,] 0.2998055 0.6966964 0.003498116
##
## $Production
## Consumption Income Production
## [1,] 0.4840790 0.002569833 0.5133512
## [2,] 0.6671361 0.001460783 0.3314032
## [3,] 0.7069721 0.002915772 0.2901122
## [4,] 0.7177697 0.003047390 0.2791829
## [5,] 0.7201145 0.003157714 0.2767277
## [6,] 0.7205968 0.003173565 0.2762296
## [7,] 0.7206778 0.003178472 0.2761437
## [8,] 0.7206901 0.003179127 0.2761307
## [9,] 0.7206916 0.003179258 0.2761291
## [10,] 0.7206918 0.003179272 0.2761289
## [11,] 0.7206918 0.003179274 0.2761289
## [12,] 0.7206918 0.003179274 0.2761289
## [13,] 0.7206918 0.003179274 0.2761289
## [14,] 0.7206918 0.003179274 0.2761289
## [15,] 0.7206918 0.003179274 0.2761289
## [16,] 0.7206918 0.003179274 0.2761289
## [17,] 0.7206918 0.003179274 0.2761289
## [18,] 0.7206918 0.003179274 0.2761289
## [19,] 0.7206918 0.003179274 0.2761289
## [20,] 0.7206918 0.003179274 0.2761289
plot(SVARfevd)
#no hay varianza generado en el consumption.
#En Income si afecta consumption un 15% a 20%.
#Abajo en production si hay efecto de casi un 80% de consumption.
autoplot(forecast(Model1))
#AquĆ con el modelo estructural nos da un comportamieinto horizontal como pronostico.