English

Granger Causality Test: Steps, Interpretation, and a Worked Example

How to check stationarity, select the lag, run the test in both directions, and report the F-statistic, with an interactive example on shallot prices.

Granger Causality Test: Steps, Interpretation, and a Worked Example
Contents
  1. What does Granger causality mean?
  2. The test in two regressions
  3. Step-by-step procedure
  4. Step 1: Check stationarity
  5. Step 2: Select the lag length
  6. Step 3: Run the test in both directions
  7. Step 4: Read and report the result
  8. Worked example: wholesale and retail shallot prices
  9. What earlier real-data analysis showed
  10. Running the test in EViews, R, and Python
  11. Common mistakes
  12. Frequently asked questions
  13. Does Granger causality prove cause and effect?
  14. Which lag length should be used in a Granger causality test?
  15. What if the data are not stationary?
  16. Can Granger causality run in both directions?
  17. What is the difference between Granger causality and cointegration?
  18. References and further reading

Versi bahasa Indonesia: Uji Kausalitas Granger

Short answer: The Granger causality test checks whether the past values of one time series improve the prediction of another series beyond what that series’ own past already explains. If they do, the first series “Granger-causes” the second. The test compares two regressions with an F-test, after the series have been made stationary and the lag length has been selected with an information criterion. It identifies predictive precedence, not true cause and effect.

What does Granger causality mean?

Clive Granger (1969) proposed a simple and testable definition of causality for time series: a variable X causes a variable Y if past values of X contain information that helps predict Y, over and above the information contained in past values of Y. The idea became a standard tool of applied econometrics, and Granger later received the 2003 Nobel Memorial Prize in Economic Sciences, shared with Robert Engle, for his work on time series methods.

The word “causality” is the source of most misinterpretations. A significant result shows that X moves first and that its movements carry predictive information about Y; however, both series may simply respond, at different speeds, to a third factor that is not in the model. Thus, the result is best reported as “X Granger-causes Y” rather than “X causes Y”.

The interactive chart below uses the simulated data of the worked example. Moving the slider shifts the wholesale price forward in time; at a lag of two months, its movements line up with the later movements of the retail price.

Wholesale price Retail price

Move the slider to shift the wholesale price.

The test in two regressions

For a lag length p, the test estimates two models. The restricted model explains Y with its own past only: Yt = a0 + a1Yt−1 + … + apYt−p + et. The unrestricted model adds the past of X: … + b1Xt−1 + … + bpXt−p. The null hypothesis states that all b coefficients are zero, meaning that X does not Granger-cause Y. An F-test compares the residual sums of squares of the two models; a p-value below 0.05 rejects the null hypothesis. The test is then repeated in the opposite direction, because the relationship can be unidirectional, bidirectional, or absent.

Step-by-step procedure

Step 1: Check stationarity

The F-test assumes stationary series. Prices, production, and most macroeconomic variables in levels are not stationary; consequently, a test on levels can produce spurious significance. The Augmented Dickey–Fuller (ADF) test is applied to each series in levels and in first differences. A series that is non-stationary in levels but stationary in first differences is integrated of order one, I(1), and the test is run on the differenced data. When the series are cointegrated and the long-run information in levels matters, the Toda and Yamamoto (1995) procedure is a well-established alternative.

Step 2: Select the lag length

The result depends strongly on the lag length. Instead of choosing a lag arbitrarily, the lag is selected with information criteria from a vector autoregression (VAR) of the two series: the Akaike (AIC), Schwarz (SC), and Hannan–Quinn (HQ) criteria. The lag with the lowest value is preferred. When the criteria disagree, SC usually selects a shorter model and AIC a longer one; both choices can be reported as a robustness check.

Step 3: Run the test in both directions

The test is run for X → Y and for Y → X using the selected lag. Most software reports both directions in one table.

Step 4: Read and report the result

Each direction produces an F-statistic, its degrees of freedom, and a p-value. A complete report states the transformation of the data, the lag length and how it was chosen, and the F-statistic with its p-value for each direction, for example “wholesale prices Granger-cause retail prices (F(2, 64) = 45.31; p < 0.001), whereas the reverse is not significant (F(2, 64) = 1.19; p = 0.31)”.

Worked example: wholesale and retail shallot prices

The example uses 72 months (2019–2024) of simulated wholesale and retail shallot prices in rupiah per kilogram, constructed so that retail prices react to wholesale prices with a delay of about two months. The data are labeled as simulated and can be downloaded for practice: granger-example-shallot-prices.csv.

Simulated monthly wholesale and retail shallot prices from 2019 to 2024 and the correlation of wholesale changes with later retail changes by lag
Simulated prices (left) and the correlation between wholesale changes and retail changes k months later (right).

The ADF test (with a constant) does not reject a unit root in levels, yet rejects it clearly in first differences (Table 1). Both series are therefore I(1), and the test is applied to monthly price changes.

SeriesADF statistic, levelsADF statistic, first differencesConclusion
Wholesale price−1.31−3.72I(1)
Retail price−1.68−3.70I(1)

Table 1. The 5% critical value for this sample size is about −2.90.

All three information criteria select a lag of two months (Table 2), which matches the delay built into the data.

LagAICSCHQ
126.75526.88926.808
226.14526.41326.251
326.25226.65426.411
426.33626.87126.547

Table 2. VAR lag selection on first differences (maximum lag 6; lags 5 and 6 omitted, both higher).

