# Wczytanie danych
Indeksy_M <- read_excel("C:/Users/Mateusz/Desktop/Semestr III/Ekonometria Finansowa/Projekt/Dane_indeksy.xlsx", sheet = "monthly")

dax=Indeksy_M$DAX
wig=Indeksy_M$WIG
bux=Indeksy_M$BUX
px=Indeksy_M$PX
sp=Indeksy_M$SP500
nikkei=Indeksy_M$NIKKEI225

Punkt 1 - wizualizacja danych

t=1:240

par(mfrow = c(2,2))
plot.ts( dax,type="l", col="red", main="Niemiecki indeks DAX")
abline(lm(dax~t))
plot.ts(wig, type="l", col="blue", main="Polski indeks WIG")
abline(lm(wig~t))
plot.ts(bux, type="l", col="purple", main="Węgierski indeks BUX")
abline(lm(bux~t))
plot.ts(sp, type="l", col="darkgreen", main="Amerykański indeks S&P500")
abline(lm(sp~t))

Punkt 2 - testowanie stacjonarności

summary(lm(dax~t)) # trend istotny
## 
## Call:
## lm(formula = dax ~ t)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3420.9 -1061.8  -118.7   977.3  3525.2 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 3637.807    170.883   21.29   <2e-16 ***
## t             53.109      1.229   43.20   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1320 on 238 degrees of freedom
## Multiple R-squared:  0.8869, Adjusted R-squared:  0.8864 
## F-statistic:  1866 on 1 and 238 DF,  p-value: < 2.2e-16
summary(lm(wig~t)) # trend istotny
## 
## Call:
## lm(formula = wig ~ t)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1189.48  -232.30    14.21   198.25  1262.20 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 2729.0506    51.2284  53.272   <2e-16 ***
## t             -3.3421     0.3686  -9.068   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 395.6 on 238 degrees of freedom
## Multiple R-squared:  0.2568, Adjusted R-squared:  0.2537 
## F-statistic: 82.23 on 1 and 238 DF,  p-value: < 2.2e-16
summary(lm(bux~t)) # trend istotny
## 
## Call:
## lm(formula = bux ~ t)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -14337.5  -6899.0   -446.2   5558.2  28076.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 10144.067   1087.257    9.33   <2e-16 ***
## t             171.276      7.822   21.90   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8396 on 238 degrees of freedom
## Multiple R-squared:  0.6683, Adjusted R-squared:  0.6669 
## F-statistic: 479.4 on 1 and 238 DF,  p-value: < 2.2e-16
summary(lm(sp~t)) # trend nieistotny
## 
## Call:
## lm(formula = sp ~ t)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -830.2 -402.1 -270.4  536.0 1673.4 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 329.0740    68.5705   4.799 2.82e-06 ***
## t            16.8617     0.4933  34.180  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 529.5 on 238 degrees of freedom
## Multiple R-squared:  0.8308, Adjusted R-squared:   0.83 
## F-statistic:  1168 on 1 and 238 DF,  p-value: < 2.2e-16
# ponieważ trendy są istotne, uwzględniamy je w teście
# sprawdzane jest 12 lagów, ale finalnie przyjęte jest mniej

adf_dax = ur.df(dax, type = c("trend"), lags = 12, selectlags ="BIC" )
adf_wig= ur.df(wig, type = c("trend"), lags = 12, selectlags ="BIC" )
adf_bux = ur.df(bux, type = c("trend"), lags = 12, selectlags ="BIC" )
adf_sp = ur.df(sp, type = c("trend"), lags = 12, selectlags ="BIC" )

summary(adf_dax)
## 
## ############################################### 
## # 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 
## -2115.49  -282.18    49.03   328.40  1522.43 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept) 214.44203  117.35754   1.827  0.06900 . 
## z.lag.1      -0.06411    0.02622  -2.445  0.01527 * 
## tt            4.01400    1.49309   2.688  0.00772 **
## z.diff.lag    0.01993    0.06778   0.294  0.76898   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 507.3 on 223 degrees of freedom
## Multiple R-squared:  0.03175,    Adjusted R-squared:  0.01873 
## F-statistic: 2.438 on 3 and 223 DF,  p-value: 0.06544
## 
## 
## Value of test-statistic is: -2.4448 3.5935 3.6397 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.99 -3.43 -3.13
## phi2  6.22  4.75  4.07
## phi3  8.43  6.49  5.47
summary(adf_wig)
## 
## ############################################### 
## # 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 
## -570.34  -82.28    0.84   96.64  339.97 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)   
## (Intercept) 180.809414  73.044034   2.475  0.01406 * 
## z.lag.1      -0.065958   0.024603  -2.681  0.00789 **
## tt           -0.234566   0.172663  -1.359  0.17567   
## z.diff.lag    0.004865   0.066887   0.073  0.94208   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 137.4 on 223 degrees of freedom
## Multiple R-squared:  0.03235,    Adjusted R-squared:  0.01933 
## F-statistic: 2.485 on 3 and 223 DF,  p-value: 0.06154
## 
## 
## Value of test-statistic is: -2.6809 2.4526 3.6332 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.99 -3.43 -3.13
## phi2  6.22  4.75  4.07
## phi3  8.43  6.49  5.47
summary(adf_bux)
## 
## ############################################### 
## # 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 
## -10388.2   -832.1     47.7   1087.4   5957.6 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -2.447e+02  2.947e+02  -0.830   0.4072  
## z.lag.1     -6.817e-03  1.517e-02  -0.449   0.6536  
## tt           5.512e+00  3.255e+00   1.693   0.0918 .
## z.diff.lag   5.745e-02  6.817e-02   0.843   0.4002  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1822 on 223 degrees of freedom
## Multiple R-squared:  0.02969,    Adjusted R-squared:  0.01663 
## F-statistic: 2.274 on 3 and 223 DF,  p-value: 0.08084
## 
## 
## Value of test-statistic is: -0.4494 3.0594 2.7696 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.99 -3.43 -3.13
## phi2  6.22  4.75  4.07
## phi3  8.43  6.49  5.47
summary(adf_sp)
## 
## ############################################### 
## # 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 
## -453.38  -41.60   17.31   54.97  306.42 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -14.28147   17.20364  -0.830   0.4073  
## z.lag.1      -0.01105    0.01605  -0.689   0.4916  
## tt            0.50881    0.30695   1.658   0.0988 .
## z.diff.lag   -0.14038    0.06782  -2.070   0.0396 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 117.8 on 223 degrees of freedom
## Multiple R-squared:  0.04566,    Adjusted R-squared:  0.03282 
## F-statistic: 3.557 on 3 and 223 DF,  p-value: 0.01513
## 
## 
## Value of test-statistic is: -0.6889 5.171 3.6213 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau3 -3.99 -3.43 -3.13
## phi2  6.22  4.75  4.07
## phi3  8.43  6.49  5.47
# w każdym przypadku występuje niestacjonarność dla 1pct i 5pct

