Simulación del Modelo VAR

Serie: Agricultura, ganadería, caza, silvicultura y pesca & Explotación de minas y canteras

Se cargan las liberías necesarias para trabajar modelos VAR

library(vars)
library(forecast)
library(car)
library(tseries)
library(urca)
library(readxl)

Se procede a crear el objeto de trabajo

data <- read_excel("~/Series de Tiempo/Multivariada/Taller 1.xlsx")
View(data)

Graficando las series

par(mfrow=c(1,2))
plot.ts(data$Agropecuaria, main= "Agropecuaria", ylab="", xlab="")
plot.ts(data$`Explotacion mc`, main= "Explotacion mc", ylab="", xlab="")

par(mfrow=c(1,1))

Dar formato a la serie de tiempo

  1. Para Agropecuaria
agro=ts(data[,3],freq=4)
agro
##         Qtr1      Qtr2      Qtr3      Qtr4
## 1   5851.407  6234.029  6792.167  6561.396
## 2   6079.042  6508.167  7552.915  7284.876
## 3   6793.362  7021.584  8126.768  7773.286
## 4   7447.905  7384.270  8902.276  8134.549
## 5   7902.048  8102.346  9224.480  8325.126
## 6   7785.010  8208.667  9314.265  9103.058
## 7   9154.131  8835.691  9975.994  9743.184
## 8   9055.488  9007.215 10116.487  9029.810
## 9   8885.503  9954.775 10416.933  9251.789
## 10  9598.004 10210.468 10918.279 10828.249
## 11 11150.806 11183.750 12948.349 12841.096
## 12 13147.359 13508.151 15333.027 15076.463
## 13 14418.331 13804.086 15647.191 14945.391
## 14 14692.306 14814.137 16361.709 15628.848
## 15 15275.540 16113.673 18734.911 17833.876
## 16 17941.993 17585.231 19888.453 19554.323
## 17 20223.513 21372.156 24369.462 26713.868
## 18 30214.925 31262.462 34467.353 34494.261
## 19 35386.036 33115.546 34183.143 34686.244
  1. Para Explotacion mc
exp=ts(data[,4], freq=4)
exp
##         Qtr1      Qtr2      Qtr3      Qtr4
## 1   4995.062  5524.756  5773.560  5777.623
## 2   5837.665  6790.322  7059.576  6439.437
## 3   6151.134  5784.494  6805.799  7701.573
## 4   8454.959  9238.138 11329.058  9652.845
## 5   7917.920  9027.861  9624.817 10663.402
## 6  10769.083 11970.514 11360.188 13005.215
## 7  14590.999 18299.920 17668.955 19988.127
## 8  18391.611 19646.975 17337.367 19181.047
## 9  17673.115 18795.246 18563.725 18307.914
## 10 16753.599 15855.876 16211.440 15453.085
## 11 11739.242 11952.500 12507.875 11427.383
## 12  9007.123  9728.128 10280.523 11983.226
## 13 10799.923 10998.750 11857.333 13881.994
## 14 12993.736 14141.353 15078.667 15574.244
## 15 13501.455 14817.421 14386.995 15611.129
## 16 11706.436  7373.263 10226.906 11382.394
## 17 12074.851 14007.317 16948.160 21204.672
## 18 21406.322 26747.533 29916.998 28078.146
## 19 24199.383 21032.294 21220.098 20472.020

Se transforma la serie en Logaritmos

  1. Para Agropecuaria
lagro=log(agro)
lagro
##         Qtr1      Qtr2      Qtr3      Qtr4
## 1   8.674437  8.737778  8.823525  8.788959
## 2   8.712602  8.780813  8.929689  8.893556
## 3   8.823701  8.856744  9.002919  8.958448
## 4   8.915688  8.907107  9.094062  9.003876
## 5   8.974877  8.999909  9.129616  9.027033
## 6   8.959955  9.012946  9.139302  9.116366
## 7   9.121961  9.086555  9.207937  9.184323
## 8   9.111126  9.105781  9.221922  9.108287
## 9   9.092176  9.205808  9.251188  9.132572
## 10  9.169310  9.231169  9.298194  9.289914
## 11  9.319267  9.322217  9.468724  9.460406
## 12  9.483976  9.511049  9.637764  9.620890
## 13  9.576256  9.532720  9.658047  9.612158
## 14  9.595079  9.603337  9.702699  9.656874
## 15  9.634008  9.687423  9.838144  9.788855
## 16  9.794899  9.774815  9.897895  9.880952
## 17  9.914601  9.969844 10.101086 10.192938
## 18 10.316091 10.350173 10.447768 10.448548
## 19 10.474073 10.407758 10.439488 10.454098
  1. Para Explotacion mc
lexp=log(exp)
lexp
##         Qtr1      Qtr2      Qtr3      Qtr4
## 1   8.516205  8.616994  8.661044  8.661748
## 2   8.672086  8.823254  8.862140  8.770196
## 3   8.724392  8.662936  8.825530  8.949180
## 4   9.042508  9.131096  9.335126  9.175008
## 5   8.976884  9.108071  9.172100  9.274573
## 6   9.284435  9.390202  9.337870  9.473106
## 7   9.588160  9.814652  9.779564  9.902894
## 8   9.819650  9.885679  9.760619  9.861678
## 9   9.779800  9.841359  9.828965  9.815089
## 10  9.726368  9.671295  9.693472  9.645564
## 11  9.370693  9.388696  9.434114  9.343768
## 12  9.105771  9.182777  9.238006  9.391263
## 13  9.287294  9.305537  9.380702  9.538348
## 14  9.472223  9.556859  9.621036  9.653374
## 15  9.510553  9.603559  9.574080  9.655739
## 16  9.367894  8.905616  9.232777  9.339823
## 17  9.398880  9.547335  9.737915  9.961977
## 18  9.971442 10.194198 10.306182 10.242747
## 19 10.094082  9.953814  9.962704  9.926814

Se procede a graficar

ts.plot(lagro, lexp, col=c("blue", "red"))

Pruebas de raiz unitaria para Agropecuaria

Ho:= 0 La serie es no Estacionaria (Hay raíz unitaria) H1:≠ 0 La series es Estacionaria (No hay raíz unitaria)

  1. Para aplicar la prueba ADF sin constante ni tendencia
adf1_lagro=summary(ur.df(lagro, lags = 1))
adf1_lagro
## 
## ############################################### 
## # 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.13862 -0.05480 -0.01296  0.06453  0.16067 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## z.lag.1     0.0028220  0.0009572   2.948  0.00431 **
## z.diff.lag -0.1344589  0.1168487  -1.151  0.25366   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07359 on 72 degrees of freedom
## Multiple R-squared:  0.1083, Adjusted R-squared:  0.08352 
## F-statistic: 4.372 on 2 and 72 DF,  p-value: 0.01615
## 
## 
## Value of test-statistic is: 2.9483 
## 
## Critical values for test statistics: 
##      1pct  5pct 10pct
## tau1 -2.6 -1.95 -1.61

La serie es Estacionaria, es decir, no hay raíz unitaria

  1. Para aplicar la prueba ADF con constante o derivada
adf2_lagro=summary(ur.df(lagro, type="drift", lags=12)) 
adf2_lagro
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression drift 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.071422 -0.032380  0.000191  0.025988  0.100971 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  -0.377351   0.214570  -1.759   0.0849 .
## z.lag.1       0.044152   0.024003   1.839   0.0719 .
## z.diff.lag1  -0.002999   0.148112  -0.020   0.9839  
## z.diff.lag2  -0.244361   0.145327  -1.681   0.0990 .
## z.diff.lag3   0.084069   0.148213   0.567   0.5732  
## z.diff.lag4   0.324470   0.149322   2.173   0.0346 *
## z.diff.lag5  -0.383953   0.160924  -2.386   0.0209 *
## z.diff.lag6  -0.149250   0.167209  -0.893   0.3764  
## z.diff.lag7  -0.344037   0.165257  -2.082   0.0426 *
## z.diff.lag8  -0.043132   0.171593  -0.251   0.8026  
## z.diff.lag9  -0.081109   0.168820  -0.480   0.6330  
## z.diff.lag10  0.004920   0.172234   0.029   0.9773  
## z.diff.lag11 -0.158305   0.160153  -0.988   0.3278  
## z.diff.lag12  0.188389   0.157494   1.196   0.2374  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.04626 on 49 degrees of freedom
## Multiple R-squared:  0.6784, Adjusted R-squared:  0.5931 
## F-statistic: 7.952 on 13 and 49 DF,  p-value: 3.327e-08
## 
## 
## Value of test-statistic is: 1.8394 2.691 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau2 -3.51 -2.89 -2.58
## phi1  6.70  4.71  3.86

La serie es No Estacionaria, hay raíz unitaria

  1. Para aplicar la prueba ADF con tendencia
adf3_lagro=summary(ur.df(lagro, type="trend", lags=1)) 
adf3_lagro
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.14878 -0.05296 -0.01425  0.05269  0.17327 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  1.003006   0.559971   1.791   0.0776 .
## z.lag.1     -0.115663   0.065207  -1.774   0.0804 .
## tt           0.002875   0.001437   2.001   0.0493 *
## z.diff.lag  -0.075912   0.121370  -0.625   0.5337  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07251 on 70 degrees of freedom
## Multiple R-squared:  0.07391,    Adjusted R-squared:  0.03422 
## F-statistic: 1.862 on 3 and 70 DF,  p-value: 0.1439
## 
## 
## Value of test-statistic is: -1.7738 4.3682 2.1485 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -4.04 -3.45 -3.15
## phi2  6.50  4.88  4.16
## phi3  8.73  6.49  5.47

