 View Question
Q: Granger causality test ( Answered,   1 Comment ) Question
 Subject: Granger causality test Category: Science > Math Asked by: causality-ga List Price: \$5.00 Posted: 16 Jun 2002 16:03 PDT Expires: 23 Jun 2002 16:03 PDT Question ID: 27621
 ```I'm looking for a step-by-step explanation on how to perform a Granger causality test using SPSS, Mathematica, Java or Perl.``` Clarification of Question by causality-ga on 16 Jun 2002 16:09 PDT ```This page contains some general Granger-information and a Granger causality test for SAS: http://www.sas.com/rnd/app/examples/ets/granger/ If you're familiar with SAS then it's probably quite easy to port it to Mathematica. Help me do it! :-)``` ```Hello, You need to understand 2 things to answer this: First, you need to know what the Granger test is. Second, you need to know about the LAG function in SPSS. If you don't know how the Granger test works, request clarification, and I will tell you. (I have consulted Gujaratim D.N., 1995, Basic Econometrics, 3rd Ed. McGraw Hill, p620, to find out how to do the test.) The tricky part in SPSS is knowing about the LAG function. The lag of a variable is the score on the previous case in the dataset in SPSS, so: X lag(X) 3 6 6 7 7 2 2 [missing] When you know this, the Granger test is straightforward. If that's not enough, request clarification, and I will add more. Hope that helps, jeremymiles-ga``` Clarification of Answer by jeremymiles-ga on 17 Jun 2002 11:18 PDT ```After writing it, I realised you probably needed more than that, so here goes. I will explain this in SPSS. Not everything can be done automatically, so you have to do a bit of work yourself. (That's the price you pay for using SPSS, not SAS.) Say your two variables that you want to test the direction of causality are called A and B. Create a variable which is the lag of A (let's call it LAG_A) and another which is the lag of B (let's call it LAG_B. In SPSS syntax: Compute lag_A = lag(A). Compute lag_B = lag(A). Now run a regression analysis, where A is the DV, and lag_A is the IV. This is the unrestricted resgression. Look at the residual sum of squares from this analysis, and call this RSS_r. Now run another regression analysis, where A is the DV, and lag_A and lag_B are the IVs - this is the unrestricted analysis. Look at the residual sum of squares from this analysis, and call it RSS_ur. Now, you need to calculate F: F=((RSS_r-RSS_ur)/m)/(RSS_ur/(n-k)) Where m is the number of lagged terms - currently 1, but we will come back to that. n is the number of cases in the analysis (careful, because you have lost one, because of the lag), and k is the number of parameters in the unrestricted regression (i.e. 2 in this case.) This F is distributed with m, n-k df. You can include more lagged terms - lag_2a = lag(lag(A)), for example. hence m will increase. Always include both the A and B lagged terms in the equation. You can also include other covariates - include them in both analyses. When you have done that, do it all again backwards. If one is significant, you have unidirectional causality. If both are, you have bidirectional causality (or feedback), if neither are, you have independence. I hope all that makes sense - if not request clarification. It could be done in Jave or Perl, but you would need to either write, or find, the algorithms to do the appropriate matrix algebra - and that might be another question. You would also need to know the algebra to do, and that's probably another question yet. jeremymiles-ga``` ```I’m assumin’ that you’ve run through the folling sites…..seeing as I have no clue for what you’re searchin’. http://www.sas.com/rnd/app/examples/ets/granger/sas.htm http://www.vision.net.au/~daly/granger.htm http://www.tamu.edu/perc/0003.pdf http://economics.rutgers.edu/gradprogram/Vita/RadckDiss.pdf http://www.econ.keio.ac.jp/staff/seko/AsRES/vol_1.htm If not, here’s a standard google search with most of the terms that you entered. I would assume that at least some of the former or latter make a wee bit of sense to you? ://www.google.com/search?as_q=&num=10&hl=en&ie=UTF8&oe=UTF8&btnG=Google+Search&as_epq=granger+causality+test&as_oq=SPSS%2C+Mathematica%2C+Java+or+Perl.+&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=&safe=images``` 