# Granger Causality Testing With Panel Data

I'm trying to apply a Granger Causality test to panel data. I've found enough literature to understand that topic. However, I've been unable to find and R package to carry out that analysis. I'm wondering if anybody know whether there is around any package to deal with that. Thanks!

### I'm adding a potential solution, but new questions arose.

The solution that I found is apply a Granger Non- Causality test and using Generalized Method of Moments (GMM). In the Erdil & Yetkiner’s (2004) paper you can find a description of Granger non-causality test with panel data. To perform a GMM I used the plm package for R. If you have a look at its tutorial (Croissant & Millo, 2008), you’ll see that the built-in function pgmm (page 17) removes the individual effect by the first difference and time dummies are included. The function’s summary also provides some tests to assess the model. For instance, to check serial autocorrelation in the residuals, Wald tests for coefficients and for time dummies and the Sargan test to evaluate if there is correlation between the instrumental variable and the residuals. Then I performed a Wald test (the first one in Erdil & Yetkiner, 2004) with the sum of squared residuals of an unrestricted model (SSRu) and of a restricted model (SSRr). Now, my questions for the audience are:

1) Do the time dummies remove the time effect? I think so.

1.1) What if the time dummies aren't significant?

2) Therefore, if I got rid of the individuals and time effects, is the Wald test (SSRr-SSRu) be as a Wald test applied to an OLS model? I think so. If so, I’m not sure about the freedom degrees. Let’s see first the test suggested by Erdil & Yetkiner (2004):

$$W=\frac{(SSRr-SSRu)/Np}{SSRu/[NT-N(1+p)-p]}$$

where N= number of individuals, T=years and p=number of lags. Note that they didn’t get rid of individuals and time effects (at least that's what I understood). Now, if I got rid of individuals and time effects the Wald test as applied to OLS models would be: $$W=\frac{(SSRr-SSRu)/m}{SSRu/ (n-k)}$$ where m= number of restrictions (number of coefficients that were removed from the unrestricted model to turn it restricted), k= total number of coefficients in the unrestricted model and n= number of observation.

More questions:

3) What is number of observation?

3.1) Is it the number of year or number of years*number of individuals? If it is number of years it seems reasonable, but if it is the product between years and individual it doesn’t. For example, in my case I have 328 individual and 13 years, so it is 4264; therefore, the numerator in the Wald test will be very, very small and I’ll be rejecting everything.

Finally,

4) Am I right doing as I did?

Again, any help will be much appreciated

• For non-panel data Granger causality test is a simple F-test of a certain regression. I surmise it should be something similar for panel data. Maybe there is no package because it is not necessary? Nov 7, 2013 at 7:47
• Even though Granger causality test may be manually carried out for non-panel data, there are some packages that perform that test (e.g. Package lmtest, function grangertest). Regarding panel data, it seems to be not that simple (e.g. ...Short Panel Granger Causality Tests...). There are several additional considerations to take into account. However, it just may be the fact that I'm overwhelmed and I'm unable to properly code the procedures. Nov 8, 2013 at 22:07
• In the development version of the R package plm, there is a function called pgrangertest to perform the panel Granger causality test by Dumitrescu/Hurlin (2012). Oct 1, 2017 at 10:16
• Hi @Helix123, thanks for the tip, I'll have a look at this function. Oct 5, 2017 at 2:47
• The lasted official CRAN release of R package plm (version 1.6-6) now contains the function pgrangertest to perform the panel Granger causality test by Dumitrescu/Hurlin (2012). Nov 11, 2017 at 13:40