La serie es No Estacionaria, hay raíz unitaria

Pruebas de raiz unitaria para Explotacion mc

adf1_lexp=summary(ur.df(lexp, lags = 1))
adf1_lexp
## 
## ############################################### 
## # 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.45158 -0.07490  0.01738  0.08729  0.35389 
## 
## Coefficients:
##            Estimate Std. Error t value Pr(>|t|)
## z.lag.1    0.001554   0.001666   0.933    0.354
## z.diff.lag 0.087744   0.117440   0.747    0.457
## 
## Residual standard error: 0.1338 on 72 degrees of freedom
## Multiple R-squared:  0.02273,    Adjusted R-squared:  -0.004416 
## F-statistic: 0.8373 on 2 and 72 DF,  p-value: 0.437
## 
## 
## Value of test-statistic is: 0.9327 
## 
## Critical values for test statistics: 
##      1pct  5pct 10pct
## tau1 -2.6 -1.95 -1.61

La serie es No Estacionaria, hay raíz unitaria

  1. Para aplicar la prueba ADF con constante o derivada
adf2_lexp=summary(ur.df(lexp, type="drift", lags=12)) 
adf2_lexp
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression drift 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47446 -0.06334  0.00949  0.07114  0.31061 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   1.12628    0.65904   1.709   0.0938 .
## z.lag.1      -0.11705    0.06954  -1.683   0.0987 .
## z.diff.lag1   0.12171    0.13814   0.881   0.3826  
## z.diff.lag2   0.03931    0.13588   0.289   0.7736  
## z.diff.lag3   0.04397    0.13444   0.327   0.7450  
## z.diff.lag4   0.22664    0.13394   1.692   0.0970 .
## z.diff.lag5  -0.01370    0.13923  -0.098   0.9220  
## z.diff.lag6  -0.04617    0.13921  -0.332   0.7416  
## z.diff.lag7  -0.02504    0.14048  -0.178   0.8592  
## z.diff.lag8   0.02117    0.13705   0.154   0.8779  
## z.diff.lag9  -0.14201    0.13683  -1.038   0.3044  
## z.diff.lag10 -0.08440    0.13878  -0.608   0.5459  
## z.diff.lag11 -0.08680    0.13946  -0.622   0.5365  
## z.diff.lag12  0.23439    0.13994   1.675   0.1003  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1366 on 49 degrees of freedom
## Multiple R-squared:  0.2481, Adjusted R-squared:  0.04857 
## F-statistic: 1.243 on 13 and 49 DF,  p-value: 0.2793
## 
## 
## Value of test-statistic is: -1.6833 1.8194 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau2 -3.51 -2.89 -2.58
## phi1  6.70  4.71  3.86

La serie es No Estacionaria, hay raíz unitaria

  1. Para aplicar la prueba ADF con tendencia
adf3_lexp=summary(ur.df(lexp, type="trend", lags=1)) 
adf3_lexp
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.47241 -0.05892  0.01326  0.09028  0.28668 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  1.0371954  0.4521557   2.294   0.0248 *
## z.lag.1     -0.1129334  0.0505381  -2.235   0.0286 *
## tt           0.0011282  0.0009705   1.163   0.2490  
## z.diff.lag   0.1317841  0.1169885   1.126   0.2638  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1308 on 70 degrees of freedom
## Multiple R-squared:  0.07647,    Adjusted R-squared:  0.03689 
## F-statistic: 1.932 on 3 and 70 DF,  p-value: 0.1323
## 
## 
## Value of test-statistic is: -2.2346 2.1032 2.6122 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -4.04 -3.45 -3.15
## phi2  6.50  4.88  4.16
## phi3  8.73  6.49  5.47

La serie es No Estacionaria, hay raíz unitaria

Cuántas diferencias se necesitan

ndiffs(lagro)
## [1] 1
ndiffs(lexp)
## [1] 1

Para que las variables sean Estacionarias se generan las primeras diferencias de las variables

  1. Para el lograritmo de la variable Agropecuaria
dlagro=diff(lagro)
dlagro
##             Qtr1          Qtr2          Qtr3          Qtr4
## 1                 0.0633406741  0.0857472320 -0.0345666181
## 2  -0.0763564154  0.0682108336  0.1488757606 -0.0361332430
## 3  -0.0698543987  0.0330427933  0.1461744708 -0.0444702251
## 4  -0.0427602485 -0.0085807515  0.1869549233 -0.0901866207
## 5  -0.0289983088  0.0250316704  0.1297070658 -0.1025826437
## 6  -0.0670780494  0.0529905092  0.1263564720 -0.0229366256
## 7   0.0055948475 -0.0354059880  0.1213823488 -0.0236137000
## 8  -0.0731969498 -0.0053450830  0.1161405848 -0.1136351684
## 9  -0.0161102009  0.1136311723  0.0453803231 -0.1186156283
## 10  0.0367381530  0.0618583498  0.0670248416 -0.0082799373
## 11  0.0293533468  0.0029500666  0.1465064888 -0.0083176678
## 12  0.0235702593  0.0270724280  0.1267158003 -0.0168743325
## 13 -0.0446343802 -0.0435357704  0.1253268081 -0.0458884611
## 14 -0.0170790241  0.0082579886  0.0993618531 -0.0458253841
## 15 -0.0228655460  0.0534152910  0.1507205280 -0.0492888965
## 16  0.0060441586 -0.0200845217  0.1230798635 -0.0169429058
## 17  0.0336495679  0.0552430224  0.1312418110  0.0918520612
## 18  0.1231531480  0.0340820848  0.0975944993  0.0007803752
## 19  0.0255243229 -0.0663144514  0.0317298096  0.0146105545
  1. Para el lograritmo de la variable de Explotacion mc
dlexp=diff(lexp)
dlexp
##             Qtr1          Qtr2          Qtr3          Qtr4
## 1                 0.1007892798  0.0440497271  0.0007034996
## 2   0.0103385573  0.1511674997  0.0388866529 -0.0919438696
## 3  -0.0458046233 -0.0614556405  0.1625941130  0.1236496203
## 4   0.0933284791  0.0885872888  0.2040305525 -0.1601182178
## 5  -0.1981241067  0.1311868064  0.0640294676  0.1024726200
## 6   0.0098618123  0.1057671379 -0.0523314630  0.1352354667
## 7   0.1150543507  0.2264918755 -0.0350875312  0.1233292822
## 8  -0.0832437882  0.0660287322 -0.1250592317  0.1010584993
## 9  -0.0818780644  0.0615593778 -0.0123945357 -0.0138760061
## 10 -0.0887202915 -0.0550729393  0.0221769648 -0.0479085089
## 11 -0.2748713848  0.0180031736  0.0454180456 -0.0903459729
## 12 -0.2379968052  0.0770057771  0.0552296468  0.1532567591
## 13 -0.1039688702  0.0182426605  0.0751648079  0.1576461185
## 14 -0.0661251937  0.0846359415  0.0641776491  0.0323375076
## 15 -0.1428210639  0.0930061453 -0.0294788927  0.0816593856
## 16 -0.2878452679 -0.4622784234  0.3271617488  0.1070456514
## 17  0.0590570949  0.1484549483  0.1905794347  0.2240622879
## 18  0.0094647610  0.2227559511  0.1119845701 -0.0634352763
## 19 -0.1486644264 -0.1402680658  0.0088897060 -0.0358896799

Para graficar las variables

ts.plot(dlagro, dlexp, col=c("blue", "red"))

Causalidad de Granger

  1. La Causalidad de Agropecuaria a la Explotacion mc
grangertest(dlagro~dlexp, order=1)
## Granger causality test
## 
## Model 1: dlagro ~ Lags(dlagro, 1:1) + Lags(dlexp, 1:1)
## Model 2: dlagro ~ Lags(dlagro, 1:1)
##   Res.Df Df      F Pr(>F)
## 1     71                 
## 2     72 -1 1.1233 0.2928

Se acepta la hipótesis nula, no hay causalidad

  1. La Causalidad de Explotacion mc a Agropecuaria
grangertest(dlexp~dlagro, order=1)
## Granger causality test
## 
## Model 1: dlexp ~ Lags(dlexp, 1:1) + Lags(dlagro, 1:1)
## Model 2: dlexp ~ Lags(dlexp, 1:1)
##   Res.Df Df      F Pr(>F)
## 1     71                 
## 2     72 -1 2.5989 0.1114

Se acepta la hipótesis nula, no hay causalidad

Creación del VAR

datos_var1=data.frame(dlagro,dlexp)

Para identificación del var