Punkt 3 - rożnicowanie WIG w celu weliminowania niestacjonarności

#rożnice
d_wig = diff(wig)
d_dax = diff(dax)
d_bux = diff(bux)
d_sp = diff(sp)

t=1:239
summary(lm(d_wig~t)) # trend nieistotny
## 
## Call:
## lm(formula = d_wig ~ t)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -564.19  -84.69    5.07   96.74  320.82 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  8.53039   18.15346   0.470    0.639
## t           -0.06047    0.13115  -0.461    0.645
## 
## Residual standard error: 139.9 on 237 degrees of freedom
## Multiple R-squared:  0.0008961,  Adjusted R-squared:  -0.00332 
## F-statistic: 0.2126 on 1 and 237 DF,  p-value: 0.6452
summary(lm(d_dax~t)) # trend nieistotny
## 
## Call:
## lm(formula = d_dax ~ t)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2046.75  -276.14    61.96   283.53  1638.99 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  13.7395    64.9626   0.211    0.833
## t             0.4313     0.4693   0.919    0.359
## 
## Residual standard error: 500.6 on 237 degrees of freedom
## Multiple R-squared:  0.003551,   Adjusted R-squared:  -0.0006531 
## F-statistic: 0.8447 on 1 and 237 DF,  p-value: 0.359
summary(lm(d_bux~t)) # trend nieistotny
## 
## Call:
## lm(formula = d_bux ~ t)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10276.5   -808.9     51.0   1079.0   5990.2 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -154.838    234.662  -0.660   0.5100  
## t              3.514      1.695   2.073   0.0393 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1808 on 237 degrees of freedom
## Multiple R-squared:  0.01781,    Adjusted R-squared:  0.01366 
## F-statistic: 4.296 on 1 and 237 DF,  p-value: 0.03927
summary(lm(d_sp~t)) # trend nieistotny
## 
## Call:
## lm(formula = d_sp ~ t)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -439.63  -38.48   14.75   52.83  328.16 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  -9.9667    15.0378  -0.663   0.5081  
## t             0.2469     0.1086   2.273   0.0239 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 115.9 on 237 degrees of freedom
## Multiple R-squared:  0.02134,    Adjusted R-squared:  0.01721 
## F-statistic: 5.167 on 1 and 237 DF,  p-value: 0.02392
# tym razem bez trendu
summary(ur.df(d_wig, type = c("none"), lags = 12, selectlags ="BIC" ))
## 
## ############################################### 
## # 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 
## -568.74  -86.07   -5.33   89.95  330.09 
## 
## Coefficients:
##            Estimate Std. Error t value Pr(>|t|)    
## z.lag.1    -1.05547    0.09565 -11.034   <2e-16 ***
## z.diff.lag  0.02524    0.06661   0.379    0.705    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 139.3 on 224 degrees of freedom
## Multiple R-squared:  0.5151, Adjusted R-squared:  0.5108 
## F-statistic:   119 on 2 and 224 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -11.0342 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(d_dax, type = c("none"), lags = 12, selectlags ="BIC" ))
## 
## ############################################### 
## # 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 
## -1968.1  -223.5   120.1   375.6  1726.4 
## 
## Coefficients:
##            Estimate Std. Error t value Pr(>|t|)    
## z.lag.1    -1.05799    0.09445 -11.202   <2e-16 ***
## z.diff.lag  0.06034    0.06686   0.902    0.368    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 517.2 on 224 degrees of freedom
## Multiple R-squared:  0.5004, Adjusted R-squared:  0.4959 
## F-statistic: 112.2 on 2 and 224 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -11.2018 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(d_bux, type = c("none"), lags = 12, selectlags ="BIC" ))
## 
## ############################################### 
## # 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 
## -9917.4  -648.5   173.4  1332.0  6636.4 
## 
## Coefficients:
##            Estimate Std. Error t value Pr(>|t|)    
## z.lag.1    -0.87302    0.09073  -9.622   <2e-16 ***
## z.diff.lag -0.04017    0.06741  -0.596    0.552    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1852 on 224 degrees of freedom
## Multiple R-squared:  0.4555, Adjusted R-squared:  0.4506 
## F-statistic: 93.68 on 2 and 224 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -9.6219 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(d_sp, type = c("none"), lags = 12, selectlags ="BIC" ))
## 
## ############################################### 
## # 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 
## -394.48  -25.31   27.48   71.91  358.67 
## 
## Coefficients:
##            Estimate Std. Error t value Pr(>|t|)    
## z.lag.1    -1.12176    0.09896 -11.335   <2e-16 ***
## z.diff.lag  0.03076    0.06804   0.452    0.652    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 121.5 on 224 degrees of freedom
## Multiple R-squared:  0.5431, Adjusted R-squared:  0.539 
## F-statistic: 133.1 on 2 and 224 DF,  p-value: < 2.2e-16
## 
## 
## Value of test-statistic is: -11.3353 
## 
## Critical values for test statistics: 
##       1pct  5pct 10pct
## tau1 -2.58 -1.95 -1.62
# ZMIENNA UZNAna ZA STACJONARNÄ„!
# Potwierdzenie testem ACF