The Granger test results show a clear unidirectional relationship (Table 3). At the selected lag, wholesale price changes Granger-cause retail price changes (F(2, 64) = 45.31; p < 0.001), whereas retail price changes do not Granger-cause wholesale price changes (F(2, 64) = 1.19; p = 0.31). With a lag of one month, the relationship is only marginal (p = 0.068); this underscores why the lag must be selected with a criterion rather than by habit.

LagWholesale → Retail: Fp-valueRetail → Wholesale: Fp-value
13.430.0680.960.330
245.31< 0.0011.190.311
326.67< 0.0010.660.582
420.49< 0.0011.140.348

Table 3. Granger causality tests on first differences of simulated data.

In market terms, price signals in this simulated system travel downstream from wholesalers to retailers with a delay of about two months, and not in the opposite direction. Thus, monitoring wholesale prices would provide an early warning of retail price movements.

What earlier real-data analysis showed

An earlier analysis on Catatan Budi applied the same test to monthly rice prices in North Sumatra from 2016 to 2019 (48 observations, Ministry of Agriculture data). The vertical chain, from the farm-gate price of dry grain to the miller price and the consumer price of rice, showed no Granger causality at a lag of two months. Conversely, the horizontal relationship between two markets in Medan, Aksara and Petisah, was significant: prices at Aksara Granger-caused prices at Petisah. The contrast suggests that price transmission between neighboring retail markets was faster than transmission along the marketing chain. A re-analysis of such data should begin with the stationarity check and lag selection described above.

Running the test in EViews, R, and Python

In EViews, the series are opened as a group, and the test is available under Quick → Group Statistics → Granger Causality Test, where the lag length is entered. The output lists both directions with F-statistics and probabilities.

In R, the lmtest package provides grangertest(retail ~ wholesale, order = 2, data = d), which tests whether wholesale Granger-causes retail. The vars package offers VARselect() for lag selection.

In Python, the statsmodels library provides the test. The column order matters: the function tests whether the second column Granger-causes the first.

import pandas as pd
from statsmodels.tsa.stattools import adfuller, grangercausalitytests

df = pd.read_csv("granger-example-shallot-prices.csv")
d = df[["retail", "wholesale"]].diff().dropna()    # first differences

print(adfuller(df["retail"])[0], adfuller(d["retail"])[0])
res = grangercausalitytests(d, maxlag=2)            # H0: wholesale does not Granger-cause retail

Common mistakes

Five mistakes appear repeatedly in theses and manuscripts: (1) running the test on non-stationary levels without a cointegration-aware procedure; (2) choosing the lag arbitrarily, often lag 1 or lag 2, without an information criterion; (3) testing only one direction; (4) interpreting a significant result as proof of cause and effect; and (5) omitting the lag length, the data transformation, or the degrees of freedom from the report. Each of these mistakes changes either the result or the reader’s ability to verify it.

Frequently asked questions

Does Granger causality prove cause and effect?

No. Granger causality shows that one series helps predict another, which implies temporal precedence. A common driver outside the model, expectations, or omitted variables can produce the same pattern. The result supports, but does not establish, a causal interpretation; theory and institutional knowledge are still required.

Which lag length should be used in a Granger causality test?

The lag should be selected with information criteria (AIC, SC, or HQ) from a VAR of the series. Monthly data commonly require longer lags than annual data. Reporting the result for neighboring lags is a useful robustness check, as Table 3 illustrates.

What if the data are not stationary?

Non-stationary series are usually differenced until they become stationary, and the test is run on the differences. When the series are cointegrated, a vector error correction model or the Toda–Yamamoto procedure preserves the long-run information that differencing removes.

Can Granger causality run in both directions?

Yes. When X Granger-causes Y and Y Granger-causes X, the relationship is bidirectional, which often indicates feedback, for example between prices in two connected markets.

What is the difference between Granger causality and cointegration?

Cointegration concerns a stable long-run relationship between non-stationary series, whereas Granger causality concerns short-run predictive precedence. If two series are cointegrated, Granger causality must exist in at least one direction, which is why the two analyses are often reported together.

References and further reading

  • Granger, C. W. J. (1969). Investigating causal relations by econometric models and cross-spectral methods. Econometrica, 37(3), 424–438.
  • Toda, H. Y., & Yamamoto, T. (1995). Statistical inference in vector autoregressions with possibly integrated processes. Journal of Econometrics, 66(1–2), 225–250.
  • Lütkepohl, H. (2005). New Introduction to Multiple Time Series Analysis. Springer.
  • Indonesian version with the EViews screenshots: Uji Kausalitas Granger: Pengertian dan Contohnya.
  • Stationarity in time series (Indonesian): Uji Stasioneritas Data Time Series.

How to cite this article: Agung Budi Santoso (2026). Granger Causality Test: Steps, Interpretation, and a Worked Example. Catatan Budi. https://agungbudisantoso.com/en/granger-causality-test/

Photo of Agung Budi Santoso

Written by

Agung Budi Santoso

Lecturer in Management & Agribusiness · Universitas Sumatera Utara

A lecturer and researcher who turns statistics, econometrics, and agribusiness research methods into practical, step-by-step notes for students and researchers.

Discussion

No comments yet. Have a question about this topic? Write it below and I will do my best to answer.

Leave a comment

Your email address will not be published.