VARselect(datos_var1, lag.max=12)
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      7      4      4      7 
## 
## $criteria
##                    1             2             3             4             5
## AIC(n) -9.2023405240 -9.289857e+00 -9.250334e+00 -9.708977e+00 -9.672085e+00
## HQ(n)  -9.1220638227 -9.156062e+00 -9.063022e+00 -9.468147e+00 -9.377737e+00
## SC(n)  -8.9982324548 -8.949676e+00 -8.774082e+00 -9.096653e+00 -8.923688e+00
## FPE(n)  0.0001008177  9.241812e-05  9.625677e-05  6.097533e-05  6.347563e-05
##                    6             7             8             9            10
## AIC(n) -9.6693031657 -9.800565e+00 -9.724853e+00 -9.681258e+00 -9.589487e+00
## HQ(n)  -9.3214374602 -9.399181e+00 -9.269951e+00 -9.172839e+00 -9.027550e+00
## SC(n)  -8.7848348659 -8.780024e+00 -8.568240e+00 -8.388574e+00 -8.160730e+00
## FPE(n)  0.0000639583  5.646272e-05  6.144013e-05  6.490743e-05  7.216713e-05
##                   11            12
## AIC(n) -9.505777e+00 -9.498809e+00
## HQ(n)  -8.890322e+00 -8.829837e+00
## SC(n)  -7.940948e+00 -7.797909e+00
## FPE(n)  7.986615e-05  8.217909e-05

Para la estimación del Var con 4 rezagos

var1=VAR(datos_var1, p=4)
var1
## 
## VAR Estimation Results:
## ======================= 
## 
## Estimated coefficients for equation Agropecuaria: 
## ================================================= 
## Call:
## Agropecuaria = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + const 
## 
##   Agropecuaria.l1 Explotacion.mc.l1   Agropecuaria.l2 Explotacion.mc.l2 
##       -0.11647928        0.08869792       -0.16206667       -0.03606203 
##   Agropecuaria.l3 Explotacion.mc.l3   Agropecuaria.l4 Explotacion.mc.l4 
##       -0.03238018        0.01567407        0.65668543       -0.03351993 
##             const 
##        0.01475547 
## 
## 
## Estimated coefficients for equation Explotacion.mc: 
## =================================================== 
## Call:
## Explotacion.mc = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + const 
## 
##   Agropecuaria.l1 Explotacion.mc.l1   Agropecuaria.l2 Explotacion.mc.l2 
##       0.234992344       0.110568054      -0.446246828      -0.002063801 
##   Agropecuaria.l3 Explotacion.mc.l3   Agropecuaria.l4 Explotacion.mc.l4 
##      -0.010854719       0.017303019      -0.044216946       0.120591141 
##             const 
##       0.018256031

Para saber si el VAR satisface las codiciones de establidad

summary(var1)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: Agropecuaria, Explotacion.mc 
## Deterministic variables: const 
## Sample size: 71 
## Log Likelihood: 167.099 
## Roots of the characteristic polynomial:
## 0.9383 0.9383 0.9353 0.8205 0.6227 0.5953 0.5953 0.5211
## Call:
## VAR(y = datos_var1, p = 4)
## 
## 
## Estimation results for equation Agropecuaria: 
## ============================================= 
## Agropecuaria = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + const 
## 
##                    Estimate Std. Error t value Pr(>|t|)    
## Agropecuaria.l1   -0.116479   0.096463  -1.208   0.2318    
## Explotacion.mc.l1  0.088698   0.046519   1.907   0.0612 .  
## Agropecuaria.l2   -0.162067   0.097264  -1.666   0.1007    
## Explotacion.mc.l2 -0.036062   0.047697  -0.756   0.4525    
## Agropecuaria.l3   -0.032380   0.097909  -0.331   0.7420    
## Explotacion.mc.l3  0.015674   0.048182   0.325   0.7460    
## Agropecuaria.l4    0.656685   0.095950   6.844    4e-09 ***
## Explotacion.mc.l4 -0.033520   0.047429  -0.707   0.4824    
## const              0.014755   0.008477   1.741   0.0867 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.04893 on 62 degrees of freedom
## Multiple R-Squared: 0.6095,  Adjusted R-squared: 0.5591 
## F-statistic:  12.1 on 8 and 62 DF,  p-value: 3.155e-10 
## 
## 
## Estimation results for equation Explotacion.mc: 
## =============================================== 
## Explotacion.mc = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + const 
## 
##                    Estimate Std. Error t value Pr(>|t|)
## Agropecuaria.l1    0.234992   0.266948   0.880    0.382
## Explotacion.mc.l1  0.110568   0.128734   0.859    0.394
## Agropecuaria.l2   -0.446247   0.269167  -1.658    0.102
## Explotacion.mc.l2 -0.002064   0.131994  -0.016    0.988
## Agropecuaria.l3   -0.010855   0.270950  -0.040    0.968
## Explotacion.mc.l3  0.017303   0.133337   0.130    0.897
## Agropecuaria.l4   -0.044217   0.265529  -0.167    0.868
## Explotacion.mc.l4  0.120591   0.131255   0.919    0.362
## const              0.018256   0.023459   0.778    0.439
## 
## 
## Residual standard error: 0.1354 on 62 degrees of freedom
## Multiple R-Squared: 0.1219,  Adjusted R-squared: 0.008578 
## F-statistic: 1.076 on 8 and 62 DF,  p-value: 0.3918 
## 
## 
## 
## Covariance matrix of residuals:
##                Agropecuaria Explotacion.mc
## Agropecuaria       0.002394       0.001819
## Explotacion.mc     0.001819       0.018338
## 
## Correlation matrix of residuals:
##                Agropecuaria Explotacion.mc
## Agropecuaria         1.0000         0.2744
## Explotacion.mc       0.2744         1.0000

Grafica de la variable observada vs la estimación del modelo

plot(var1)

Para la estimación del VAR con 7 rezagos

var2=VAR(datos_var1, p=7)
var2
## 
## VAR Estimation Results:
## ======================= 
## 
## Estimated coefficients for equation Agropecuaria: 
## ================================================= 
## Call:
## Agropecuaria = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + Agropecuaria.l5 + Explotacion.mc.l5 + Agropecuaria.l6 + Explotacion.mc.l6 + Agropecuaria.l7 + Explotacion.mc.l7 + const 
## 
##   Agropecuaria.l1 Explotacion.mc.l1   Agropecuaria.l2 Explotacion.mc.l2 
##      -0.049328705       0.030761268      -0.145725052      -0.030481316 
##   Agropecuaria.l3 Explotacion.mc.l3   Agropecuaria.l4 Explotacion.mc.l4 
##       0.136230749       0.007345639       0.608388049      -0.027568798 
##   Agropecuaria.l5 Explotacion.mc.l5   Agropecuaria.l6 Explotacion.mc.l6 
##      -0.239199355       0.027228929      -0.038140790      -0.058074046 
##   Agropecuaria.l7 Explotacion.mc.l7             const 
##      -0.257503277      -0.115661723       0.025648139 
## 
## 
## Estimated coefficients for equation Explotacion.mc: 
## =================================================== 
## Call:
## Explotacion.mc = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + Agropecuaria.l5 + Explotacion.mc.l5 + Agropecuaria.l6 + Explotacion.mc.l6 + Agropecuaria.l7 + Explotacion.mc.l7 + const 
## 
##   Agropecuaria.l1 Explotacion.mc.l1   Agropecuaria.l2 Explotacion.mc.l2 
##       -0.06336405        0.18533637        0.07172444       -0.02576176 
##   Agropecuaria.l3 Explotacion.mc.l3   Agropecuaria.l4 Explotacion.mc.l4 
##       -0.15699760        0.01658256       -0.14358898        0.10255153 
##   Agropecuaria.l5 Explotacion.mc.l5   Agropecuaria.l6 Explotacion.mc.l6 
##        0.41110116       -0.09801244       -0.63514909       -0.10579092 
##   Agropecuaria.l7 Explotacion.mc.l7             const 
##        0.21775483       -0.01108679        0.02401488

Para saber si el VAR satisface las codiciones de establidad

