So in this lecture, we will be looking at a notebook to demonstrate Granger causality.
Note that the beginning of this notebook is very similar to the previous notebook on econometrics,
so we won't repeat that analysis.
Simply recall that we are looking at two quarterly time series The Difference GDP and the term spread.
Recall that the GDP has a strong trend, which is why we took the difference and the term spread, it
looks like it might be cyclical.
So let's go to the part where we actually do the tests.
Now, at this point, you should be asking the question, what is the direction of the Granger causality?
We know that we're going to pass in a two time series and we know that we're going to get significant
P values if one of the time series affects the other.
But is it the first time series that affects the second or the second time series that affects the first?
In order to know this, you have to check the documentation, which I've pasted in this notebook.
The states that the test is for whether or not the second column affects the first.
So in this case, because we've put term spread after GDP growth, we'll be testing whether or not term
spread can forecast GDP growth.
Note that have set the Max Light to 18, which is what we used in the previous notebook.
OK, so we can see that the coefficients are significant at a threshold of five percent for like one.
For like two, they are again, a significant.
For like three, they are again significant.
For like four, they are again, a significant.
Note that this pattern keeps repeating, but only up to a point at the later legs, you'll see that
the P values do not pass this five percent threshold.
Now, let's do the Granger causality test again, but this time let's reverse the order of the columns.
So now we are testing whether GDP growth can forecast term spread.
So this time, note that we see very significant P values for all legs, these p values are much smaller
than the first Test.
So you might be wondering how can this be?
How is it possible that if one variable causes the second, that the second can also cause the first?
This might seem like a paradox, but only if you mistakenly think that this is a test for causality.
Remember that Granger causality is not actually a test of causality, but a test of forecasting ability.
This simply means that these are useful input features for making a forecast.