1

I'm running a VAR model in R and found with several tests (arch.test, serial.test) that my model still contains heteroscedasticity and autocorrelation. I took the AIC lag order selection criteria, since I got least heteroscedasticity and autocorrelation compared to HQ, SC, FPE (I'm running a great number of VAR Models) I want to correct the heteroscedasticity and autocorrelation, if possible. Is the HAC estimator possible to use for a VAR Model. And if the answer is yes, how can I implement it in R? If the answer is no, is there any other possibility to get better estimations (other than higher lag order)?

Thank you in advance! Appreciate every help!

Richard Hardy
  • 54,375
  • 10
  • 95
  • 219
Anna
  • 119
  • 5

1 Answers1

1

I think it is possible to use HAC with VAR.

Regarding implementation in R:

  • There are multiple R packages offering VAR estimation, perhaps one of them has the relevant functionality?
  • Otherwise, see packages for multivariate models (seemingly unrelated regression SUR and the like), perhaps they have the functionality. You would have to specify the model manually.
  • Finally, you could do it entirely by hand. VAR can be estimated equation by equation by OLS, so you could just apply HAC equation by equation. This might be the easiest option.

Also, note that arch.test is about autoregressive conditional heteroskedasticity which is not the kind of heteroskedasticity that HAC is designed to deal with. In ARCH, the variance of the error $\varepsilon$ is not a function of the right-hand-side variables (lags of the dependent variable ($X$), so I think a HAC variance estimator would not account for it. You could model autoregressive conditional heteroskedasticity explicitly using a multivariate GARCH model (of which there are many varieties) e.g. using the rmgarch package in R (it allows specifying and estimating the VAR and the multivariate GARCH in one step). You would get more efficient estimates of the VAR coefficients and if you are not directly interested in the time-varying volatility, you could just ignore the fitted multivariate GARCH model afterwards.

Richard Hardy
  • 54,375
  • 10
  • 95
  • 219
  • Thank you, Richard, for the answer! What is the difference between the heteroscedasticity that the HAC estimator tries to rule out and the heteroscedasticity that the arch.test is testing for? Also I tried to model the VAR by hand, because I did it with the vars package (VAR()) before. If I use dynlm() for the OLS I can use vcovHAC, and I get a correlation matrix. I am just not sure how to use this matrix then... – Anna Mar 01 '21 at 07:55
  • @Anna, standard concept of heteroskedasticity (which HAC deals with): variance of the error $\varepsilon$ is a function of the right-hand-side variables so that $\mathbb{E}(\varepsilon^\top X^\top X\varepsilon)\neq\sigma^2 X^\top X$. Autoregressive conditional heteroskedasticity: variance of the error is a function of past errors where $\mathbb{E}(\varepsilon^\top X^\top X\varepsilon)=\sigma^2 X^\top X$ is not violated. – Richard Hardy Mar 01 '21 at 08:09
  • thanks! Do you know which test deals with the standard concept of heteroscedasticity to test my VAR estimation? – Anna Mar 01 '21 at 08:10
  • @Anna, some standard tests are Breusch-Pagan, White and Goldfeld-Quandt tests. – Richard Hardy Mar 01 '21 at 08:14
  • The Breusch-Pagan Test is only possible with the lm() or dynlm() function, but not with VAR(), which I use because of the great amount of VAR models I need to do. The package het.test for the White Test is not available in R anymore and the Goldfeld-Quandt test is also not for varest objects... I need to find another solution with my VAR model I guess... – Anna Mar 02 '21 at 10:30
  • @Anna, you may always do the tests by hand, though obviously this can be a lot of work depending on your experience with these tests and with R. – Richard Hardy Mar 02 '21 at 10:54
  • I finally did my VAR Models also with the function dynlm(), the object resulting by using dynlm() is possible to use for vcovHAC. The result is a covariance matrix. How do I use this covariance matrix in my VAR Model to correct it? – Anna Mar 02 '21 at 14:53
  • @Anna, you keep the point estimates intact, but if you want to test hypotheses, you use the robust covariance matrix instead of the usual one. For t-tests of individual coefficients, you use the square root of the appropriate diagonal element of the robust covariance matrix as your standard error. For F-tests, you also use the off diagonal elements, just as you would with the usual covariance matrix. – Richard Hardy Mar 03 '21 at 09:27
  • Does this mean, that I keep my VAR model as it is. But when I'm testing for Granger causality I use the cov matrix of the HAC estimator? Or only for tests like the Portmanteau or Breusch-Pagan test? – Anna Mar 04 '21 at 13:38
  • @Anna, yes, you keep the model as is and use the robust covariance matrix for all inference based on the model's coefficients. Tests not based on the model's coefficients (like Breusch-Pagan) will not require use of the robust covariance matrix. – Richard Hardy Mar 04 '21 at 13:52
  • But if my VAR Model remains the same, the HAC estimator won't change anything with the results of the Granger causality analysis am I right? And since this is my main goal, I think I do not understand the purpose of using a robust estimator? – Anna Mar 05 '21 at 13:53
  • @Anna, that is not right. Using HAC instead of vanilla standard errors may turn significant coefficients insignifficant and the measured degree of Granger causality from statistically significant into not (and less frequently, the other way around). So it surely can change the substantive conclusions. – Richard Hardy Mar 05 '21 at 14:43
  • I just can not find any answers on how to use the result of the HAC estimator. When using vcovHAC() I reveive a covariance matrix. How do I implement them in my VAR Model and then do model diagnostics or policy simulations like Granger causality with the improved Model? Sorry that I still don't get it. – Anna Mar 08 '21 at 15:32
  • 1
    Assume a bivariate VAR(1) and assume you are interested in testing $H_0\colon x\xrightarrow{Granger}y$. You need to test whether the coefficient in front of $x_{t-1}$ in the equation for $y_t$, call it $\varphi_{2,1}$ is $=0$. You have to find the diagonal element of the HAC covariance matrix corresponding to this coefficient, say $\hat\sigma_{j,j}$. You can then use it for constructing the test statistic $t=\frac{\hat\varphi_{2,1}}{\sqrt{\hat\sigma_{j,j}}}$. $t$ will be asymptotically $N(0,1)$ under $H_0$. – Richard Hardy Mar 08 '21 at 20:31
  • 1
    Assuming a bivariate VAR(p), you need to test a joint hypothesis $H_0\colon \varphi_{2,1}=...=0$ where the dots contain coefficients in front of all the lags of $x_t$ (except for the first lag which is already represented by $\varphi_{2,1}$) in the equation of $y_t$. You can do an $F$-test using the HAC covariance matrix just like you would using the normal covariance matrix. You can look up the construction of the $F$ statistic in a textbook. Also, there is absolutely nothing to be sorry about :) – Richard Hardy Mar 08 '21 at 20:35
  • 1
    Assuming a VAR with dimension above 2 ($x,y,z,\dots$) makes it harder, and your equation-by-equation HAC covariance matrices might not suffice -- unless you care about $x\xrightarrow{Granger}y$ where $x$ and $y$ are univariate time series just like above. But outside this simple case, you might need a system-wide HAC covariance matrix (one that represents all equations at once). – Richard Hardy Mar 08 '21 at 20:38
  • Okay thank you Richard! Can you recommend a textbook that describes all these steps in detail? I was searching for it, but only found some with general information about HAC estimator, but not its implementation in Granger causality analysis for example. – Anna Mar 09 '21 at 06:33
  • @Anna, it may be useful to note that testing Granger causality follows the same procedure regardless of whether you have vanilla or HAC covariance matrix. So you could find a textbook chapter/section on Granger causality and substitute HAC cov. mat. for vanilla cov. mat. where needed. Some books are [here](https://stats.stackexchange.com/questions/20514/books-for-self-studying-time-series-analysis). Among them, I like [Lutkepohl](https://stats.stackexchange.com/questions/20514/books-for-self-studying-time-series-analysis). – Richard Hardy Mar 09 '21 at 06:40