summary(var2)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: Agropecuaria, Explotacion.mc 
## Deterministic variables: const 
## Sample size: 68 
## Log Likelihood: 174.935 
## Roots of the characteristic polynomial:
## 0.9806 0.9463 0.9463 0.8743 0.8743 0.8451 0.8451 0.7465 0.7465 0.7142 0.7142 0.6934 0.5448 0.5448
## Call:
## VAR(y = datos_var1, p = 7)
## 
## 
## Estimation results for equation Agropecuaria: 
## ============================================= 
## Agropecuaria = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + Agropecuaria.l5 + Explotacion.mc.l5 + Agropecuaria.l6 + Explotacion.mc.l6 + Agropecuaria.l7 + Explotacion.mc.l7 + const 
## 
##                    Estimate Std. Error t value Pr(>|t|)    
## Agropecuaria.l1   -0.049329   0.130253  -0.379  0.70641    
## Explotacion.mc.l1  0.030761   0.046964   0.655  0.51530    
## Agropecuaria.l2   -0.145725   0.125791  -1.158  0.25187    
## Explotacion.mc.l2 -0.030481   0.046579  -0.654  0.51568    
## Agropecuaria.l3    0.136231   0.124873   1.091  0.28023    
## Explotacion.mc.l3  0.007346   0.045469   0.162  0.87227    
## Agropecuaria.l4    0.608388   0.094834   6.415 3.93e-08 ***
## Explotacion.mc.l4 -0.027569   0.044724  -0.616  0.54026    
## Agropecuaria.l5   -0.239199   0.122159  -1.958  0.05549 .  
## Explotacion.mc.l5  0.027229   0.045223   0.602  0.54967    
## Agropecuaria.l6   -0.038141   0.125886  -0.303  0.76309    
## Explotacion.mc.l6 -0.058074   0.045672  -1.272  0.20908    
## Agropecuaria.l7   -0.257503   0.128943  -1.997  0.05097 .  
## Explotacion.mc.l7 -0.115662   0.047030  -2.459  0.01722 *  
## const              0.025648   0.008785   2.919  0.00514 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.04486 on 53 degrees of freedom
## Multiple R-Squared: 0.7028,  Adjusted R-squared: 0.6243 
## F-statistic: 8.952 on 14 and 53 DF,  p-value: 1.442e-09 
## 
## 
## Estimation results for equation Explotacion.mc: 
## =============================================== 
## Explotacion.mc = Agropecuaria.l1 + Explotacion.mc.l1 + Agropecuaria.l2 + Explotacion.mc.l2 + Agropecuaria.l3 + Explotacion.mc.l3 + Agropecuaria.l4 + Explotacion.mc.l4 + Agropecuaria.l5 + Explotacion.mc.l5 + Agropecuaria.l6 + Explotacion.mc.l6 + Agropecuaria.l7 + Explotacion.mc.l7 + const 
## 
##                   Estimate Std. Error t value Pr(>|t|)
## Agropecuaria.l1   -0.06336    0.39705  -0.160    0.874
## Explotacion.mc.l1  0.18534    0.14316   1.295    0.201
## Agropecuaria.l2    0.07172    0.38345   0.187    0.852
## Explotacion.mc.l2 -0.02576    0.14199  -0.181    0.857
## Agropecuaria.l3   -0.15700    0.38065  -0.412    0.682
## Explotacion.mc.l3  0.01658    0.13861   0.120    0.905
## Agropecuaria.l4   -0.14359    0.28908  -0.497    0.621
## Explotacion.mc.l4  0.10255    0.13633   0.752    0.455
## Agropecuaria.l5    0.41110    0.37238   1.104    0.275
## Explotacion.mc.l5 -0.09801    0.13785  -0.711    0.480
## Agropecuaria.l6   -0.63515    0.38374  -1.655    0.104
## Explotacion.mc.l6 -0.10579    0.13922  -0.760    0.451
## Agropecuaria.l7    0.21775    0.39306   0.554    0.582
## Explotacion.mc.l7 -0.01109    0.14336  -0.077    0.939
## const              0.02401    0.02678   0.897    0.374
## 
## 
## Residual standard error: 0.1368 on 53 degrees of freedom
## Multiple R-Squared: 0.2161,  Adjusted R-squared: 0.008975 
## F-statistic: 1.043 on 14 and 53 DF,  p-value: 0.4277 
## 
## 
## 
## Covariance matrix of residuals:
##                Agropecuaria Explotacion.mc
## Agropecuaria       0.002013       0.002181
## Explotacion.mc     0.002181       0.018703
## 
## Correlation matrix of residuals:
##                Agropecuaria Explotacion.mc
## Agropecuaria         1.0000         0.3555
## Explotacion.mc       0.3555         1.0000

Gráfica de la variable observada vs la estimación del modelo

plot(var2)

Prueba de Autocorrelación

seriala=serial.test(var1, lags.pt = 1, type="PT.asymptotic") 
seriala
## 
##  Portmanteau Test (asymptotic)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 2.0615, df = -12, p-value = NA
seriala$serial
## 
##  Portmanteau Test (asymptotic)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 2.0615, df = -12, p-value = NA

No hay autocorrelación

seriala2=serial.test(var2, lags.pt = 1, type="PT.asymptotic") 
seriala2
## 
##  Portmanteau Test (asymptotic)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 0.05655, df = -24, p-value = NA
seriala$serial
## 
##  Portmanteau Test (asymptotic)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 2.0615, df = -12, p-value = NA

No hay autocorrelación.

Prueba de normalidad

Ho:= 0 Los datos tienen una distribución normal H1:≠ 0 Los datos no tienen una distribución normal.

normalidad=normality.test(var1)
normalidad$jb.mul
## $JB
## 
##  JB-Test (multivariate)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 13.474, df = 4, p-value = 0.009178
## 
## 
## $Skewness
## 
##  Skewness only (multivariate)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 3.6807, df = 2, p-value = 0.1588
## 
## 
## $Kurtosis
## 
##  Kurtosis only (multivariate)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 9.793, df = 2, p-value = 0.007473

Se rechaza la hipótesis nula, los datos no siguen una distribución normal

normalidad=normality.test(var2)
normalidad
## $JB
## 
##  JB-Test (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 13.994, df = 4, p-value = 0.007313
## 
## 
## $Skewness
## 
##  Skewness only (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 0.79523, df = 2, p-value = 0.6719
## 
## 
## $Kurtosis
## 
##  Kurtosis only (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 13.199, df = 2, p-value = 0.001361
normalidad$jb.mul 
## $JB
## 
##  JB-Test (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 13.994, df = 4, p-value = 0.007313
## 
## 
## $Skewness
## 
##  Skewness only (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 0.79523, df = 2, p-value = 0.6719
## 
## 
## $Kurtosis
## 
##  Kurtosis only (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 13.199, df = 2, p-value = 0.001361

Se rechaza la hipotesis nula, los datos no siguen una distribución normal.

Prueba de Heterocedasticidad

arch1=arch.test(var1, lags.multi = 11)
arch1$arch.mul
## 
##  ARCH (multivariate)
## 
## data:  Residuals of VAR object var1
## Chi-squared = 110.38, df = 99, p-value = 0.2042

No rechazamos la hipótesis nula de homocedasticidad.

arch2=arch.test(var2, lags.multi = 11)
arch2$arch.mul
## 
##  ARCH (multivariate)
## 
## data:  Residuals of VAR object var2
## Chi-squared = 98.168, df = 99, p-value = 0.5047

No rechazamos la hipótesis nula de homocedasticidad.

Impulso respuesta

  1. Agropecuaria
var1_irflagro=irf(var1, response = "Agropecuaria", n.ahead = 8, boot=TRUE)
var1_irflagro
## 
## Impulse response coefficients
## $Agropecuaria
##       Agropecuaria
##  [1,]  0.048933582
##  [2,] -0.002403276
##  [3,] -0.007606399
##  [4,] -0.002130008
##  [5,]  0.033180002
##  [6,] -0.005130665
##  [7,] -0.008265067
##  [8,] -0.002404494
##  [9,]  0.024000507
## 
## $Explotacion.mc
##        Agropecuaria
##  [1,]  0.0000000000
##  [2,]  0.0115500271
##  [3,] -0.0047641845
##  [4,]  0.0005629827
##  [5,] -0.0042719129
##  [6,]  0.0094240078
##  [7,] -0.0041993066
##  [8,]  0.0002318796
##  [9,] -0.0036174179
## 
## 
## Lower Band, CI= 0.95 
## $Agropecuaria
##       Agropecuaria
##  [1,]  0.036902236
##  [2,] -0.012441183
##  [3,] -0.017510961
##  [4,] -0.009647965
##  [5,]  0.016775017
##  [6,] -0.015225798
##  [7,] -0.017182270
##  [8,] -0.012489786
##  [9,]  0.006898719
## 
## $Explotacion.mc
##        Agropecuaria
##  [1,]  0.0000000000
##  [2,]  0.0016250052
##  [3,] -0.0133143861
##  [4,] -0.0101868108
##  [5,] -0.0141067553
##  [6,]  0.0001746231
##  [7,] -0.0110061427
##  [8,] -0.0097367795
##  [9,] -0.0111569648
## 
## 
## Upper Band, CI= 0.95 
## $Agropecuaria
##       Agropecuaria
##  [1,]  0.052175835
##  [2,]  0.007824559
##  [3,]  0.002488309
##  [4,]  0.004111167
##  [5,]  0.036971442
##  [6,]  0.005108140
##  [7,]  0.003439030
##  [8,]  0.005400910
##  [9,]  0.029625902
## 
## $Explotacion.mc
##       Agropecuaria
##  [1,]  0.000000000
##  [2,]  0.021419955
##  [3,]  0.005610044
##  [4,]  0.009245500
##  [5,]  0.008447900
##  [6,]  0.016852281
##  [7,]  0.005818543
##  [8,]  0.007242308
##  [9,]  0.006278680
var2_irflagro=irf(var2, response = "Agropecuaria", n.ahead = 8, boot=TRUE)
var2_irflagro
## 
## Impulse response coefficients
## $Agropecuaria
##        Agropecuaria
##  [1,]  0.0448636134
##  [2,] -0.0007174729
##  [3,] -0.0077945992
##  [4,]  0.0068669998
##  [5,]  0.0264375073
##  [6,] -0.0132957738
##  [7,] -0.0107922857
##  [8,] -0.0064982253
##  [9,]  0.0148456254
## 
## $Explotacion.mc
##        Agropecuaria
##  [1,]  0.0000000000
##  [2,]  0.0039320335
##  [3,] -0.0033614622
##  [4,] -0.0001642422
##  [5,] -0.0022756932
##  [6,]  0.0052390864
##  [7,] -0.0103524498
##  [8,] -0.0163643233
##  [9,] -0.0021328332
## 
## 
## Lower Band, CI= 0.95 
## $Agropecuaria
##       Agropecuaria
##  [1,]  0.032152697
##  [2,] -0.009993696
##  [3,] -0.016254695
##  [4,] -0.002166663
##  [5,]  0.013692745
##  [6,] -0.020753792
##  [7,] -0.018399795
##  [8,] -0.015828654
##  [9,]  0.003907179
## 
## $Explotacion.mc
##       Agropecuaria
##  [1,]  0.000000000
##  [2,] -0.004002867
##  [3,] -0.011512113
##  [4,] -0.010216356
##  [5,] -0.012912990
##  [6,] -0.008353306
##  [7,] -0.018656507
##  [8,] -0.026089627
##  [9,] -0.010731872
## 
## 
## Upper Band, CI= 0.95 
## $Agropecuaria
##       Agropecuaria
##  [1,]  0.045155350
##  [2,]  0.007403791
##  [3,]  0.002672663
##  [4,]  0.015696600
##  [5,]  0.030888311
##  [6,] -0.002149194
##  [7,] -0.002494286
##  [8,]  0.008064482
##  [9,]  0.020818142
## 
## $Explotacion.mc
##        Agropecuaria
##  [1,]  0.0000000000
##  [2,]  0.0131070555
##  [3,]  0.0086710526
##  [4,]  0.0090318261
##  [5,]  0.0069016048
##  [6,]  0.0157357006
##  [7,]  0.0005273053
##  [8,] -0.0031718672
##  [9,]  0.0099112883
  1. Explotacion mc
