The basic steps for running this test are as follows:
- Formulate the null hypothesis and its alternative.
- Choose the lags. These can depend on the amount of data you have. One way to choose lags i and j is to run a model order test. It would be easier to pick up multiple values and run the Granger test to see if the results are the similar for different lag levels.
- Also identify the f-value. The two equations can be used to find out whether βj = 0 for all lags j.
The different limitations of this approach are as follows:
- Granger causality is not a true causality
- If X(t) affects Y(t) through a third variable, Z(t), then it is difficult to find Granger causality
Here, we have a multivariate time series dataset called AirQualityUCI
. We have to test whether NOx has a Granger causality of NO2.
Since we don't have a library in Python for multivariate Granger causality, we will do this in R by using the lmtest
package.
Load the lmtest
library. In case the library isn't there, you...