Como primer punto es importante mencionar que en el presente análisis se estudia las interacciones entre variables, debido a que era necesario conocer si tienen alguna relación.

library(vars)
## Warning: package 'vars' was built under R version 4.2.2
## Loading required package: MASS
## Loading required package: strucchange
## Warning: package 'strucchange' was built under R version 4.2.2
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: sandwich
## Warning: package 'sandwich' was built under R version 4.2.2
## Loading required package: urca
## Warning: package 'urca' was built under R version 4.2.2
## Loading required package: lmtest
library(fpp2)
## Warning: package 'fpp2' was built under R version 4.2.2
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## ── Attaching packages ────────────────────────────────────────────── fpp2 2.5 ──
## ✔ ggplot2   3.3.6     ✔ fma       2.5  
## ✔ forecast  8.20      ✔ expsmooth 2.3
## Warning: package 'ggplot2' was built under R version 4.2.1
## Warning: package 'forecast' was built under R version 4.2.2
## Warning: package 'fma' was built under R version 4.2.2
## Warning: package 'expsmooth' was built under R version 4.2.2
## 
#Cargar datos
series<-autoplot(uschange)
autoplot(uschange[,1:2], ylab = "Valores", main = "Serie de tiempo")

En esta grafica se puede observar las interaciones entre las variables consumo e ingreso. Asi mismo, se observa que la variable de ingresos a tenido picos muy drasticos en comparación al consumo.

autoplot(uschange[,c(1,3)], ylab = "Valores")

De igual manera en esta grafica se observa la interacion entre las variables consumo y produccion. Donde se muestra que la variable produccion tiende a tener cambios más significativos.

#plot de serie de datos
#ts.plot(series[,1:2], xlab="Tiempo",col=c(1,2))

Por consiguiente se analizan los parametros.

#Búsqueda de parámetros
a <- VARselect(uschange[,1:2], lag.max=15,type="trend") #Varselect para mostrar tus candidatos
a$selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      3      3      1      3
#Creación de modelo
modelo1<-VAR(uschange[,1:2],p=3,type=c("trend"))
modelo3<-VAR(uschange[,1:2],p=1,type=c("trend"))