var1_irflexp=irf(var1, response = "Explotacion.mc", n.ahead = 8, boot=TRUE)
var1_irflexp
## 
## Impulse response coefficients
## $Agropecuaria
##       Explotacion.mc
##  [1,]    0.037165164
##  [2,]    0.015608297
##  [3,]   -0.020752130
##  [4,]   -0.002929817
##  [5,]    0.005226933
##  [6,]    0.011043513
##  [7,]   -0.016995631
##  [8,]   -0.002083495
##  [9,]    0.002337911
## 
## $Explotacion.mc
##       Explotacion.mc
##  [1,]    0.130217564
##  [2,]    0.014397903
##  [3,]    0.004037373
##  [4,]   -0.003603863
##  [5,]    0.017678334
##  [6,]    0.002054126
##  [7,]    0.004940594
##  [8,]   -0.004757434
##  [9,]    0.003646190
## 
## 
## Lower Band, CI= 0.95 
## $Agropecuaria
##       Explotacion.mc
##  [1,]    0.004210812
##  [2,]   -0.018024630
##  [3,]   -0.047258100
##  [4,]   -0.027863106
##  [5,]   -0.014489904
##  [6,]   -0.008332958
##  [7,]   -0.034503189
##  [8,]   -0.018720217
##  [9,]   -0.012053107
## 
## $Explotacion.mc
##       Explotacion.mc
##  [1,]    0.089979130
##  [2,]   -0.017368868
##  [3,]   -0.026363264
##  [4,]   -0.029760311
##  [5,]   -0.012674823
##  [6,]   -0.013507886
##  [7,]   -0.006930073
##  [8,]   -0.013974596
##  [9,]   -0.005124317
## 
## 
## Upper Band, CI= 0.95 
## $Agropecuaria
##       Explotacion.mc
##  [1,]   0.0567501542
##  [2,]   0.0359369756
##  [3,]   0.0009401573
##  [4,]   0.0192919122
##  [5,]   0.0219839229
##  [6,]   0.0256844357
##  [7,]   0.0017504987
##  [8,]   0.0164270897
##  [9,]   0.0165068344
## 
## $Explotacion.mc
##       Explotacion.mc
##  [1,]    0.141814726
##  [2,]    0.038106403
##  [3,]    0.024296366
##  [4,]    0.023143585
##  [5,]    0.029508751
##  [6,]    0.015851411
##  [7,]    0.016205346
##  [8,]    0.006165826
##  [9,]    0.012466494
var2_irflexp=irf(var2, response = "Explotacion.mc", n.ahead = 8, boot=TRUE)
var2_irflexp
## 
## Impulse response coefficients
## $Agropecuaria
##       Explotacion.mc
##  [1,]    0.048619290
##  [2,]    0.006168182
##  [3,]    0.003153950
##  [4,]   -0.005369172
##  [5,]   -0.003311550
##  [6,]    0.014031713
##  [7,]   -0.028837964
##  [8,]   -0.006198269
##  [9,]    0.005157915
## 
## $Explotacion.mc
##       Explotacion.mc
##  [1,]   0.1278241693
##  [2,]   0.0236904672
##  [3,]   0.0008485799
##  [4,]   0.0021616353
##  [5,]   0.0130321696
##  [6,]  -0.0076295848
##  [7,]  -0.0158417742
##  [8,]  -0.0087750095
##  [9,]   0.0021497995
## 
## 
## Lower Band, CI= 0.95 
## $Agropecuaria
##       Explotacion.mc
##  [1,]    0.014239618
##  [2,]   -0.023227185
##  [3,]   -0.032055944
##  [4,]   -0.028312400
##  [5,]   -0.030341615
##  [6,]   -0.008064225
##  [7,]   -0.046076880
##  [8,]   -0.027066243
##  [9,]   -0.012664414
## 
## $Explotacion.mc
##       Explotacion.mc
##  [1,]    0.086234896
##  [2,]   -0.007638532
##  [3,]   -0.027751649
##  [4,]   -0.030452912
##  [5,]   -0.023372879
##  [6,]   -0.034729158
##  [7,]   -0.035065881
##  [8,]   -0.034330638
##  [9,]   -0.015753954
## 
## 
## Upper Band, CI= 0.95 
## $Agropecuaria
##       Explotacion.mc
##  [1,]    0.077873714
##  [2,]    0.033434359
##  [3,]    0.026486633
##  [4,]    0.025169686
##  [5,]    0.018907815
##  [6,]    0.032397043
##  [7,]   -0.001204125
##  [8,]    0.016603676
##  [9,]    0.024419467
## 
## $Explotacion.mc
##       Explotacion.mc
##  [1,]     0.13887572
##  [2,]     0.04501432
##  [3,]     0.02463708
##  [4,]     0.02345526
##  [5,]     0.03200839
##  [6,]     0.01387293
##  [7,]     0.01845361
##  [8,]     0.02113438
##  [9,]     0.01875317

Para graficar el impulso respuesta de Agropecuaria

plot(var1_irflagro)

plot(var2_irflagro)

Para graficar el impulso respuesta de Explotacion mc

plot(var1_irflexp)

plot(var2_irflexp)

Análisis de la descomposición de varianza

  1. Para Agropecuaria
var1_fevd_dlagro= fevd(var1, n.ahead = 50)$Agropecuaria
var1_fevd_dlagro
##       Agropecuaria Explotacion.mc
##  [1,]    1.0000000     0.00000000
##  [2,]    0.9473480     0.05265204
##  [3,]    0.9402881     0.05971190
##  [4,]    0.9402777     0.05972225
##  [5,]    0.9532757     0.04672427
##  [6,]    0.9316240     0.06837599
##  [7,]    0.9286393     0.07136065
##  [8,]    0.9287313     0.07126873
##  [9,]    0.9351048     0.06489518
## [10,]    0.9250615     0.07493854
## [11,]    0.9235905     0.07640947
## [12,]    0.9236468     0.07635320
## [13,]    0.9271316     0.07286838
## [14,]    0.9220263     0.07797372
## [15,]    0.9211905     0.07880952
## [16,]    0.9212133     0.07878666
## [17,]    0.9231987     0.07680135
## [18,]    0.9204796     0.07952037
## [19,]    0.9199617     0.08003828
## [20,]    0.9199681     0.08003190
## [21,]    0.9211229     0.07887708
## [22,]    0.9196420     0.08035804
## [23,]    0.9193059     0.08069411
## [24,]    0.9193067     0.08069332
## [25,]    0.9199850     0.08001496
## [26,]    0.9191709     0.08082908
## [27,]    0.9189482     0.08105182
## [28,]    0.9189482     0.08105179
## [29,]    0.9193479     0.08065214
## [30,]    0.9188997     0.08110027
## [31,]    0.9187510     0.08124896
## [32,]    0.9187518     0.08124824
## [33,]    0.9189869     0.08101309
## [34,]    0.9187412     0.08125877
## [35,]    0.9186420     0.08135802
## [36,]    0.9186434     0.08135656
## [37,]    0.9187813     0.08121874
## [38,]    0.9186477     0.08135235
## [39,]    0.9185817     0.08141834
## [40,]    0.9185835     0.08141650
## [41,]    0.9186638     0.08133616
## [42,]    0.9185920     0.08140797
## [43,]    0.9185484     0.08145160
## [44,]    0.9185503     0.08144973
## [45,]    0.9185968     0.08140321
## [46,]    0.9185588     0.08144119
## [47,]    0.9185301     0.08146986
## [48,]    0.9185318     0.08146818
## [49,]    0.9185586     0.08144142
## [50,]    0.9185389     0.08146111
var2_fevd_dlagro= fevd(var2, n.ahead = 50)$Agropecuaria
var2_fevd_dlagro
##       Agropecuaria Explotacion.mc
##  [1,]    1.0000000    0.000000000
##  [2,]    0.9923790    0.007621008
##  [3,]    0.9872617    0.012738308
##  [4,]    0.9875289    0.012471054
##  [5,]    0.9887920    0.011207994
##  [6,]    0.9805601    0.019439855
##  [7,]    0.9492104    0.050789587
##  [8,]    0.8790022    0.120997839
##  [9,]    0.8849442    0.115055767
## [10,]    0.8822603    0.117739682
## [11,]    0.8595744    0.140425560
## [12,]    0.8451051    0.154894888
## [13,]    0.8457220    0.154277953
## [14,]    0.8298127    0.170187338
## [15,]    0.8247529    0.175247120
## [16,]    0.8241570    0.175843031
## [17,]    0.8239818    0.176018150
## [18,]    0.8170245    0.182975516
## [19,]    0.8130875    0.186912481
## [20,]    0.8133219    0.186678099
## [21,]    0.8168446    0.183155420
## [22,]    0.8153918    0.184608171
## [23,]    0.8128030    0.187197028
## [24,]    0.8132048    0.186795179
## [25,]    0.8163227    0.183677319
## [26,]    0.8149399    0.185060073
## [27,]    0.8141751    0.185824926
## [28,]    0.8147156    0.185284443
## [29,]    0.8171385    0.182861493
## [30,]    0.8154847    0.184515316
## [31,]    0.8152257    0.184774258
## [32,]    0.8156919    0.184308140
## [33,]    0.8173992    0.182600774
## [34,]    0.8162348    0.183765243
## [35,]    0.8160646    0.183935380
## [36,]    0.8165247    0.183475311
## [37,]    0.8176965    0.182303481
## [38,]    0.8169570    0.183042982
## [39,]    0.8168930    0.183106992
## [40,]    0.8174064    0.182593629
## [41,]    0.8182576    0.181742436
## [42,]    0.8177646    0.182235443
## [43,]    0.8178012    0.182198770
## [44,]    0.8183094    0.181690553
## [45,]    0.8189349    0.181065102
## [46,]    0.8186298    0.181370185
## [47,]    0.8187167    0.181283271
## [48,]    0.8191740    0.180826005
## [49,]    0.8196244    0.180375562
## [50,]    0.8194485    0.180551528
  1. Para Explotacion M&C
