*! caustests v1.1.0 22feb2026

Title

caustests -- Granger Causality Tests: Toda-Yamamoto, Fourier, and Quantile Variants

Syntax

caustests
varlist (min=2, time series)
[,
options]

Required
test(#) test type (1–7); see Tests

Optional
pmax(#) maximum lag order; default pmax(8)

ic(#) information criterion: 1=AIC (default), 2=SBC

nboot(#) bootstrap replications; default nboot(1000)

kmax(#) maximum Fourier frequency; default kmax(3)

dmax(#) integration order for TY augmentation; default auto

quantiles(numlist) quantiles for tests 6–7; default 0.1(0.1)0.9

graph produce causality graphs (tests 6 and 7 only)

noheader suppress header output

scheme(name) graph scheme; default s1color

Description

caustests implements seven Granger causality tests for multivariate time
series data. Tests 1–5 extend the classical Granger (1969) framework using
the Toda-Yamamoto (1995) lag-augmentation approach and/or Fourier
approximations to capture smooth structural breaks of unknown form.
Tests 6 and 7 extend the analysis to the full conditional distribution
via quantile regression.

All tests report bootstrap p-values from residual resampling under H0.
Tests 1–5 also report asymptotic chi-squared p-values.
Optimal lag length and Fourier frequency (where
applicable) are selected by minimizing AIC or SBC.

For a system with k variables, caustests tests all k(k-1)
directional causality hypotheses simultaneously.

Tests

Summary — estimation in levels vs. first differences:

Tests 1, 3, 5, 6, 7: estimated in levels (d_max >= 1, TY augmentation)

Tests 2, 4: estimated in first differences (d_max = 0)

test(1) — Toda-Yamamoto (1995) Causality Test

Estimates VAR(p+d_max) in levels. The Wald test is applied to the
first p lags of each candidate causal variable, ignoring the extra
d_max augmented lags. Valid regardless of the integration or
cointegration properties of the series. Output: Wald, AIC/SBC optimal lag,
asymptotic and bootstrap p-values.

test(2) — Single Fourier-Frequency Granger Causality Test (Enders & Jones, 2016)

Estimates VAR in first differences (d_max=0) with the intercept
modeled as a single Fourier frequency:
α(t) = α₀+γ₁sin(2πkt/T)+γ₂cos(2πkt/T).
Optimal frequency k*∈{1,...,kmax} selected jointly with lag p by AIC/SBC.

test(3) — Single Fourier-Frequency Toda-Yamamoto Test (Nazlioglu et al., 2016)

Combines test(2) Fourier intercept with the TY lag augmentation in
levels (d_max=1). Primary innovation: robust to non-stationarity
AND smooth structural breaks simultaneously.

test(4) — Cumulative Fourier-Frequency Granger Causality Test (Enders & Jones, 2019)

VAR in first differences. Intercept modeled with cumulative Fourier
terms up to frequency k*:
α(t) = α₀+Σ_^[γ₁ⱼsin(2πjt/T)+γ₂ⱼcos(2πjt/T)].
Better approximation for multiple or complex structural changes.

test(5) — Cumulative Fourier-Frequency Toda-Yamamoto Test (Nazlioglu et al., 2019)

Combines test(4) cumulative Fourier approximation with TY augmentation in
levels (d_max=1). Most general Fourier-TY test.

test(6) — Toda-Yamamoto Causality Test in Quantiles (Cai et al., 2023)

Quantile extension of the TY test. Estimates:
Q_(τ|·) = c(τ) + Σ_^

θ_i(τ)y_ + Σ_^

ρ_j(τ)x_
Then tests H₀: ρ₁(τ)=…=ρ_p(τ)=0. Detects causality at specific quantiles
of the conditional distribution (e.g., lower/upper tails), revealing
heterogeneous causal relationships invisible to mean-based tests.
The quantile regression Wald statistic is displayed; bootstrap p-values
are computed via quantile regression residual resampling under H0.

test(7) — Bootstrap Fourier Granger Causality in Quantiles (BFGC-Q) (Cheng et al., 2021)

Most comprehensive test. Extends test(6) by adding Fourier terms:
Q_(τ|·) = γ₀(τ)+γ₁(τ)sin(2πk*t/T)+γ₂(τ)cos(2πk*t/T)
+ Σ_^

θ_i(τ)y_ + Σ_^

ρ_j(τ)x_
H₀: ρ₁(τ)=…=ρ_

(τ)=0. Optimal (k*,p*) selected jointly.
Robust to: non-stationarity (TY augmentation), structural breaks (Fourier),
and distributional heterogeneity (quantile regression).
The quantile regression Wald statistic is displayed; bootstrap p-values
are computed via quantile regression residual resampling under H0.

Options

pmax(#) specifies the maximum number of lags to consider for AIC/SBC selection. Default is 8. The optimal lag is selected by minimizing the chosen information criterion.

ic(#) selects the information criterion for optimal lag and frequency selection.
1 = Akaike Information Criterion (AIC, default).
2 = Schwarz-Bayesian Criterion (SBC).

nboot(#) sets the number of bootstrap replications used to compute bootstrap p-values. Default is 1000. Use at least 999 for publication.

kmax(#) sets the maximum Fourier frequency searched (tests 2–5, 7). For each frequency k∈{1,...,kmax}, the implied number of Fourier components is 2 for single (tests 2,3) and 2k for cumulative (tests 4,5,7). Default is 3.

dmax(#) overrides the automatic setting of the maximum integration order for TY augmentation. By default: d_max=0 for tests 2,4 (Granger in differences) and d_max=1 for tests 1,3,5,6,7 (TY in levels).

quantiles(numlist) specifies the quantiles at which to evaluate causality for tests 6 and 7. Each value must be strictly between 0 and 1. Default is 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9.

graph produces two combined graphs for tests 6 and 7: (1) Wald statistics across quantiles for each causal direction, and (2) bootstrap p-values across quantiles with significance threshold lines.

noheader suppresses the descriptive test header.

scheme(name) specifies the graph scheme for figures (default: s1color).

Examples

Setup:

. webuse lutkepohl2, clear

. tsset qtr

Toda-Yamamoto test:

. caustests dln_inv dln_inc dln_consump, test(1) pmax(4)

Single Fourier Toda-Yamamoto (Nazlioglu et al. 2016):

. caustests dln_inv dln_inc, test(3) pmax(4) kmax(3) nboot(1000)

Cumulative Fourier Toda-Yamamoto (Nazlioglu et al. 2019):

. caustests dln_inv dln_inc dln_consump, test(5) pmax(4) kmax(3)

Quantile Toda-Yamamoto (Cai et al. 2023):

. caustests dln_inv dln_inc, test(6) pmax(4)

quantiles(0.10 0.25 0.50 0.75 0.90) nboot(1000) graph

BFGC-Q (Cheng et al. 2021):

. caustests dln_inv dln_inc dln_consump, test(7) pmax(4) kmax(3)

quantiles(0.10 0.25 0.50 0.75 0.90) nboot(1000) graph

Using SBC instead of AIC:

. caustests y1 y2 y3, test(3) pmax(6) ic(2) nboot(2000)

Stored Results

caustests stores the following in e():

Scalars:

e(test) test number (1–7)

Tests 1–5 (OLS):

e(wald) Wald statistics (k(k-1)×1)

e(pval_a) asymptotic chi-squared p-values

e(pval_b) bootstrap p-values

e(lags) optimal lag orders

e(freq) optimal Fourier frequencies (0 for tests 1, 6)

Tests 6–7 (Quantile):

e(wald_q) Wald statistics (dirs×quantiles)

e(pval_bq) bootstrap p-values (dirs×quantiles)

e(lags_q) optimal lag orders (dirs×1)

e(freq_q) optimal Fourier frequencies (dirs×1, test 7 only)

References

Granger, C.W.J. (1969). Investigating causal relations by econometric models
and cross-spectral methods. Econometrica 37: 424–438.

Toda, H.Y., Yamamoto, T. (1995). Statistical inference in vector autoregressions
with possibly integrated processes. Journal of Econometrics 66: 225–250.

Enders, W., Jones, P. (2016). Grain prices, oil prices, and multiple smooth
breaks in a VAR. Studies in Nonlinear Dynamics and Econometrics.
doi:10.1515/snde-2014-0101.

Nazlioglu, S., Gormus, A., Soytas, U. (2016). Oil prices and real estate
investment trusts: Gradual-shift causality and volatility transmission analysis.
Energy Economics 60: 168–175.

Nazlioglu, S., Soytas, U., Gormus, A. (2019). Oil prices and monetary policy
in emerging markets: Structural shifts in causal linkages.
Emerging Markets Finance and Trade 55: 105–117.

Cai, Y., Chang, H.W., Xiang, F., Chang, T. (2023). Can precious metals hedge
the risks of Sino-US political relation? Evidence from Toda-Yamamoto causality
test in quantiles. Finance Research Letters 58: 104327.

Cheng, K., Hsueh, H.P., Ranjbar, O., Wang, M.C., Chang, T. (2021).
Urbanization, coal consumption and CO2 emissions nexus in China using bootstrap
Fourier Granger causality test in quantiles.
Letters in Spatial and Resource Sciences 14: 31–49.

Efron, B. (1979). Bootstrap methods: Another look at the jackknife.
Annals of Statistics 7: 1–26.

Author

Dr Merwan Roudane

E-mail: merwanroudane920@gmail.com

The author makes no performance guarantees. For bug reports or suggestions, please send an e-mail to the address above.

Also see

var, vargranger, qreg, varsoc