summary(modelo1)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: Consumption, Income 
## Deterministic variables: trend 
## Sample size: 184 
## Log Likelihood: -385.38 
## Roots of the characteristic polynomial:
## 0.8886 0.5506 0.5506 0.4563 0.2912 0.2912
## Call:
## VAR(y = uschange[, 1:2], p = 3, type = c("trend"))
## 
## 
## Estimation results for equation Consumption: 
## ============================================ 
## Consumption = Consumption.l1 + Income.l1 + Consumption.l2 + Income.l2 + Consumption.l3 + Income.l3 + trend 
## 
##                  Estimate Std. Error t value Pr(>|t|)    
## Consumption.l1  0.2346575  0.0799935   2.933 0.003796 ** 
## Income.l1       0.1008841  0.0552239   1.827 0.069412 .  
## Consumption.l2  0.1931296  0.0835806   2.311 0.022003 *  
## Income.l2      -0.0035172  0.0579583  -0.061 0.951679    
## Consumption.l3  0.2701792  0.0800381   3.376 0.000905 ***
## Income.l3       0.0078077  0.0549405   0.142 0.887153    
## trend           0.0011036  0.0005638   1.958 0.051860 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.6092 on 177 degrees of freedom
## Multiple R-Squared: 0.6405,  Adjusted R-squared: 0.6263 
## F-statistic: 45.05 on 7 and 177 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation Income: 
## ======================================= 
## Income = Consumption.l1 + Income.l1 + Consumption.l2 + Income.l2 + Consumption.l3 + Income.l3 + trend 
## 
##                  Estimate Std. Error t value Pr(>|t|)    
## Consumption.l1  0.5074199  0.1153193   4.400 1.87e-05 ***
## Income.l1      -0.2460717  0.0796113  -3.091 0.002318 ** 
## Consumption.l2  0.0634472  0.1204906   0.527 0.599148    
## Income.l2      -0.0618530  0.0835532  -0.740 0.460109    
## Consumption.l3  0.4073755  0.1153836   3.531 0.000529 ***
## Income.l3      -0.0268248  0.0792028  -0.339 0.735248    
## trend           0.0017128  0.0008128   2.107 0.036497 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.8782 on 177 degrees of freedom
## Multiple R-Squared: 0.4602,  Adjusted R-squared: 0.4389 
## F-statistic: 21.56 on 7 and 177 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##             Consumption Income
## Consumption      0.3689 0.2022
## Income           0.2022 0.7683
## 
## Correlation matrix of residuals:
##             Consumption Income
## Consumption      1.0000 0.3799
## Income           0.3799 1.0000
summary(modelo3)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: Consumption, Income 
## Deterministic variables: trend 
## Sample size: 186 
## Log Likelihood: -408.648 
## Roots of the characteristic polynomial:
## 0.5838 0.3287
## Call:
## VAR(y = uschange[, 1:2], p = 1, type = c("trend"))
## 
## 
## Estimation results for equation Consumption: 
## ============================================ 
## Consumption = Consumption.l1 + Income.l1 + trend 
## 
##                 Estimate Std. Error t value Pr(>|t|)    
## Consumption.l1 0.4626250  0.0714742   6.473 8.58e-10 ***
## Income.l1      0.1375815  0.0553825   2.484 0.013883 *  
## trend          0.0022217  0.0005588   3.976 0.000101 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.654 on 183 degrees of freedom
## Multiple R-Squared: 0.574,   Adjusted R-squared: 0.567 
## F-statistic: 82.18 on 3 and 183 DF,  p-value: < 2.2e-16 
## 
## 
## Estimation results for equation Income: 
## ======================================= 
## Income = Consumption.l1 + Income.l1 + trend 
## 
##                  Estimate Std. Error t value Pr(>|t|)    
## Consumption.l1  0.6969795  0.0998422   6.981 5.23e-11 ***
## Income.l1      -0.2075006  0.0773637  -2.682  0.00798 ** 
## trend           0.0025844  0.0007806   3.311  0.00112 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.9135 on 183 degrees of freedom
## Multiple R-Squared: 0.405,   Adjusted R-squared: 0.3953 
## F-statistic: 41.53 on 3 and 183 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##             Consumption Income
## Consumption      0.4189 0.2554
## Income           0.2554 0.8243
## 
## Correlation matrix of residuals:
##             Consumption Income
## Consumption      1.0000 0.4347
## Income           0.4347 1.0000
aic1<-summary(modelo1)$logLik;aic1
## [1] -385.3802
aic2<-summary(modelo3)$logLik;aic2
## [1] -408.6483
summary(modelo3,equation="Consumption")
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: Consumption, Income 
## Deterministic variables: trend 
## Sample size: 186 
## Log Likelihood: -408.648 
## Roots of the characteristic polynomial:
## 0.5838 0.3287
## Call:
## VAR(y = uschange[, 1:2], p = 1, type = c("trend"))
## 
## 
## Estimation results for equation Consumption: 
## ============================================ 
## Consumption = Consumption.l1 + Income.l1 + trend 
## 
##                 Estimate Std. Error t value Pr(>|t|)    
## Consumption.l1 0.4626250  0.0714742   6.473 8.58e-10 ***
## Income.l1      0.1375815  0.0553825   2.484 0.013883 *  
## trend          0.0022217  0.0005588   3.976 0.000101 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.654 on 183 degrees of freedom
## Multiple R-Squared: 0.574,   Adjusted R-squared: 0.567 
## F-statistic: 82.18 on 3 and 183 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##             Consumption Income
## Consumption      0.4189 0.2554
## Income           0.2554 0.8243
## 
## Correlation matrix of residuals:
##             Consumption Income
## Consumption      1.0000 0.4347
## Income           0.4347 1.0000
summary(modelo3,equation="Income")
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: Consumption, Income 
## Deterministic variables: trend 
## Sample size: 186 
## Log Likelihood: -408.648 
## Roots of the characteristic polynomial:
## 0.5838 0.3287
## Call:
## VAR(y = uschange[, 1:2], p = 1, type = c("trend"))
## 
## 
## Estimation results for equation Income: 
## ======================================= 
## Income = Consumption.l1 + Income.l1 + trend 
## 
##                  Estimate Std. Error t value Pr(>|t|)    
## Consumption.l1  0.6969795  0.0998422   6.981 5.23e-11 ***
## Income.l1      -0.2075006  0.0773637  -2.682  0.00798 ** 
## trend           0.0025844  0.0007806   3.311  0.00112 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 0.9135 on 183 degrees of freedom
## Multiple R-Squared: 0.405,   Adjusted R-squared: 0.3953 
## F-statistic: 41.53 on 3 and 183 DF,  p-value: < 2.2e-16 
## 
## 
## 
## Covariance matrix of residuals:
##             Consumption Income
## Consumption      0.4189 0.2554
## Income           0.2554 0.8243
## 
## Correlation matrix of residuals:
##             Consumption Income
## Consumption      1.0000 0.4347
## Income           0.4347 1.0000

En conclusión, en este análisis se tuvo que evaluar las interacciones entre las variables, ya que era necesario que tuvieran relevancia debido que al momento de establecer los parámetros se podría comprobar si existía significancia entre las mismas.