var1_fevd_dlexp= fevd(var1, n.ahead = 50)$Explotacion.mc
var1_fevd_dlexp
##       Agropecuaria Explotacion.mc
##  [1,]   0.07532227      0.9246777
##  [2,]   0.08648077      0.9135192
##  [3,]   0.10685942      0.8931406
##  [4,]   0.10718546      0.8928145
##  [5,]   0.10672082      0.8932792
##  [6,]   0.11222158      0.8877784
##  [7,]   0.12488326      0.8751167
##  [8,]   0.12493172      0.8750683
##  [9,]   0.12508719      0.8749128
## [10,]   0.12809766      0.8719023
## [11,]   0.13509774      0.8649023
## [12,]   0.13502358      0.8649764
## [13,]   0.13521155      0.8647884
## [14,]   0.13693796      0.8630620
## [15,]   0.14090949      0.8590905
## [16,]   0.14083963      0.8591604
## [17,]   0.14101247      0.8589875
## [18,]   0.14198666      0.8580133
## [19,]   0.14430525      0.8556947
## [20,]   0.14426227      0.8557377
## [21,]   0.14439915      0.8556009
## [22,]   0.14493462      0.8550654
## [23,]   0.14631314      0.8536869
## [24,]   0.14629158      0.8537084
## [25,]   0.14639095      0.8536090
## [26,]   0.14667847      0.8533215
## [27,]   0.14750610      0.8524939
## [28,]   0.14749773      0.8525023
## [29,]   0.14756621      0.8524338
## [30,]   0.14771749      0.8522825
## [31,]   0.14821649      0.8517835
## [32,]   0.14821524      0.8517848
## [33,]   0.14826087      0.8517391
## [34,]   0.14833897      0.8516610
## [35,]   0.14864010      0.8513599
## [36,]   0.14864221      0.8513578
## [37,]   0.14867190      0.8513281
## [38,]   0.14871146      0.8512885
## [39,]   0.14889298      0.8511070
## [40,]   0.14889632      0.8511037
## [41,]   0.14891528      0.8510847
## [42,]   0.14893491      0.8510651
## [43,]   0.14904408      0.8509559
## [44,]   0.14904755      0.8509524
## [45,]   0.14905948      0.8509405
## [46,]   0.14906900      0.8509310
## [47,]   0.14913446      0.8508655
## [48,]   0.14913756      0.8508624
## [49,]   0.14914497      0.8508550
## [50,]   0.14914945      0.8508505
var2_fevd_dlexp= fevd(var2, n.ahead = 50)$Explotacion.mc
var2_fevd_dlexp
##       Agropecuaria Explotacion.mc
##  [1,]    0.1263890      0.8736110
##  [2,]    0.1244361      0.8755639
##  [3,]    0.1248824      0.8751176
##  [4,]    0.1261562      0.8738438
##  [5,]    0.1255497      0.8744503
##  [6,]    0.1338836      0.8661164
##  [7,]    0.1667948      0.8332052
##  [8,]    0.1677084      0.8322916
##  [9,]    0.1687253      0.8312747
## [10,]    0.1725065      0.8274935
## [11,]    0.1856192      0.8143808
## [12,]    0.1864841      0.8135159
## [13,]    0.1882039      0.8117961
## [14,]    0.1930031      0.8069969
## [15,]    0.2007962      0.7992038
## [16,]    0.2016792      0.7983208
## [17,]    0.2018002      0.7981998
## [18,]    0.2036431      0.7963569
## [19,]    0.2094793      0.7905207
## [20,]    0.2091198      0.7908802
## [21,]    0.2092355      0.7907645
## [22,]    0.2110071      0.7889929
## [23,]    0.2146227      0.7853773
## [24,]    0.2145825      0.7854175
## [25,]    0.2146894      0.7853106
## [26,]    0.2168857      0.7831143
## [27,]    0.2191286      0.7808714
## [28,]    0.2192497      0.7807503
## [29,]    0.2193898      0.7806102
## [30,]    0.2214007      0.7785993
## [31,]    0.2232012      0.7767988
## [32,]    0.2232965      0.7767035
## [33,]    0.2235184      0.7764816
## [34,]    0.2250812      0.7749188
## [35,]    0.2265135      0.7734865
## [36,]    0.2266262      0.7733738
## [37,]    0.2268785      0.7731215
## [38,]    0.2281214      0.7718786
## [39,]    0.2291640      0.7708360
## [40,]    0.2293131      0.7706869
## [41,]    0.2295828      0.7704172
## [42,]    0.2305852      0.7694148
## [43,]    0.2313473      0.7686527
## [44,]    0.2315041      0.7684959
## [45,]    0.2317920      0.7682080
## [46,]    0.2326004      0.7673996
## [47,]    0.2331791      0.7668209
## [48,]    0.2333312      0.7666688
## [49,]    0.2336203      0.7663797
## [50,]    0.2342796      0.7657204

Pronósticos

  1. Para VAR1
var1.prd=predict(var1, n.ahead = 5, ci=0.95)
var1.prd
## $Agropecuaria
##             fcst       lower      upper         CI
## [1,]  0.02610075 -0.06980731 0.12200881 0.09590806
## [2,] -0.03061977 -0.12927577 0.06803622 0.09865600
## [3,]  0.03438138 -0.06583066 0.13459343 0.10021204
## [4,]  0.02519930 -0.07510573 0.12550433 0.10030503
## [5,]  0.02807910 -0.09175542 0.14791363 0.11983452
## 
## $Explotacion.mc
##              fcst      lower     upper        CI
## [1,] -0.017219983 -0.2826331 0.2481932 0.2654132
## [2,]  0.001866219 -0.2667903 0.2705228 0.2686565
## [3,] -0.001455444 -0.2732886 0.2703777 0.2718332
## [4,]  0.034279307 -0.2377063 0.3062649 0.2719856
## [5,]  0.009762278 -0.2646127 0.2841373 0.2743750
fanchart(var1.prd)

fanchart(var1.prd, names="dlagro",
         main = "Fanchart para la Var. dlagro",
         xlab = "Horizonte", ylab = "d3im",
         xlim =c(70,90))

fanchart(var1.prd, names="Explotacion.mc",
         main = "Fanchart para la Var. Explotacion.mc",
         xlab = "Horizonte", ylab = "d3im",
         xlim =c(70,90))

  1. Para VAR2
var2.prd=predict(var2, n.ahead = 5, ci=0.95)
var2.prd
## $Agropecuaria
##             fcst        lower      upper         CI
## [1,] -0.01818888 -0.106119944 0.06974219 0.08793107
## [2,] -0.05284442 -0.141123763 0.03543492 0.08827934
## [3,]  0.08199974 -0.007833661 0.17183313 0.08983340
## [4,]  0.04904057 -0.041796036 0.13987718 0.09083661
## [5,]  0.02423771 -0.080433872 0.12890929 0.10467158
## 
## $Explotacion.mc
##             fcst      lower     upper        CI
## [1,] -0.05468520 -0.3227267 0.2133563 0.2680415
## [2,]  0.05859738 -0.2137046 0.3308994 0.2723020
## [3,]  0.01866927 -0.2537079 0.2910465 0.2723772
## [4,]  0.08948743 -0.1831259 0.3621008 0.2726134
## [5,]  0.02471027 -0.2491740 0.2985945 0.2738843
fanchart(var2.prd)

fanchart(var2.prd, names="dlagro",
         main = "Fanchart para la Var. dlagro",
         xlab = "Horizonte", ylab = "d3im",
         xlim =c(70,90))

fanchart(var2.prd, names="Explotacion.mc",
         main = "Fanchart para la Var. Explotacion.mc",
         xlab = "Horizonte", ylab = "d3im",
         xlim =c(70,90))

Test de Cointegración

Dar formato a la serie de tiempo 1. Para Agropecuaria

