*! version 1.0.0 08mar2026

Title

xtpcaus -- Panel Causality Tests: Panel Fourier Toda-Yamamoto (PFTY)
and Panel Quantile Causality (PQC)

Syntax

xtpcaus depvar
[if] [in],
test(pfty|pqc)
[options]

Required
test(string) test type: pfty for Panel Fourier Toda-Yamamoto
or pqc for Panel Quantile Causality

Common options
pmax(#) maximum lag order for AIC/SBC selection; default is 4

dmax(#) maximum integration order (extra lags for Toda-Yamamoto augmentation); default is 1

nboot(#) number of bootstrap replications; minimum 99; default is 1000

seed(#) random-number seed for reproducible bootstrap results

nograph suppress graphical output

notable suppress tabular output

level(#) confidence level for significance; default is 95

scheme(string) Stata graph scheme; default is s1color

PFTY-specific options
kmax(#) maximum Fourier frequency to search over; default is 3

ic(aic|sbc) information criterion for joint lag and frequency selection; default is aic

PQC-specific options
quantiles(numlist) quantile grid for testing; values must be strictly between 0 and 1;
default is 0.05 0.10 0.25 0.50 0.75 0.90 0.95

xtset panelvar timevar must be specified before using xtpcaus.

Description

xtpcaus implements two panel Granger causality tests for strongly balanced panel data.
The command tests whether indepvar Granger-causes depvar, with both individual-level
and panel-level test statistics. For each test, bootstrap p-values account for
cross-sectional dependence among panel units.

Test 1: Panel Fourier Toda-Yamamoto (PFTY)

Following Yilanci and Gorus (2020), this test augments the Toda-Yamamoto (1995) VAR with
Fourier trigonometric terms to capture unknown structural breaks of unknown form, number,
and date. The procedure is:

(i) For each panel unit i, estimate a VAR(k_i+d_max) augmented with Fourier terms
sin(2*pi*f*t/T) and cos(2*pi*f*t/T), where k_i and f are jointly selected by AIC/SBC.

(ii) Compute the individual Wald statistic W_i testing the null that the first k_i
lagged coefficients of indepvar are jointly zero (Granger non-causality).

(iii) Obtain bootstrap p-values p*_i for each unit using the residual-based
sieve bootstrap under the null (Nazlioglu et al. 2016).

(iv) Compute the Fisher panel statistic PFTY = -2*sum(ln(p*_i)) ~ Chi2(2N)
(Emirmahmutoglu and Kose 2011).

(v) Report Dumitrescu-Hurlin Z-bar and Z-bar-tilde statistics for comparison.

Test 2: Panel Quantile Causality (PQC)

Following Wang and Nguyen (2022) and Chuang, Kuan, and Lin (2009), this test examines Granger
causality across the conditional distribution using quantile regression. The procedure is:

(i) Estimate a panel quantile VAR with country-specific intercepts (fixed effects):
Q(y_it | tau) = b_0i(tau) + sum_j b_1j(tau)*y_ + sum_j b_2j(tau)*x_

(ii) For each quantile tau, compute the Wald statistic testing H0: b_2(tau) = 0.

(iii) Obtain bootstrap p-values under the null using the restricted quantile regression.

(iv) Compute the Sup-Wald = max(W(tau)) across all quantiles and compare against
critical values from Chuang et al. (2009) Table 1.

(v) Both directions (x=>y and y=>x) are tested simultaneously.

Options

Required

test(string) specifies the test to perform. pfty runs the Panel Fourier
Toda-Yamamoto test. pqc runs the Panel Quantile Causality test.

Common options

pmax(#) specifies the maximum lag order to search over when selecting the optimal
lag via AIC or SBC. Higher values allow longer lag structures but reduce degrees of freedom.
Default is 4. For short panels (T<20), consider pmax(2) or pmax(3).

dmax(#) specifies the maximum integration order of the variables. Following
Toda and Yamamoto (1995), the VAR is estimated at order k+dmax to ensure valid
chi-square asymptotics regardless of integration/cointegration properties.
Set dmax=1 for I(1) variables, dmax=2 for potentially I(2) variables. Default is 1.

nboot(#) specifies the number of bootstrap replications. Higher values give more
precise p-values. Minimum is 99. Default is 1000.
For quick tests use nboot(199-499); for publication use nboot(999-2000).

seed(#) sets the random-number seed for bootstrap resampling, ensuring
reproducible results.

nograph suppresses all graphical output. Tables are still displayed.

notable suppresses tabular output. Graphs are still displayed.

level(#) sets the confidence level for significance stars. Default is 95.

scheme(string) specifies the Stata graph scheme. Default is s1color.
Other common choices: s2color, s1mono, economist.

PFTY-specific options

kmax(#) specifies the maximum Fourier frequency to consider.
Enders and Lee (2012) recommend kmax=3 for most applications, since low-frequency
components capture the most common structural break patterns. Default is 3.

ic(aic|sbc) specifies the information criterion used to jointly select both
the optimal lag order k and the optimal Fourier frequency f for each panel unit.
aic (Akaike) tends to select more parameters; sbc (Schwarz/BIC) is more
parsimonious. Default is aic. bic is accepted as a synonym for sbc.

PQC-specific options

quantiles(numlist) specifies the quantiles at which to test for causality.
All values must be strictly between 0 and 1. The Sup-Wald statistic is taken over
this grid. Default is 0.05 0.10 0.25 0.50 0.75 0.90 0.95. Denser grids
improve the power of the Sup-Wald test but increase computation time.

Methodology

PFTY — Panel Fourier Toda-Yamamoto

The individual augmented VAR for unit i (Yilanci and Gorus 2020, Eq. 3):

y_it = a_i + sum_^ b_1ij*y_ + sum_^ b_2ij*x_
+ g1_i*sin(2*pi*f_i*t/T) + g2_i*cos(2*pi*f_i*t/T) + e_it

The Wald test statistic W_i tests H0: b_21=b_22=...=b_{2,k_i}=0 (the first k_i
lags of x, excluding the d_max augmentation lags).

The PFTY panel statistic (Yilanci and Gorus 2020, Eq. 5):

PFTY = -2 * sum_^ ln(p*_i) ~ Chi2(2N)

where p*_i are individual bootstrap p-values.

PQC — Panel Quantile Causality

The panel quantile VAR (Wang and Nguyen 2022, Eq. 2-4):

Q_(tau) = b_{0i}(tau) + sum_^

b_{1j}(tau)*y_
+ sum_^

b_{2j}(tau)*x_

where b_{0i}(tau) are country-specific intercepts (panel fixed effects in quantile
space). The Wald test at each quantile tau tests H0: b_2(tau)=0.

The Sup-Wald statistic (Chuang et al. 2009, Eq. 7):

Sup-Wald = max_ W(tau)

where T = [0.05, 0.95]. Critical values from Chuang et al. (2009) Table 1.

Examples

Setup

. webuse grunfeld, clear

. xtset company year

Example 1: PFTY test — Does market value cause investment?

. xtpcaus invest mvalue, test(pfty) pmax(2) kmax(3) dmax(1) nboot(499) seed(12345)

Example 2: PFTY reverse — Does investment cause market value?

. xtpcaus mvalue invest, test(pfty) pmax(2) kmax(3) dmax(1) nboot(499) seed(12345)

Example 3: PFTY with SBC criterion and dmax=2

. xtpcaus invest mvalue, test(pfty) pmax(3) kmax(3) dmax(2) nboot(499) ic(sbc) nograph

Example 4: PQC test — Full quantile grid

. xtpcaus invest mvalue, test(pqc) pmax(2) nboot(499) quantiles(0.05 0.10 0.25 0.50 0.75 0.90 0.95) seed(54321)

Example 5: PQC test — Focus on tails

. xtpcaus invest mvalue, test(pqc) pmax(2) nboot(499) quantiles(0.10 0.25 0.50 0.75 0.90)

Example 6: PQC with dense grid (9 quantiles)

. xtpcaus invest mvalue, test(pqc) pmax(2) nboot(299) quantiles(0.05 0.10 0.20 0.30 0.50 0.70 0.80 0.90 0.95)

Example 7: Accessing stored results after PQC

. mat list e(wald_xy)

. mat list e(coef_xy)

. di "Sup-Wald(x=>y) = " e(supwald_xy)

. di "5% critical value = " e(cv_05)

Example 8: Suppress output

. xtpcaus invest mvalue, test(pfty) nograph notable

Stored results

Both tests store the following in e():

Macros

e(cmd) xtpcaus

e(test) pfty or pqc

e(depvar) dependent variable name

e(indepvar) independent variable name

e(panelvar) panel variable name

e(timevar) time variable name

Scalars

e(N_panels) number of panel units

e(T_periods) number of time periods

e(nboot) number of bootstrap replications

PFTY-specific stored results:

Scalars

e(fisher) Fisher panel test statistic = -2*sum(ln(p*_i))

e(fisher_df) degrees of freedom = 2*N

e(fisher_pv) Fisher p-value

e(wbar) W-bar (average Wald statistic across panels)

e(zbar) Z-bar statistic (Dumitrescu-Hurlin standardized)

e(zbar_pv) Z-bar two-sided p-value

e(zbart) Z-bar tilde (small-sample corrected)

e(zbart_pv) Z-bar tilde p-value

Matrices

e(wald) individual Wald statistics (N x 1)

e(freq) optimal Fourier frequencies (N x 1)

e(pval_a) asymptotic p-values (N x 1)

e(pval_b) bootstrap p-values (N x 1)

e(lags) selected lag orders k_i (N x 1)

PQC-specific stored results:

Scalars

e(supwald_xy) Sup-Wald statistic for x => y

e(supwald_yx) Sup-Wald statistic for y => x

e(cv_01) Sup-Wald 1% critical value (Chuang et al. 2009)

e(cv_05) Sup-Wald 5% critical value

e(cv_10) Sup-Wald 10% critical value

e(p_opt) selected optimal lag order

Matrices

e(wald_xy) Wald statistics per quantile, x => y (1 x Q)

e(coef_xy) sum of cause coefficients per quantile, x => y (1 x Q)

e(pval_xy) bootstrap p-values per quantile, x => y (1 x Q)

e(wald_yx) Wald statistics per quantile, y => x (1 x Q)

e(coef_yx) sum of cause coefficients per quantile, y => x (1 x Q)

e(pval_yx) bootstrap p-values per quantile, y => x (1 x Q)

Remarks and important notes

Requirements

1. Stata 14 or later.

2. Panel data must be declared with xtset panelvar timevar.

3. The panel must be strongly balanced (no gaps, no missing values).

4. At least N >= 2 panel units and T >= 10 time periods.

5. Requires qreg for the PQC test (built into Stata).

Warnings

1. Computation time. Bootstrap resampling is computationally intensive.
For PFTY: time ~ N * nboot * (pmax * kmax) regressions.
For PQC: time ~ nboot * Q * 2 quantile regressions (Q = number of quantiles).
Use nboot(199-499) for exploration and nboot(999-2000) for final results.

2. Short panels. With T < 15, limit pmax to 2 and dmax to 1 to preserve
degrees of freedom. The Z-bar-tilde correction requires T > 2*K + 5.

3. Extreme quantiles. PQC estimates at very extreme quantiles (< 0.05 or > 0.95)
may be unreliable with small N*T. The Sup-Wald critical values from Chuang et al. (2009)
assume the quantile range [0.05, 0.95].

4. Large panels. With very large N, the Fisher statistic may reject too
readily due to power accumulation. Consider the individual bootstrap p-values and
the Sup-Wald test for more nuanced inference.

Notes on interpretation

1. PFTY significance stars are based on individual bootstrap p-values,
which are more reliable than asymptotic p-values in the presence of cross-sectional
dependence.

2. PFTY Fisher statistic. Reject the null of panel-level non-causality
if PFTY > Chi2(2N) at the chosen significance level.

3. PQC coefficient direction. The sign (+/-) in the PQC table indicates
whether the causal effect at that quantile is positive or negative. This reveals
asymmetric effects (e.g., causality only in the tails).

4. PQC Sup-Wald. Compare the Sup-Wald statistic against the critical
values reported from Chuang et al. (2009). If Sup-Wald > cv_05, reject the null
of non-causality at the 5% level across all quantiles simultaneously.

5. Bidirectional testing. The PQC test automatically reports results for
both causal directions (x=>y and y=>x), allowing simultaneous assessment of
feedback effects.

Notes on dmax

The dmax parameter follows Toda and Yamamoto (1995). It adds dmax extra lags
to the VAR to ensure the Wald statistic has an asymptotic chi-squared distribution
regardless of the integration properties of the data. Set dmax equal to the
suspected maximum order of integration: dmax=1 if variables are at most I(1),
dmax=2 if possibly I(2). You do not need to pre-test for unit roots —
the method is valid for any combination of I(0), I(1), and I(2) variables.

Notes on Fourier terms (PFTY only)

The Fourier terms sin(2*pi*f*t/T) and cos(2*pi*f*t/T) approximate unknown
structural breaks of any form (sharp, smooth, or gradual). Low frequencies
(f=1,2,3) are usually sufficient: f=1 captures a single smooth break, f=2
captures two, and f=3 captures more complex break patterns. Higher frequencies
are rarely needed and reduce parsimony (Enders and Lee 2012).

Graphs produced

PFTY: (1) Bar chart of individual Wald statistics by panel, color-coded
by significance level (p<0.01, p<0.05, p<0.10), with Chi2(1) 5% critical value
shown as dashed line. (2) Bar plot of individual bootstrap p-values with 5% and
10% significance lines.

PQC: Three combined panels: (1) Coefficient path plots showing the
quantile-varying causal effect for both directions. (2) Wald statistic plots with
5% Sup-Wald critical value as dashed line. (3) Bootstrap p-value plots with 5%
and 10% significance lines.

References

Chuang, C.C., Kuan, C.M. and Lin, H.Y. (2009).
Causality in quantiles and dynamic stock return-volume relations.
Journal of Banking & Finance, 33(7), 1351-1360.
https://doi.org/10.1016/j.jbankfin.2009.02.013

Dumitrescu, E.I. and Hurlin, C. (2012).
Testing for Granger non-causality in heterogeneous panels.
Economic Modelling, 29(4), 1450-1460.
https://doi.org/10.1016/j.econmod.2012.02.014

Emirmahmutoglu, F. and Kose, N. (2011).
Testing for Granger causality in heterogeneous mixed panels.
Economic Modelling, 28(3), 870-876.
https://doi.org/10.1016/j.econmod.2010.10.018

Enders, W. and Lee, J. (2012).
The flexible Fourier form and Dickey-Fuller type unit root tests.
Economics Letters, 117(1), 196-199.
https://doi.org/10.1016/j.econlet.2012.04.081

Koenker, R. and Bassett, G. (1978).
Regression quantiles.
Econometrica, 46(1), 33-50.
https://doi.org/10.2307/1913643

Koenker, R. and Machado, J.A.F. (1999).
Goodness of fit and related inference processes for quantile regression.
Journal of the American Statistical Association, 94(448), 1296-1310.
https://doi.org/10.1080/01621459.1999.10473882

Nazlioglu, S., Gormus, N.A. and Soytas, U. (2016).
Oil prices and real estate investment trusts (REITs):
Gradual-shift causality and volatility transmission analysis.
Energy Economics, 60, 168-175.
https://doi.org/10.1016/j.eneco.2016.09.009

Toda, H.Y. and Yamamoto, T. (1995).
Statistical inference in vector autoregressions with possibly integrated processes.
Journal of Econometrics, 66(1-2), 225-250.
https://doi.org/10.1016/0304-4076(94)01616-8

Wang, K.M. and Nguyen, T.B. (2022).
A quantile panel-type analysis of income inequality and healthcare expenditure.
Economic Research-Ekonomska Istrazivanja, 35(1), 873-893.
https://doi.org/10.1080/1331677X.2021.1952089

Yilanci, V. and Gorus, M.S. (2020).
Does economic globalization have predictive power for ecological footprint:
Evidence from a panel causality test with a Fourier function.
Environmental Science and Pollution Research, 27, 40552-40562.
https://doi.org/10.1007/s11356-020-09895-x

Author

Dr. Merwan Roudane

Email: merwanroudane920@gmail.com

Please cite as:

Roudane, M. (2026). xtpcaus: Panel causality tests with Fourier terms
and quantile regression. Stata module.

Also see

Online: xtgcause, qreg, var, xtset