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):


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.


4) Am I right doing as I did?

Again, any help will be much appreciated

  • $\begingroup$ 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? $\endgroup$
    – mpiktas
    Nov 7, 2013 at 7:47
  • $\begingroup$ 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. $\endgroup$
    – Rafael
    Nov 8, 2013 at 22:07
  • 1
    $\begingroup$ 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). $\endgroup$
    – Helix123
    Oct 1, 2017 at 10:16
  • $\begingroup$ Hi @Helix123, thanks for the tip, I'll have a look at this function. $\endgroup$
    – Rafael
    Oct 5, 2017 at 2:47
  • 1
    $\begingroup$ 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). $\endgroup$
    – Helix123
    Nov 11, 2017 at 13:40

1 Answer 1


There is actually an R package for this here based on a paper by Dumitrescu and Hurlin. This paper provides a clear and succinct explanation of the test.

Unfortunately, it does not accommodate multivariate models. The main idea, though, would be the same - run separate Granger tests on each unit, get the mean Wald statistic, and get a Z score using the formulas or bootstrapping as in the paper.

I'm working on a Python library to do the multivariate test and can link you to my Github when I'm done!

  • 1
    $\begingroup$ thanks for your answer and nice to hear you're working on that packages. My Python skills are pretty limited, so for now, I wouldn't bother you with access to your Github. It's appreciated it anyway - Rafael $\endgroup$
    – Rafael
    May 4, 2021 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.