agro=ts(data[,3], start=c(2005, 1),freq=4)
agro
##           Qtr1      Qtr2      Qtr3      Qtr4
## 2005  5851.407  6234.029  6792.167  6561.396
## 2006  6079.042  6508.167  7552.915  7284.876
## 2007  6793.362  7021.584  8126.768  7773.286
## 2008  7447.905  7384.270  8902.276  8134.549
## 2009  7902.048  8102.346  9224.480  8325.126
## 2010  7785.010  8208.667  9314.265  9103.058
## 2011  9154.131  8835.691  9975.994  9743.184
## 2012  9055.488  9007.215 10116.487  9029.810
## 2013  8885.503  9954.775 10416.933  9251.789
## 2014  9598.004 10210.468 10918.279 10828.249
## 2015 11150.806 11183.750 12948.349 12841.096
## 2016 13147.359 13508.151 15333.027 15076.463
## 2017 14418.331 13804.086 15647.191 14945.391
## 2018 14692.306 14814.137 16361.709 15628.848
## 2019 15275.540 16113.673 18734.911 17833.876
## 2020 17941.993 17585.231 19888.453 19554.323
## 2021 20223.513 21372.156 24369.462 26713.868
## 2022 30214.925 31262.462 34467.353 34494.261
## 2023 35386.036 33115.546 34183.143 34686.244
  1. Para Explotacion M&C
exp=ts(data[,4], start=c(2005,1),  freq=4)
exp
##           Qtr1      Qtr2      Qtr3      Qtr4
## 2005  4995.062  5524.756  5773.560  5777.623
## 2006  5837.665  6790.322  7059.576  6439.437
## 2007  6151.134  5784.494  6805.799  7701.573
## 2008  8454.959  9238.138 11329.058  9652.845
## 2009  7917.920  9027.861  9624.817 10663.402
## 2010 10769.083 11970.514 11360.188 13005.215
## 2011 14590.999 18299.920 17668.955 19988.127
## 2012 18391.611 19646.975 17337.367 19181.047
## 2013 17673.115 18795.246 18563.725 18307.914
## 2014 16753.599 15855.876 16211.440 15453.085
## 2015 11739.242 11952.500 12507.875 11427.383
## 2016  9007.123  9728.128 10280.523 11983.226
## 2017 10799.923 10998.750 11857.333 13881.994
## 2018 12993.736 14141.353 15078.667 15574.244
## 2019 13501.455 14817.421 14386.995 15611.129
## 2020 11706.436  7373.263 10226.906 11382.394
## 2021 12074.851 14007.317 16948.160 21204.672
## 2022 21406.322 26747.533 29916.998 28078.146
## 2023 24199.383 21032.294 21220.098 20472.020

Se transforma la serie en Logaritmos 1. Para Agropecuaria

x=log(agro)
x
##           Qtr1      Qtr2      Qtr3      Qtr4
## 2005  8.674437  8.737778  8.823525  8.788959
## 2006  8.712602  8.780813  8.929689  8.893556
## 2007  8.823701  8.856744  9.002919  8.958448
## 2008  8.915688  8.907107  9.094062  9.003876
## 2009  8.974877  8.999909  9.129616  9.027033
## 2010  8.959955  9.012946  9.139302  9.116366
## 2011  9.121961  9.086555  9.207937  9.184323
## 2012  9.111126  9.105781  9.221922  9.108287
## 2013  9.092176  9.205808  9.251188  9.132572
## 2014  9.169310  9.231169  9.298194  9.289914
## 2015  9.319267  9.322217  9.468724  9.460406
## 2016  9.483976  9.511049  9.637764  9.620890
## 2017  9.576256  9.532720  9.658047  9.612158
## 2018  9.595079  9.603337  9.702699  9.656874
## 2019  9.634008  9.687423  9.838144  9.788855
## 2020  9.794899  9.774815  9.897895  9.880952
## 2021  9.914601  9.969844 10.101086 10.192938
## 2022 10.316091 10.350173 10.447768 10.448548
## 2023 10.474073 10.407758 10.439488 10.454098
  1. Para Explotacion mc
y=log(exp)
y
##           Qtr1      Qtr2      Qtr3      Qtr4
## 2005  8.516205  8.616994  8.661044  8.661748
## 2006  8.672086  8.823254  8.862140  8.770196
## 2007  8.724392  8.662936  8.825530  8.949180
## 2008  9.042508  9.131096  9.335126  9.175008
## 2009  8.976884  9.108071  9.172100  9.274573
## 2010  9.284435  9.390202  9.337870  9.473106
## 2011  9.588160  9.814652  9.779564  9.902894
## 2012  9.819650  9.885679  9.760619  9.861678
## 2013  9.779800  9.841359  9.828965  9.815089
## 2014  9.726368  9.671295  9.693472  9.645564
## 2015  9.370693  9.388696  9.434114  9.343768
## 2016  9.105771  9.182777  9.238006  9.391263
## 2017  9.287294  9.305537  9.380702  9.538348
## 2018  9.472223  9.556859  9.621036  9.653374
## 2019  9.510553  9.603559  9.574080  9.655739
## 2020  9.367894  8.905616  9.232777  9.339823
## 2021  9.398880  9.547335  9.737915  9.961977
## 2022  9.971442 10.194198 10.306182 10.242747
## 2023 10.094082  9.953814  9.962704  9.926814

Se organizan en una tabla

data_1=cbind(x, y)
data_1
##                 x         y
## 2005 Q1  8.674437  8.516205
## 2005 Q2  8.737778  8.616994
## 2005 Q3  8.823525  8.661044
## 2005 Q4  8.788959  8.661748
## 2006 Q1  8.712602  8.672086
## 2006 Q2  8.780813  8.823254
## 2006 Q3  8.929689  8.862140
## 2006 Q4  8.893556  8.770196
## 2007 Q1  8.823701  8.724392
## 2007 Q2  8.856744  8.662936
## 2007 Q3  9.002919  8.825530
## 2007 Q4  8.958448  8.949180
## 2008 Q1  8.915688  9.042508
## 2008 Q2  8.907107  9.131096
## 2008 Q3  9.094062  9.335126
## 2008 Q4  9.003876  9.175008
## 2009 Q1  8.974877  8.976884
## 2009 Q2  8.999909  9.108071
## 2009 Q3  9.129616  9.172100
## 2009 Q4  9.027033  9.274573
## 2010 Q1  8.959955  9.284435
## 2010 Q2  9.012946  9.390202
## 2010 Q3  9.139302  9.337870
## 2010 Q4  9.116366  9.473106
## 2011 Q1  9.121961  9.588160
## 2011 Q2  9.086555  9.814652
## 2011 Q3  9.207937  9.779564
## 2011 Q4  9.184323  9.902894
## 2012 Q1  9.111126  9.819650
## 2012 Q2  9.105781  9.885679
## 2012 Q3  9.221922  9.760619
## 2012 Q4  9.108287  9.861678
## 2013 Q1  9.092176  9.779800
## 2013 Q2  9.205808  9.841359
## 2013 Q3  9.251188  9.828965
## 2013 Q4  9.132572  9.815089
## 2014 Q1  9.169310  9.726368
## 2014 Q2  9.231169  9.671295
## 2014 Q3  9.298194  9.693472
## 2014 Q4  9.289914  9.645564
## 2015 Q1  9.319267  9.370693
## 2015 Q2  9.322217  9.388696
## 2015 Q3  9.468724  9.434114
## 2015 Q4  9.460406  9.343768
## 2016 Q1  9.483976  9.105771
## 2016 Q2  9.511049  9.182777
## 2016 Q3  9.637764  9.238006
## 2016 Q4  9.620890  9.391263
## 2017 Q1  9.576256  9.287294
## 2017 Q2  9.532720  9.305537
## 2017 Q3  9.658047  9.380702
## 2017 Q4  9.612158  9.538348
## 2018 Q1  9.595079  9.472223
## 2018 Q2  9.603337  9.556859
## 2018 Q3  9.702699  9.621036
## 2018 Q4  9.656874  9.653374
## 2019 Q1  9.634008  9.510553
## 2019 Q2  9.687423  9.603559
## 2019 Q3  9.838144  9.574080
## 2019 Q4  9.788855  9.655739
## 2020 Q1  9.794899  9.367894
## 2020 Q2  9.774815  8.905616
## 2020 Q3  9.897895  9.232777
## 2020 Q4  9.880952  9.339823
## 2021 Q1  9.914601  9.398880
## 2021 Q2  9.969844  9.547335
## 2021 Q3 10.101086  9.737915
## 2021 Q4 10.192938  9.961977
## 2022 Q1 10.316091  9.971442
## 2022 Q2 10.350173 10.194198
## 2022 Q3 10.447768 10.306182
## 2022 Q4 10.448548 10.242747
## 2023 Q1 10.474073 10.094082
## 2023 Q2 10.407758  9.953814
## 2023 Q3 10.439488  9.962704
## 2023 Q4 10.454098  9.926814

Se grafica

ts.plot(data_1, col=c("blue", "red"), main="Tendencia")

Generar Modelo
modelo1=lm(x~y)
summary(modelo1)
## 
## Call:
## lm(formula = x ~ y)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.66299 -0.28294 -0.02491  0.29096  0.76231 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.1405     0.9565   2.238   0.0282 *  
## y             0.7717     0.1013   7.615 6.91e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3736 on 74 degrees of freedom
## Multiple R-squared:  0.4393, Adjusted R-squared:  0.4318 
## F-statistic: 57.98 on 1 and 74 DF,  p-value: 6.914e-11
residualesmodelo1=modelo1$residuals
summary(residualesmodelo1)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -0.66299 -0.28294 -0.02491  0.00000  0.29096  0.76231
residualPlots(modelo1, fitted=TRUE)

