This function takes an xts formatted bivariate time series as input, automatically determines the amount of lags to be used in the Granger-Causality test using an information criterion after estimating a VAR and then checks for Granger-Causality in both directions. Uses lmtest::grangertest() for the Granger-Causality testing.
1 2 | autoCheckGC(x = NULL, convertToWeekly = F, lagCriterion = "AIC",
useMinLags = F, ...)
|
x |
A bivariate time series of class xts |
convertToWeekly |
If TRUE converts the time series to weekly using xts::to.weekly(). Default FALSE |
lagCriterion |
The information criterion to be used when deciding on the optimal amount of lags based on the estimated VAR. "AIC" by default. Other possible values are "HQ", "SC", and "FPE". Uses vars::VARselect() to estimate the VAR. |
useMinLags |
If TRUE, uses the minimum amount of lags that any of the information criteria suggested. Overrides "lagCriterion". FALSE by default. |
... |
Other parameters to be passed on to other functions, for example to vars::VARselect(). |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.