Time series
Granger causality
A Granger test asks whether lags of one series improve forecasts of another within a declared information set.
The task
Task statement
Test whether y2 Granger-causes y1 with two lags using the aligned OLS F-test. Report rows F, df_num, df_den, and p_value.
Data
Columns: t, y1, y2.
- Files
- input.csv
Required output
Scored estimates: F, df_num, df_den, p_value.
Reference output
| Term | Reference estimate | Sample size |
|---|---|---|
F | 2.8101012 | 198 |
df_num | 2 | 198 |
df_den | 193 | 198 |
p_value | 0.062664313 | 198 |
A run succeeds when every scored estimate lies within 1 percent or 0.005 of its reference value, whichever is larger. Sample sizes are not scored.
Task success
| Agency condition | Claude Sonnet 4.6 | GPT-5.6 Luna |
|---|---|---|
| Chatbot | 96.7% | 98.3% |
| Self-repair | 98.3% | 100.0% |
| Constrained agent | 100.0% | 100.0% |
- All runs
- 98.9% of 360 runs
- By prompt condition
- Zero-shot 98.3%, One-shot 99.4%
- By software
- Python 100.0%, R 100.0%, Stata 96.7%
A prediction question
Let the equation for $y_t$ include two lags of both $y$ and $x$:
The test imposes the joint restriction
Rejection means that lagged $x$ adds predictive information after the included history of $y$ (Granger, 1969).
Restricted and unrestricted fits
Suppose the unrestricted residual sum of squares is 90. The restricted value is 100. There are two restrictions, 100 usable observations, and five unrestricted coefficients.
| Quantity | Value |
|---|---|
| RSS restricted | 100 |
| RSS unrestricted | 90 |
| Restrictions | 2 |
| Residual degrees of freedom | 95 |
The comparison statistic is
Assumptions and implementation
The VAR should have a suitable lag order and stable dynamics. Innovations require an appropriate covariance model. Omitted relevant variables can change the predictive relation.
The result describes predictability. Structural causal interpretation needs additional restrictions. Software can report Wald, likelihood-ratio, or equation-level F forms with different finite-sample denominators.
The restricted information set sits inside the unrestricted set. Their forecast-error difference drives the test.
Interpretation and reporting
The statistic of $5.278$ measures how much the restricted equation loses fit after both lags of $x$ are removed. The restriction is joint. One lag can be weak while the pair still adds predictive information.
State the direction of the test. Evidence that $x$ predicts $y$ does not imply that $y$ predicts $x$. Report the variable set, lag order, usable time range, covariance estimator, and restriction list.
Granger causality is a prediction concept within the declared information set. An omitted series can create or remove the relation. Structural causal language requires further assumptions about shocks, timing, and intervention.
Reproducible implementation
Transform each series as required for stable VAR dynamics and align them on one time index. Select or declare the lag order before running the joint test. Keep the restricted and unrestricted equations on the same rows.
Estimate the unrestricted equation and test all coefficients on lagged $x$ together. Refit the restricted equation to verify the displayed RSS comparison when that form applies.
Check residual serial correlation and VAR stability. Repeat the reverse-direction test under its own restriction. Compare in-sample findings with out-of-sample forecast performance when prediction is the goal. Save lag definitions because software conventions can label the first usable observation differently (Lutkepohl, 2005).
Further reading
Granger defines the predictive concept (Granger, 1969). Lütkepohl develops testing in vector autoregressions (Lutkepohl, 2005).
Sources and further reading
- Clive W. J. Granger. 1969. “Investigating Causal Relations by Econometric Models and Cross-Spectral Methods.” Econometrica 37(3): 424–438. doi:10.2307/1912791.
- Helmut Lutkepohl. 2005. New Introduction to Multiple Time Series Analysis. Springer. doi:10.1007/978-3-540-27752-1.
About this benchmark task
- Method group
- Time series
- Software
- Stata, R, and Python
- Runs
- 360 runs, ten in each combination of model, software, prompt, and agency condition