par(mfrow = c(2,2))
acf(d_wig)
acf(d_dax)
acf(d_bux)
acf(d_sp)

# Subset zmiennych do modelu
dane <- data.frame(d_dax,d_wig,d_bux,d_sp)

Punkt 4 - sprawdzenie odpowiedniej lizcby opóźniej w modelu VAR

#testowanie długości opóźnień w modelu VAR
subset_for_VAR = ts(dane) # ts - oznaczenie jako szereg czasowy
VARselect(subset_for_VAR, lag.max = 12, type = "const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      1      1      1      1 
## 
## $criteria
##                   1            2            3            4            5
## AIC(n) 4.503343e+01 4.506164e+01 4.513884e+01 4.520743e+01 4.526960e+01
## HQ(n)  4.515520e+01 4.528081e+01 4.545542e+01 4.562143e+01 4.578101e+01
## SC(n)  4.533519e+01 4.560480e+01 4.592341e+01 4.623341e+01 4.653698e+01
## FPE(n) 3.612306e+19 3.716150e+19 4.015739e+19 4.303536e+19 4.584163e+19
##                   6            7            8            9           10
## AIC(n) 4.530810e+01 4.530076e+01 4.530780e+01 4.536313e+01 4.542173e+01
## HQ(n)  4.591692e+01 4.600699e+01 4.611144e+01 4.626418e+01 4.642019e+01
## SC(n)  4.681689e+01 4.705095e+01 4.729940e+01 4.759614e+01 4.789614e+01
## FPE(n) 4.771088e+19 4.745789e+19 4.792177e+19 5.082214e+19 5.412095e+19
##                  11           12
## AIC(n) 4.540783e+01 4.549113e+01
## HQ(n)  4.650370e+01 4.668441e+01
## SC(n)  4.812365e+01 4.844836e+01
## FPE(n) 5.365513e+19 5.868567e+19

Punkt 5 - szacujemy model VAR dla p=1

var <- VAR(subset_for_VAR, p = 1, type = "const")
summary(var)
## 
## VAR Estimation Results:
## ========================= 
## Endogenous variables: d_dax, d_wig, d_bux, d_sp 
## Deterministic variables: const 
## Sample size: 238 
## Log Likelihood: -6678.103 
## Roots of the characteristic polynomial:
## 0.1826 0.1826 0.0641 0.02939
## Call:
## VAR(y = subset_for_VAR, p = 1, type = "const")
## 
## 
## Estimation results for equation d_dax: 
## ====================================== 
## d_dax = d_dax.l1 + d_wig.l1 + d_bux.l1 + d_sp.l1 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)  
## d_dax.l1 -0.090103   0.109578  -0.822   0.4118  
## d_wig.l1  0.487730   0.314376   1.551   0.1222  
## d_bux.l1 -0.004092   0.023835  -0.172   0.8638  
## d_sp.l1   0.046916   0.451633   0.104   0.9174  
## const    70.685768  33.441601   2.114   0.0356 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 502.7 on 233 degrees of freedom
## Multiple R-Squared: 0.01195, Adjusted R-squared: -0.005007 
## F-statistic: 0.7048 on 4 and 233 DF,  p-value: 0.5894 
## 
## 
## Estimation results for equation d_wig: 
## ====================================== 
## d_wig = d_dax.l1 + d_wig.l1 + d_bux.l1 + d_sp.l1 + const 
## 
##            Estimate Std. Error t value Pr(>|t|)
## d_dax.l1  0.0242437  0.0305748   0.793    0.429
## d_wig.l1 -0.0401939  0.0877181  -0.458    0.647
## d_bux.l1 -0.0002252  0.0066504  -0.034    0.973
## d_sp.l1  -0.0770318  0.1260157  -0.611    0.542
## const     0.5334465  9.3309616   0.057    0.954
## 
## 
## Residual standard error: 140.3 on 233 degrees of freedom
## Multiple R-Squared: 0.003388,    Adjusted R-squared: -0.01372 
## F-statistic: 0.198 on 4 and 233 DF,  p-value: 0.9392 
## 
## 
## Estimation results for equation d_bux: 
## ====================================== 
## d_bux = d_dax.l1 + d_wig.l1 + d_bux.l1 + d_sp.l1 + const 
## 
##           Estimate Std. Error t value Pr(>|t|)   
## d_dax.l1  -0.43602    0.38799  -1.124  0.26227   
## d_wig.l1   1.21893    1.11314   1.095  0.27463   
## d_bux.l1  -0.07856    0.08439  -0.931  0.35290   
## d_sp.l1    4.69671    1.59913   2.937  0.00365 **
## const    207.53211  118.40960   1.753  0.08098 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 1780 on 233 degrees of freedom
## Multiple R-Squared: 0.05637, Adjusted R-squared: 0.04017 
## F-statistic:  3.48 on 4 and 233 DF,  p-value: 0.008775 
## 
## 
## Estimation results for equation d_sp: 
## ===================================== 
## d_sp = d_dax.l1 + d_wig.l1 + d_bux.l1 + d_sp.l1 + const 
## 
##            Estimate Std. Error t value Pr(>|t|)   
## d_dax.l1 -0.0165242  0.0253910  -0.651  0.51582   
## d_wig.l1  0.1202869  0.0728459   1.651  0.10003   
## d_bux.l1 -0.0008512  0.0055228  -0.154  0.87764   
## d_sp.l1  -0.1316987  0.1046503  -1.258  0.20948   
## const    23.4768294  7.7489410   3.030  0.00272 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Residual standard error: 116.5 on 233 degrees of freedom
## Multiple R-Squared: 0.02766, Adjusted R-squared: 0.01096 
## F-statistic: 1.657 on 4 and 233 DF,  p-value: 0.1609 
## 
## 
## 
## Covariance matrix of residuals:
##        d_dax  d_wig   d_bux   d_sp
## d_dax 252722  40411  488399  45188
## d_wig  40411  19675  157415   8301
## d_bux 488399 157415 3168422 114354
## d_sp   45188   8301  114354  13569
## 
## Correlation matrix of residuals:
##        d_dax  d_wig  d_bux   d_sp
## d_dax 1.0000 0.5731 0.5458 0.7717
## d_wig 0.5731 1.0000 0.6305 0.5080
## d_bux 0.5458 0.6305 1.0000 0.5515
## d_sp  0.7717 0.5080 0.5515 1.0000

Punkt 6 - wizualizacja efektów estymacji

windows(width=12, height=8) # dla systemu Windows
plot(var)
# po przeklikaniu pokazuje wykres dla każdej zmiennej

Punkt 7 - badanie stabilności modelu VAR

par(mar = c(2.5, 2.5, 1.2, 1.2), cex = 0.6)
var_stab = stability(var, type = "OLS-CUSUM")
plot(var_stab)

badanie normalności rozkładu reszt

var_norm = normality.test(var, multivariate.only = TRUE)
var_norm
## $JB
## 
##  JB-Test (multivariate)
## 
## data:  Residuals of VAR object var
## Chi-squared = 130.2, df = 8, p-value < 2.2e-16
## 
## 
## $Skewness
## 
##  Skewness only (multivariate)
## 
## data:  Residuals of VAR object var
## Chi-squared = 10.781, df = 4, p-value = 0.02914
## 
## 
## $Kurtosis
## 
##  Kurtosis only (multivariate)
## 
## data:  Residuals of VAR object var
## Chi-squared = 119.42, df = 4, p-value < 2.2e-16
# Reszty nie mają rozkładu normalnego (p-value <0)

badanie autokorelacji składnika losowego

var_BG <- serial.test(var, lags.pt = 4, type = "BG")
var_BG
## 
##  Breusch-Godfrey LM test
## 
## data:  Residuals of VAR object var
## Chi-squared = 80.36, df = 80, p-value = 0.4677
# Reszty wykazujÄ… na brak autokorelacji
# Koło jednostkowe

roots(var)
## [1] 0.18257939 0.18257939 0.06410090 0.02938729
par(mfrow = c(1, 1))
root.comp = Im(roots(var, modulus=FALSE ))
root.real = Re(roots(var, modulus=FALSE ))
x = seq(-1, 1, length=1000)
y1 = sqrt(1-x^2)
y2 = -sqrt(1-x^2)
plot(c(x, x), c(y1, y2), xlab='Real part', ylab='Imaginary part', type='l', main='Unit Circle', ylim=c(-1.2, 1.2), xlim=c (-1, 1))
abline(h=0)
abline(v=0)
points(root.comp, root.real, pch=19)
legend(-1, -1, legend= "Eigenvalues", pch=19)

# testy przyczynowości Grangera

causality(var, cause = c("d_wig"))
## $Granger
## 
##  Granger causality H0: d_wig do not Granger-cause d_dax d_bux d_sp
## 
## data:  VAR object var
## F-Test = 0.97745, df1 = 3, df2 = 932, p-value = 0.4027
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_wig and d_dax d_bux d_sp
## 
## data:  VAR object var
## Chi-squared = 76.347, df = 3, p-value = 2.22e-16
causality(var, cause = c("d_sp"))
## $Granger
## 
##  Granger causality H0: d_sp do not Granger-cause d_dax d_wig d_bux
## 
## data:  VAR object var
## F-Test = 6.4034, df1 = 3, df2 = 932, p-value = 0.0002702
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_sp and d_dax d_wig d_bux
## 
## data:  VAR object var
## Chi-squared = 91.062, df = 3, p-value < 2.2e-16
causality(var, cause = c("d_dax"))
## $Granger
## 
##  Granger causality H0: d_dax do not Granger-cause d_wig d_bux d_sp
## 
## data:  VAR object var
## F-Test = 1.7627, df1 = 3, df2 = 932, p-value = 0.1527
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_dax and d_wig d_bux d_sp
## 
## data:  VAR object var
## Chi-squared = 93.048, df = 3, p-value < 2.2e-16
causality(var, cause = c("d_bux"))
## $Granger
## 
##  Granger causality H0: d_bux do not Granger-cause d_dax d_wig d_sp
## 
## data:  VAR object var
## F-Test = 0.012545, df1 = 3, df2 = 932, p-value = 0.9981
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_bux and d_dax d_wig d_sp
## 
## data:  VAR object var
## Chi-squared = 76.414, df = 3, p-value = 2.22e-16
causality(var, cause = c("d_bux","d_dax","d_sp"))
## $Granger
## 
##  Granger causality H0: d_dax d_bux d_sp do not Granger-cause d_wig
## 
## data:  VAR object var
## F-Test = 0.21433, df1 = 3, df2 = 932, p-value = 0.8865
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_dax d_bux d_sp and d_wig
## 
## data:  VAR object var
## Chi-squared = 76.347, df = 3, p-value = 2.22e-16
causality(var, cause = c("d_wig","d_dax","d_sp"))
## $Granger
## 
##  Granger causality H0: d_dax d_wig d_sp do not Granger-cause d_bux
## 
## data:  VAR object var
## F-Test = 4.249, df1 = 3, df2 = 932, p-value = 0.005414
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_dax d_wig d_sp and d_bux
## 
## data:  VAR object var
## Chi-squared = 76.414, df = 3, p-value = 2.22e-16
causality(var, cause = c("d_bux","d_wig","d_sp"))
## $Granger
## 
##  Granger causality H0: d_wig d_bux d_sp do not Granger-cause d_dax
## 
## data:  VAR object var
## F-Test = 0.92641, df1 = 3, df2 = 932, p-value = 0.4274
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_wig d_bux d_sp and d_dax
## 
## data:  VAR object var
## Chi-squared = 93.048, df = 3, p-value < 2.2e-16
causality(var, cause = c("d_bux","d_dax","d_wig"))
## $Granger
## 
##  Granger causality H0: d_dax d_wig d_bux do not Granger-cause d_sp
## 
## data:  VAR object var
## F-Test = 1.0376, df1 = 3, df2 = 932, p-value = 0.3751
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_dax d_wig d_bux and d_sp
## 
## data:  VAR object var
## Chi-squared = 91.062, df = 3, p-value < 2.2e-16
# SP vs WIG
subset_for_VAR2<-data.frame(d_wig,d_sp)
VARselect(subset_for_VAR2, lag.max = 12, type = "const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      1      1      1      1 
## 
## $criteria
##                   1            2            3            4            5
## AIC(n) 1.914139e+01 1.915390e+01 1.916009e+01 1.917791e+01 1.920170e+01
## HQ(n)  1.917791e+01 1.921478e+01 1.924532e+01 1.928749e+01 1.933564e+01
## SC(n)  1.923191e+01 1.930477e+01 1.937132e+01 1.944949e+01 1.953364e+01
## FPE(n) 2.055888e+08 2.081793e+08 2.094776e+08 2.132532e+08 2.184034e+08
##                   6            7            8            9           10
## AIC(n) 1.922621e+01 1.921433e+01 1.916181e+01 1.918011e+01 1.918760e+01
## HQ(n)  1.938451e+01 1.939697e+01 1.936880e+01 1.941146e+01 1.944331e+01
## SC(n)  1.961850e+01 1.966696e+01 1.967479e+01 1.975345e+01 1.982129e+01
## FPE(n) 2.238449e+08 2.212300e+08 2.099474e+08 2.138738e+08 2.155414e+08
##                  11           12
## AIC(n) 1.920182e+01 1.923008e+01
## HQ(n)  1.948187e+01 1.953449e+01
## SC(n)  1.989586e+01 1.998447e+01
## FPE(n) 2.187004e+08 2.250587e+08
var2 <- VAR(subset_for_VAR2, p = 1, type = "const")
causality(var2, cause = c("d_wig"))
## $Granger
## 
##  Granger causality H0: d_wig do not Granger-cause d_sp
## 
## data:  VAR object var2
## F-Test = 2.6534, df1 = 1, df2 = 470, p-value = 0.104
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_wig and d_sp
## 
## data:  VAR object var2
## Chi-squared = 48.291, df = 1, p-value = 3.675e-12
causality(var2, cause = c("d_sp"))
## $Granger
## 
##  Granger causality H0: d_sp do not Granger-cause d_wig
## 
## data:  VAR object var2
## F-Test = 0.010962, df1 = 1, df2 = 470, p-value = 0.9167
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_sp and d_wig
## 
## data:  VAR object var2
## Chi-squared = 48.291, df = 1, p-value = 3.675e-12
# SP vs BUX
subset_for_VAR3<-data.frame(d_bux,d_sp)
VARselect(subset_for_VAR3, lag.max = 12, type = "const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      8      1      1      8 
## 
## $criteria
##                   1            2            3            4            5
## AIC(n) 2.420646e+01 2.420755e+01 2.422571e+01 2.423808e+01 2.425788e+01
## HQ(n)  2.424299e+01 2.426843e+01 2.431095e+01 2.434767e+01 2.439182e+01
## SC(n)  2.429699e+01 2.435843e+01 2.443694e+01 2.450967e+01 2.458981e+01
## FPE(n) 3.256373e+10 3.259949e+10 3.319789e+10 3.361260e+10 3.428702e+10
##                   6            7            8            9           10
## AIC(n) 2.426325e+01 2.421314e+01 2.415852e+01 2.418034e+01 2.419883e+01
## HQ(n)  2.442154e+01 2.439579e+01 2.436552e+01 2.441169e+01 2.445453e+01
## SC(n)  2.465553e+01 2.466578e+01 2.467151e+01 2.475368e+01 2.483252e+01
## FPE(n) 3.447498e+10 3.279446e+10 3.105679e+10 3.174891e+10 3.235029e+10
##                  11           12
## AIC(n) 2.421147e+01 2.423576e+01
## HQ(n)  2.449152e+01 2.454017e+01
## SC(n)  2.490551e+01 2.499015e+01
## FPE(n) 3.277274e+10 3.359200e+10
var3 <- VAR(subset_for_VAR3, p = 1, type = "const")
causality(var3, cause = c("d_bux"))
## $Granger
## 
##  Granger causality H0: d_bux do not Granger-cause d_sp
## 
## data:  VAR object var3
## F-Test = 0.31574, df1 = 1, df2 = 470, p-value = 0.5744
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_bux and d_sp
## 
## data:  VAR object var3
## Chi-squared = 55.982, df = 1, p-value = 7.316e-14
causality(var3, cause = c("d_sp"))
## $Granger
## 
##  Granger causality H0: d_sp do not Granger-cause d_bux
## 
## data:  VAR object var3
## F-Test = 10.76, df1 = 1, df2 = 470, p-value = 0.001114
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_sp and d_bux
## 
## data:  VAR object var3
## Chi-squared = 55.982, df = 1, p-value = 7.316e-14
# SP VS DAX
subset_for_VAR4<-data.frame(d_dax,d_sp)
VARselect(subset_for_VAR4, lag.max = 12, type = "const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      1      1      1      1 
## 
## $criteria
##                   1            2            3            4            5
## AIC(n) 2.115738e+01 2.117127e+01 2.118987e+01 2.121322e+01 2.121231e+01
## HQ(n)  2.119390e+01 2.123215e+01 2.127511e+01 2.132281e+01 2.134625e+01
## SC(n)  2.124790e+01 2.132215e+01 2.140110e+01 2.148480e+01 2.154424e+01
## FPE(n) 1.543593e+09 1.565207e+09 1.594635e+09 1.632375e+09 1.630997e+09
##                   6            7            8            9           10
## AIC(n) 2.123542e+01 2.124466e+01 2.119989e+01 2.120761e+01 2.122945e+01
## HQ(n)  2.139371e+01 2.142731e+01 2.140689e+01 2.143896e+01 2.148516e+01
## SC(n)  2.162770e+01 2.169730e+01 2.171288e+01 2.178095e+01 2.186314e+01
## FPE(n) 1.669300e+09 1.685025e+09 1.611537e+09 1.624384e+09 1.660714e+09
##                  11           12
## AIC(n) 2.123314e+01 2.124641e+01
## HQ(n)  2.151319e+01 2.155082e+01
## SC(n)  2.192718e+01 2.200081e+01
## FPE(n) 1.667403e+09 1.690357e+09
var4 <- VAR(subset_for_VAR4, p = 1, type = "const")
causality(var4, cause = c("d_sp"))
## $Granger
## 
##  Granger causality H0: d_sp do not Granger-cause d_dax
## 
## data:  VAR object var4
## F-Test = 0.076202, df1 = 1, df2 = 470, p-value = 0.7826
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_sp and d_dax
## 
## data:  VAR object var4
## Chi-squared = 89.226, df = 1, p-value < 2.2e-16
causality(var4, cause = c("d_dax"))
## $Granger
## 
##  Granger causality H0: d_dax do not Granger-cause d_sp
## 
## data:  VAR object var4
## F-Test = 0.013361, df1 = 1, df2 = 470, p-value = 0.908
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_dax and d_sp
## 
## data:  VAR object var4
## Chi-squared = 89.226, df = 1, p-value < 2.2e-16
# DAX VS WIG i BUX
subset_for_VAR5<-data.frame(d_dax,d_bux,d_wig)
VARselect(subset_for_VAR5, lag.max = 12, type = "const")
## $selection
## AIC(n)  HQ(n)  SC(n) FPE(n) 
##      1      1      1      1 
## 
## $criteria
##                   1            2            3            4            5
## AIC(n) 3.647788e+01 3.649997e+01 3.653190e+01 3.657178e+01 3.661178e+01
## HQ(n)  3.655093e+01 3.662782e+01 3.671455e+01 3.680922e+01 3.690401e+01
## SC(n)  3.665893e+01 3.681682e+01 3.698454e+01 3.716020e+01 3.733600e+01
## FPE(n) 6.952565e+15 7.108239e+15 7.339710e+15 7.639843e+15 7.954222e+15
##                   6            7            8            9           10
## AIC(n) 3.661404e+01 3.659351e+01 3.665053e+01 3.670052e+01 3.671509e+01
## HQ(n)  3.696107e+01 3.699533e+01 3.710715e+01 3.721193e+01 3.728129e+01
## SC(n)  3.747405e+01 3.758931e+01 3.778213e+01 3.796790e+01 3.811826e+01
## FPE(n) 7.976046e+15 7.819030e+15 8.285026e+15 8.719247e+15 8.859274e+15
##                  11           12
## AIC(n) 3.667995e+01 3.672365e+01
## HQ(n)  3.730095e+01 3.739944e+01
## SC(n)  3.821892e+01 3.839841e+01
## FPE(n) 8.567608e+15 8.968124e+15
var5 <- VAR(subset_for_VAR5, p = 1, type = "const")
causality(var5, cause = c("d_dax"))
## $Granger
## 
##  Granger causality H0: d_dax do not Granger-cause d_bux d_wig
## 
## data:  VAR object var5
## F-Test = 0.58336, df1 = 2, df2 = 702, p-value = 0.5583
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_dax and d_bux d_wig
## 
## data:  VAR object var5
## Chi-squared = 65.996, df = 2, p-value = 4.663e-15
causality(var5, cause = c("d_bux","d_wig"))
## $Granger
## 
##  Granger causality H0: d_bux d_wig do not Granger-cause d_dax
## 
## data:  VAR object var5
## F-Test = 1.3901, df1 = 2, df2 = 702, p-value = 0.2497
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: d_bux d_wig and d_dax
## 
## data:  VAR object var5
## Chi-squared = 65.996, df = 2, p-value = 4.663e-15
# funkcja odpowiedzi na impuls 
irf=irf(var)
irf
## 
## Impulse response coefficients
## $d_dax
##               d_dax         d_wig         d_bux          d_sp
##  [1,]  5.027148e+02  8.038640e+01  9.715227e+02  8.988757e+01
##  [2,] -5.847287e+00  1.813618e+00  2.246503e+02 -1.130260e+01
##  [3,] -3.806549e-02  6.054082e-01 -6.597262e+01  1.612084e+00
##  [4,]  6.442798e-01 -1.345800e-01  1.350862e+01 -8.269942e-02
##  [5,] -1.828437e-01  2.435711e-02 -1.894564e+00 -2.744204e-02
##  [6,]  3.481902e-02 -2.871213e-03  1.293552e-01  1.117799e-02
##  [7,] -4.542535e-03  6.935320e-05  2.365666e-02 -2.502965e-03
##  [8,]  2.288961e-04  7.456452e-05 -1.154893e-02  3.929039e-04
##  [9,]  8.143165e-05 -2.511280e-05  2.743686e-03 -3.672726e-05
## [10,] -3.253501e-05  5.194822e-06 -4.541478e-04 -1.864928e-06
## [11,]  7.235925e-06 -7.516276e-07  4.743512e-05  1.794680e-06
## 
## $d_wig
##               d_dax         d_wig         d_bux          d_sp
##  [1,]  0.000000e+00  1.149494e+02  6.900224e+02  9.350055e+00
##  [2,]  5.367952e+01 -5.495926e+00  1.298236e+02  1.200814e+01
##  [3,] -7.485041e+00  5.680458e-01  1.609604e+01 -3.240067e+00
##  [4,]  7.336061e-01  4.166593e-02 -1.252610e+01  6.050239e-01
##  [5,]  3.386026e-02 -2.767435e-02  3.556553e+00 -7.612858e-02
##  [6,] -3.467260e-02  6.996556e-03 -6.854409e-01  3.110194e-03
##  [7,]  9.487088e-03 -1.207020e-03  9.209960e-02  1.588395e-03
##  [8,] -1.745840e-03  1.354175e-04 -5.382579e-03 -5.895435e-04
##  [9,]  2.177177e-04 -1.142736e-06 -1.419801e-03  1.273615e-04
## [10,] -8.389638e-06 -4.166909e-06  6.133936e-04 -1.929983e-05
## [11,] -4.691703e-06  1.312641e-06 -1.402529e-04  1.657027e-06
## 
## $d_bux
##               d_dax         d_wig         d_bux          d_sp
##  [1,]  0.000000e+00  0.000000e+00  1.322284e+03  1.555949e+01
##  [2,] -4.680443e+00 -1.496382e+00 -3.079561e+01 -3.174741e+00
##  [3,] -3.310465e-01  1.981660e-01 -1.227488e+01  3.416691e-01
##  [4,]  1.927349e-01 -3.954571e-02  2.954883e+00 -5.241492e-03
##  [5,] -4.899010e-02  6.000370e-03 -3.889818e-01 -9.766629e-03
##  [6,]  8.474111e-03 -5.889325e-04  1.336048e-02  3.148656e-03
##  [7,] -9.577280e-04 -1.644039e-05  9.326065e-03 -6.369157e-04
##  [8,]  1.023449e-05  2.440429e-05 -3.326487e-03  8.979042e-05
##  [9,]  2.880422e-05 -6.900311e-06  7.083214e-04 -6.227256e-06
## [10,] -9.151249e-06  1.295840e-06 -1.058609e-04 -1.088811e-06
## [11,]  1.838646e-06 -1.662300e-07  8.771855e-06  5.405975e-07
## 
## $d_sp
##               d_dax         d_wig         d_bux          d_sp
##  [1,]  0.000000e+00  0.000000e+00  0.000000e+00  7.183239e+01
##  [2,]  3.370072e+00 -5.533381e+00  3.373759e+02 -9.460232e+00
##  [3,] -4.826734e+00  9.568666e-01 -7.914923e+01  2.374327e-01
##  [4,]  1.236592e+00 -1.559421e-01  1.060372e+01  2.309616e-01
##  [5,] -2.200300e-01  1.606794e-02 -4.774867e-01 -7.863510e-02
##  [6,]  2.592668e-02  1.847684e-04 -2.162945e-01  1.633118e-02
##  [7,] -5.947439e-04 -5.881743e-04  8.261494e-02 -2.372870e-03
##  [8,] -6.826451e-04  1.734022e-04 -1.809225e-02  1.812571e-04
##  [9,]  2.286142e-04 -3.340739e-05  2.781584e-03  2.366764e-05
## [10,] -4.716370e-05  4.435600e-06 -2.477520e-04 -1.328092e-05
## [11,]  6.803611e-06 -2.428548e-07 -1.694334e-05  3.272863e-06
## 
## 
## Lower Band, CI= 0.95 
## $d_dax
##               d_dax         d_wig         d_bux          d_sp
##  [1,] 458.857518309  6.103660e+01  658.67579751  7.655370e+01
##  [2,] -69.959462084 -1.561640e+01    9.49853352 -2.793174e+01
##  [3,] -18.268441895 -3.734535e+00 -166.82990469 -1.858694e+00
##  [4,]  -6.245334410 -1.735814e+00   -2.65876989 -2.295438e+00
##  [5,]  -1.668324347 -6.176101e-01  -12.11938024 -4.880527e-01
##  [6,]  -0.781528653 -2.260330e-01   -2.04501486 -2.483120e-01
##  [7,]  -0.132522995 -2.213773e-02   -1.12688617 -2.593681e-02
##  [8,]  -0.084243977 -2.552439e-02   -0.15415665 -2.807770e-02
##  [9,]  -0.011379311 -2.027751e-03   -0.13863205 -2.974360e-03
## [10,]  -0.009891589 -2.285425e-03   -0.01022338 -3.228228e-03
## [11,]  -0.001062041 -2.151419e-04   -0.01652121 -4.702485e-04
## 
## $d_wig
##              d_dax         d_wig        d_bux         d_sp
##  [1,]   0.00000000  1.043191e+02 520.48236996  1.343138116
##  [2,]  -8.33634088 -2.485265e+01 -79.20203783 -2.718422477
##  [3,] -26.45474392 -2.557028e+00 -42.13165331 -8.509439474
##  [4,]  -2.54557263 -2.101578e+00 -41.49801391 -0.443924083
##  [5,]  -2.13383046 -3.189212e-01  -0.85375268 -0.749270197
##  [6,]  -0.43633413 -2.068991e-01  -3.26396498 -0.109621453
##  [7,]  -0.21778025 -3.374465e-02  -0.36359355 -0.065295032
##  [8,]  -0.03568056 -2.147004e-02  -0.27338772 -0.012255683
##  [9,]  -0.02019006 -2.587591e-03  -0.05186512 -0.007181781
## [10,]  -0.00455383 -2.535341e-03  -0.02494316 -0.001404348
## [11,]  -0.00235610 -2.356775e-04  -0.00476773 -0.000761178
## 
## $d_bux
##               d_dax         d_wig         d_bux          d_sp
##  [1,]  0.000000e+00  0.000000e+00  1.166580e+03  4.770139e+00
##  [2,] -7.111034e+01 -1.842384e+01 -2.205320e+02 -1.704738e+01
##  [3,] -1.211761e+01 -2.429532e+00 -7.213277e+01 -2.753023e+00
##  [4,] -1.365601e+00 -3.556411e-01 -8.518799e+00 -7.891147e-01
##  [5,] -9.240074e-01 -2.970059e-01 -7.407685e+00 -3.058073e-01
##  [6,] -1.206416e-01 -3.870960e-02 -1.372364e+00 -4.319880e-02
##  [7,] -1.096284e-01 -3.385730e-02 -3.052761e-01 -4.047704e-02
##  [8,] -1.182778e-02 -4.005680e-03 -1.588238e-01 -3.428218e-03
##  [9,] -1.216264e-02 -3.737311e-03 -3.360183e-02 -3.833082e-03
## [10,] -9.047185e-04 -3.409564e-04 -9.496231e-03 -2.135924e-04
## [11,] -1.497671e-03 -3.525320e-04 -1.519009e-03 -6.699290e-04
## 
## $d_sp
##               d_dax         d_wig         d_bux          d_sp
##  [1,]  0.000000e+00  0.000000e+00    0.00000000  6.253506e+01
##  [2,] -3.878359e+01 -1.726672e+01  139.21855755 -1.923671e+01
##  [3,] -2.874600e+01 -4.417030e+00 -182.06722250 -4.872700e+00
##  [4,] -6.216897e+00 -2.146011e+00  -10.90529854 -1.868476e+00
##  [5,] -2.334852e+00 -2.914124e-01  -12.44365637 -5.405827e-01
##  [6,] -7.639790e-01 -2.102416e-01   -3.07248164 -2.225815e-01
##  [7,] -2.493716e-01 -1.921979e-02   -1.11246493 -4.334117e-02
##  [8,] -9.171190e-02 -1.634203e-02   -0.23836086 -2.708014e-02
##  [9,] -1.559014e-02 -3.106407e-03   -0.13637512 -3.215627e-03
## [10,] -1.100223e-02 -2.741967e-03   -0.01446433 -3.771127e-03
## [11,] -9.804588e-04 -3.041889e-04   -0.01943954 -3.247379e-04
## 
## 
## Upper Band, CI= 0.95 
## $d_dax
##              d_dax        d_wig        d_bux         d_sp
##  [1,] 5.495225e+02 94.824693715 1.259714e+03 1.051161e+02
##  [2,] 4.602786e+01 14.860309884 3.738647e+02 2.877378e+00
##  [3,] 2.016330e+01  4.942920749 2.980942e+00 7.248690e+00
##  [4,] 5.953383e+00  1.916046256 5.324749e+01 1.180280e+00
##  [5,] 2.436564e+00  0.673012087 2.890540e+00 7.590955e-01
##  [6,] 3.354158e-01  0.107166255 3.460931e+00 1.162524e-01
##  [7,] 2.674521e-01  0.076649892 8.381738e-01 8.299462e-02
##  [8,] 4.218173e-02  0.006167104 3.912997e-01 9.250010e-03
##  [9,] 2.918965e-02  0.007523778 3.695942e-02 9.288975e-03
## [10,] 4.879407e-03  0.001040663 4.729387e-02 1.040038e-03
## [11,] 3.328748e-03  0.000770378 3.127256e-03 1.123139e-03
## 
## $d_wig
##              d_dax        d_wig        d_bux         d_sp
##  [1,] 0.000000e+00 1.241646e+02 8.027255e+02 1.944301e+01
##  [2,] 1.186143e+02 9.398839e+00 3.417081e+02 2.692448e+01
##  [3,] 5.920153e+00 6.471089e+00 6.641239e+01 8.374373e-01
##  [4,] 7.052835e+00 7.515693e-01 5.000668e+00 2.448689e+00
##  [5,] 1.402591e+00 6.476964e-01 1.286826e+01 2.619691e-01
##  [6,] 6.741711e-01 1.088454e-01 5.835734e-01 2.187436e-01
##  [7,] 1.415525e-01 6.923547e-02 9.103630e-01 4.069456e-02
##  [8,] 6.024867e-02 9.021536e-03 1.020129e-01 2.277560e-02
##  [9,] 1.284182e-02 7.365934e-03 8.064455e-02 3.725126e-03
## [10,] 6.896215e-03 7.875859e-04 1.514085e-02 2.901648e-03
## [11,] 2.071472e-03 8.746682e-04 7.964889e-03 4.428328e-04
## 
## $d_bux
##              d_dax        d_wig        d_bux         d_sp
##  [1,] 0.000000e+00 0.000000e+00 1.430346e+03 2.846751e+01
##  [2,] 4.496843e+01 1.845816e+01 1.911389e+02 9.386748e+00
##  [3,] 9.533396e+00 2.038687e+00 3.675236e+01 3.693377e+00
##  [4,] 4.790988e+00 9.498824e-01 2.872836e+01 8.991459e-01
##  [5,] 3.130938e-01 1.047824e-01 3.872012e+00 2.065857e-01
##  [6,] 2.606236e-01 9.437198e-02 1.385189e+00 1.210910e-01
##  [7,] 3.298371e-02 1.378948e-02 4.811754e-01 1.466751e-02
##  [8,] 3.926063e-02 1.129542e-02 7.759632e-02 1.268519e-02
##  [9,] 3.265359e-03 1.539743e-03 3.374615e-02 7.728786e-04
## [10,] 4.557453e-03 1.233098e-03 8.979823e-03 1.708177e-03
## [11,] 2.593232e-04 7.710177e-05 2.467822e-03 5.025085e-05
## 
## $d_sp
##              d_dax        d_wig        d_bux         d_sp
##  [1,]  0.000000000 0.0000000000 0.000000e+00 78.974881596
##  [2,] 56.730205938 9.3543912803 5.199206e+02  3.270890285
##  [3,] 19.270655915 6.4716799330 1.147422e+01  5.444753689
##  [4,]  7.373628226 1.5568350860 4.723036e+01  1.946042280
##  [5,]  2.119368193 0.6693923791 6.953211e+00  0.655896089
##  [6,]  0.762341188 0.0910102826 3.717288e+00  0.187751318
##  [7,]  0.259401854 0.0615987291 7.677082e-01  0.077535483
##  [8,]  0.066649342 0.0092285525 3.878253e-01  0.012379947
##  [9,]  0.032030312 0.0062676066 6.441198e-02  0.011699538
## [10,]  0.003822344 0.0012150643 5.414726e-02  0.001410589
## [11,]  0.003781513 0.0009369657 5.092262e-03  0.001202003
plot(irf)