##            Test stat Pr(>|Test stat|)
## y             0.9216           0.3598
## Tukey test    0.9216           0.3567
Evaluando la estacionariedad de los residuales

H0:=0 Existe raíz unitaria- No estacionaria H1:≠0 No existe raíz unitaria - Es estacionaria

adf.test(residualesmodelo1)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  residualesmodelo1
## Dickey-Fuller = -2.1917, Lag order = 4, p-value = 0.4973
## alternative hypothesis: stationary

La serie es no estacionaria, existe raíz unitaria

  1. Con tendencia
adftest1= ur.df(residualesmodelo1, type="trend", selectlags = "AIC")
summary(adftest1)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression trend 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.24324 -0.07659  0.00693  0.07340  0.35604 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -0.0546819  0.0334561  -1.634   0.1067  
## z.lag.1     -0.0803815  0.0472770  -1.700   0.0935 .
## tt           0.0016838  0.0007966   2.114   0.0381 *
## z.diff.lag  -0.1455953  0.1170710  -1.244   0.2178  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1087 on 70 degrees of freedom
## Multiple R-squared:  0.08655,    Adjusted R-squared:  0.0474 
## F-statistic: 2.211 on 3 and 70 DF,  p-value: 0.09447
## 
## 
## Value of test-statistic is: -1.7002 1.7911 2.3134 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -4.04 -3.45 -3.15
## phi2  6.50  4.88  4.16
## phi3  8.73  6.49  5.47

La serie es No estacionaria tiene Raiz unitaria

  1. Con constante
adftest2= ur.df(residualesmodelo1, type="drift", selectlags = "AIC")
summary(adftest2)
## 
## ############################################### 
## # Augmented Dickey-Fuller Test Unit Root Test # 
## ############################################### 
## 
## Test regression drift 
## 
## 
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.23945 -0.07795  0.00125  0.06288  0.36652 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.01075    0.01299   0.827    0.411
## z.lag.1     -0.01415    0.03625  -0.390    0.698
## z.diff.lag  -0.15170    0.11986  -1.266    0.210
## 
## Residual standard error: 0.1113 on 71 degrees of freedom
## Multiple R-squared:  0.02825,    Adjusted R-squared:  0.0008784 
## F-statistic: 1.032 on 2 and 71 DF,  p-value: 0.3615
## 
## 
## Value of test-statistic is: -0.3902 0.432 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau2 -3.51 -2.89 -2.58
## phi1  6.70  4.71  3.86

La serie es No estacionaria tiene Raiz unitaria

  1. Con constante y con tendencia
adftest3= ur.df(residualesmodelo1, type="none", selectlags = "AIC")
summary(adftest3)
## 
## ############################################### 
## # 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.22850 -0.06882  0.01294  0.07367  0.37584 
## 
## Coefficients:
##            Estimate Std. Error t value Pr(>|t|)
## z.lag.1    -0.01537    0.03614  -0.425    0.672
## z.diff.lag -0.14319    0.11915  -1.202    0.233
## 
## Residual standard error: 0.1111 on 72 degrees of freedom
## Multiple R-squared:  0.02612,    Adjusted R-squared:  -0.0009292 
## F-statistic: 0.9656 on 2 and 72 DF,  p-value: 0.3856
## 
## 
## Value of test-statistic is: -0.4252 
## 
## Critical values for test statistics: 
##      1pct  5pct 10pct
## tau1 -2.6 -1.95 -1.61

La serie es No estacionaria tiene Raiz unitaria.

Prueba de Phillips-outliaris para cointegración
test.PO=ca.po(data_1, type = "Pz")
summary(test.PO)
## 
## ######################################## 
## # Phillips and Ouliaris Unit Root Test # 
## ######################################## 
## 
## Test of type Pz 
## detrending of series none 
## 
## Response x :
## 
## Call:
## lm(formula = x ~ zr - 1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.13540 -0.05153 -0.01341  0.05535  0.16694 
## 
## Coefficients:
##     Estimate Std. Error t value Pr(>|t|)    
## zrx  1.01414    0.02253  45.018   <2e-16 ***
## zry -0.01161    0.02249  -0.516    0.607    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07378 on 73 degrees of freedom
## Multiple R-squared:  0.9999, Adjusted R-squared:  0.9999 
## F-statistic: 6.138e+05 on 2 and 73 DF,  p-value: < 2.2e-16
## 
## 
## Response y :
## 
## Call:
## lm(formula = y ~ zr - 1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50872 -0.06070  0.01553  0.08930  0.25313 
## 
## Coefficients:
##     Estimate Std. Error t value Pr(>|t|)    
## zrx  0.06449    0.04014   1.607    0.112    
## zry  0.93753    0.04007  23.398   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1315 on 73 degrees of freedom
## Multiple R-squared:  0.9998, Adjusted R-squared:  0.9998 
## F-statistic: 1.937e+05 on 2 and 73 DF,  p-value: < 2.2e-16
## 
## 
## 
## Value of test-statistic is: 8.997 
## 
## Critical values of Pz are:
##                   10pct    5pct    1pct
## critical values 33.9267 40.8217 55.1911

Las variables no estan cointegradas, no hay una tendencia a lago plazo

test.PU=ca.po(data_1, type = "Pu")
summary(test.PO)
## 
## ######################################## 
## # Phillips and Ouliaris Unit Root Test # 
## ######################################## 
## 
## Test of type Pz 
## detrending of series none 
## 
## Response x :
## 
## Call:
## lm(formula = x ~ zr - 1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.13540 -0.05153 -0.01341  0.05535  0.16694 
## 
## Coefficients:
##     Estimate Std. Error t value Pr(>|t|)    
## zrx  1.01414    0.02253  45.018   <2e-16 ***
## zry -0.01161    0.02249  -0.516    0.607    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07378 on 73 degrees of freedom
## Multiple R-squared:  0.9999, Adjusted R-squared:  0.9999 
## F-statistic: 6.138e+05 on 2 and 73 DF,  p-value: < 2.2e-16
## 
## 
## Response y :
## 
## Call:
## lm(formula = y ~ zr - 1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50872 -0.06070  0.01553  0.08930  0.25313 
## 
## Coefficients:
##     Estimate Std. Error t value Pr(>|t|)    
## zrx  0.06449    0.04014   1.607    0.112    
## zry  0.93753    0.04007  23.398   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1315 on 73 degrees of freedom
## Multiple R-squared:  0.9998, Adjusted R-squared:  0.9998 
## F-statistic: 1.937e+05 on 2 and 73 DF,  p-value: < 2.2e-16
## 
## 
## 
## Value of test-statistic is: 8.997 
## 
## Critical values of Pz are:
##                   10pct    5pct    1pct
## critical values 33.9267 40.8217 55.1911

Las variables no estan cointegradas, no hay una tendencia a lago plazo

En suma si los residuales no son estacionarios las variables no estan cointegradas.

Conclusiones

-Las pruebas de raíz unitaria aplicadas a las series de Agropecuaria y Explotación de Minas y Canteras muestran que ambas series presentan evidencia de no estacionariedad, por ejemplo en la serie de Agropecuaria, aunque la prueba ADF sin constante ni tendencia indica estacionariedad, las configuraciones con constante y tendencia no muestran suficiente evidencia para rechazar la no estacionariedad. En el caso de Explotación de Minas y Canteras, todas las configuraciones de la prueba ADF indican no estacionariedad, lo cual sugiere que esta serie contiene raíz unitaria.

-Los resultados de la prueba de causalidad de Granger muentran que no existe evidencia estadísticamente significativa de causalidad entre las variables Agropecuaria y Explotación mc en ambas direcciones.

-Para el modelo VAR se utilizaron los modelos con 4 y 7 rezagos son adecuados según los criterios de información AIC, HQ, SC y FPE.

  1. Modelo con 4 rezagos: En la ecuación de “Agropecuaria,” el coeficiente de “Agropecuaria.l4” es significativo a un nivel del 0.1% (p < 0.001); sin embargo, la mayoría de los demás coeficientes no son estadísticamente significativos. En la ecuación de “Explotacion.mc,” ningún coeficiente es estadísticamente significativo, lo cual sugiere que el efecto de las variables pasadas en esta serie es débil
  2. Modelo con 7 rezagos: Los coeficientes mostran poca significancia estadística en la mayoría de las variables, lo que podría indicar redundancia o falta de relación significativa en periodos más largos.

-Tanto en los modelo, var1 y var2, los residuos no siguen una distribución normal, especialmente debido a diferencias en la curtosis, por lo tanto, se rechazar la hipótesis nula; sin embargo, en los modelos var1 y var2, presentan residuos que no muestran signos de heterocedasticidad, ya que en ambos casos no se rechaza la hipótesis nula de homocedasticidad. Esto sugiere que la variabilidad de los residuos es constante a lo largo de las observaciones.

-A partir de los resultados obtenidos en las pruebas de Phillips-Ouliaris (tanto Pz como Pu), no se puede rechazar la hipótesis nula de que no existe cointegración entre las series temporales, por ello, no hay evidencia suficiente para concluir que las series estén cointegradas.