3.4

3.4 | 5 ratings Rate this file 96 Downloads (last 30 days) File Size: 2.31 KB File ID: #25467

Granger Causality Test

by

 

01 Oct 2009 (Updated )

Conducts a Granger Causality test using the Bayesian Information Criterion to select lag length

| Watch this File

File Information
Description

GRANGER_CAUSE is a Granger Causality Test. The null hypothesis is that the y does not Granger Cause x. A user specifies the two series, x and y, along with the significance level and the maximum number of lags to be considered. The function chooses the optimal lag length for x and y based on the Bayesian Information Criterion. The function produces the F-statistic for the Granger Causality Test along with the corresponding critical value. We reject the null hypothesis that y does not Granger Cause x if the F-statistic is greater than the critical value. Type help granger_cause to learn more.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
30 Mar 2014 Weihai Yu

Dear Chandler

Thank you for your great contribution.
Yet I have a question concerning calculating F-statistic,
the parameters for numerator and denominator as at the end of the function
are y_lag and x_lag+y_lag+1.
I read in Wikipedia which says "the simple linear model y = mx + b has p=2 ", if Wikipedia
is right, then the parameters should be "y_lag+1 and x_lag+y_lag+2"

could you please explain this in a simple way? I am quite confused.
*http://en.wikipedia.org/wiki/F-test

04 Feb 2012 LangS

This function uses Matlab function "regress" which assumes a constant term(intercept) in the linear regression and therefore violates Granger causality definition(See Granger's original paper, Econometrica 37:3 424-438, 1969).

I applied this function on two random numbers series (10 time points, lag = 2) and repeated 1000 times (every time the two series are different), and set the alpha value as 0.05. Among the 1000 tests, 400 were found to have "Granger causality"! So I think the result is not reliable.

05 Aug 2011 Wolfgang

Dear Chandler, I have gratefully downloaded your script. How would it be possible to also include a stationarity check into the routine or would you recommend to check stationarity of the series beforehand? Many thanks, Wolfgang

18 Mar 2010 Chandler

William, there was a small error in the selection of the lag lengths using the BIC. It should be fixed as of 03/18/2010

20 Feb 2010 William Gruner

This appears to calculate the same x and y lags regardless of the actual lags present between the two vectors. In addition, the F statistic generated by the function only appears valid for specific (small) lags. The test I used involved a simple pair of sinusoids phase-shifted to various degrees with and without a small amount of Gaussian noise.

02 Oct 2009 Luna Bella

I like how the author uses the Bayesian Information criterion to select the lag length which is a consistent model selection criterion

Updates
20 Oct 2009

A correction was made in the calculation of the critical value from the F-distribution

18 Mar 2010

There was an error in selecting the lag length for the BIC. It is now fixed. I would like to thank Mads for pointing out the bug.

18 Mar 2010

There was an error in the calculation of the lengths of the BIC. It is now fixed. I would like to thank Mads for pointing out the bug.

Contact us