*! version 1.0.0 06jun2026

Title

xtfpss -- Fourier panel stationarity test with gradual structural shifts
(Nazlioglu & Karul, 2017)

Syntax

xtfpss varname [if] [in] [, options]

Model
model(level|trend) deterministic component: level (level shift,
default) or trend (level and trend shift)

freq(#) Fourier frequency k, an integer in 1..5; default freq(1)

optfreq select k automatically by minimum panel SSR over 1..fmax

fmax(#) maximum frequency searched when optfreq is used (1..5); default fmax(5)

varm(#) long-run variance estimator, an integer in 1..7; default varm(1) (iid)

Reporting & graph
graph draw the series with its Fourier approximation (small multiples, Fig. 1 style)

genfourier(newvar) save the fitted Fourier approximation to newvar

noprintind suppress the table of individual KPSS statistics

twoway_options any twoway_options passed to the graph

The data must be xtset (panel id and time) and the panel must be
balanced (every unit observed for the same T periods).

xtfpss is part of the xtpdlib library.

Description

xtfpss implements the Fourier panel stationarity test of
Nazlioglu and Karul (2017). The test allows for an unknown
number, date and form of smooth/gradual structural shifts that are modelled with
a Becker, Enders and Lee (2006) Fourier approximation, while
cross-section dependence is captured by a common factor proxied by the cross-sectional
average (Hadri and Kurozumi, 2011, 2012).

The null hypothesis is that the panel is stationary (all units stationary) against
the alternative that some or all units contain a unit root. The standardized panel
statistic FZk has a standard N(0,1) limiting distribution; the one-sided 5%
critical value is 1.645 and xtfpss reports the right-tail p-value.

This command is a Stata translation of the GAUSS routine PD_nkarul (proc PDfzk)
from S. Nazlioglu's TSPDLIB and is designed to reproduce its results.

Options

Model

model(level|trend) sets the deterministic specification. level
(default) includes a constant plus the Fourier terms (level shifts). trend adds a
linear trend (level and trend shifts).

freq(#) sets the single Fourier frequency k (1..5). Because the
asymptotic moments are tabulated for k = 1..5 only, k is restricted to that
range. The homogeneous frequency assumption is used across units (see Method).

optfreq selects k as the value in 1..fmax that minimises the
total panel sum of squared residuals. Without this option the fixed freq() is used.

fmax(#) is the largest frequency searched under optfreq (default 5).

varm(#) chooses the long-run variance estimator used in the individual KPSS
statistics:

1 iid (default)

2 Bartlett kernel

3 Quadratic Spectral kernel

4 SPC prewhitened Bartlett (Sul, Phillips & Choi, 2005)

5 SPC prewhitened Quadratic Spectral

6 Kurozumi (2002) data-dependent bandwidth, Bartlett

7 Kurozumi (2002) data-dependent bandwidth, Quadratic Spectral

Reporting & graph

graph produces a small-multiples graph (one panel per unit) overlaying the
original series (blue) and its estimated Fourier approximation (red), reproducing Fig. 1
of Nazlioglu and Karul (2017).

genfourier(newvar) saves the fitted Fourier deterministic component, so you
can build your own graphs.

noprintind suppresses the per-unit KPSS table and prints only the panel result.

Method

For each unit i the individual KPSS statistic with a common factor and Fourier terms is

eta_i(k) = (1/T^2) * sum_t S_it(k)^2 / sigma2_i

where S_it(k) is the partial sum of the OLS residuals from regressing y on a
constant (and trend, for model(trend)), sin(2*pi*k*t/T), cos(2*pi*k*t/T),
and the cross-sectional average Ft; sigma2_i is the long-run variance
(option varm()). The panel statistic is the average FP(k) = mean_i eta_i(k)
and is standardized to

FZk = sqrt(N) * (FP(k) - mu(k)) / sqrt(zeta2(k)) ~ N(0,1)

using the asymptotic mean mu(k) and variance zeta2(k) from Table 1 of the
paper (which depend on the deterministic model and k). A homogeneous frequency k
is assumed across units so that the panel statistic has the standard normal distribution.

Interpretation

Reading the panel result. FZk is standard normal under the null of joint
stationarity. Because rejection occurs in the right tail, compare FZk with
the one-sided critical values 1.282 (10%), 1.645 (5%) and 2.326 (1%); the reported
p-value is 1 - Phi(FZk).

- p-value < 0.05: reject joint stationarity => at least a fraction
of the panel units contain a unit root (shocks are persistent/permanent).

- p-value >= 0.05: do not reject => the panel is stationary
around a (smooth, Fourier) deterministic component (shocks are transitory).

Reading the individual statistics. The per-unit FKPSS values describe each
cross-section. Large values flag units that look non-stationary; small values look
stationary. Under the alternative the panel test rejects when a non-trivial fraction of
units are non-stationary, so the individual column is useful for seeing which units
drive (or do not drive) the panel conclusion. There is no per-unit p-value here because
the limiting distribution of FKPSS depends only on the Fourier frequency k;
use the simulated time-series critical values of Becker, Enders and Lee (2006) for unit
inference if needed.

Reading the graph. The blue line is the observed series and the red line is its
estimated Fourier deterministic component. A red curve that tracks the long swings of the
series indicates that gradual/smooth shifts (not sharp breaks) characterise the data;
this is exactly the situation in which the Fourier stationarity test outperforms
dummy-variable break tests.

Cautions

o Balanced panel only. The data must be xtset and every unit must be
observed for the same T periods; otherwise the command stops with an error.

o Frequency is restricted to 1..5. The asymptotic moments (Table 1 of the
paper) are tabulated only for k=1..5. A single, common frequency is assumed
across units so that the panel statistic is N(0,1); do not interpret the test as allowing
unit-specific k.

o Choosing k matters. Using the wrong number of Fourier terms distorts size
and power (paper, Cases 3-5). Prefer freq(1) unless there is clear evidence of
multiple long swings; optfreq chooses k by minimum panel SSR but is only a
guide. Low integer frequencies (1 or 2) are recommended; high k approaches a
dummy-break specification and loses the smooth-shift advantage.

o Serial correlation. With i.i.d. errors the default varm(1) (iid) is
fine. With serially correlated errors use a kernel estimator; varm(6) or
varm(7) (Kurozumi 2002 data-dependent bandwidth) controls size distortion best in
small samples. The varm(4)/varm(5) SPC options apply a prewhitening boundary
rule.

o Small T. Size is close to nominal once T is moderate; with very small T the
test is somewhat undersized (conservative). Power rises with both N and T.

o Not the same null as unit-root tests. Here H0 = stationarity. Failing to
reject is evidence for stationarity, the opposite logic of xtcipsm /
xtunitroot where H0 = unit root. Using both (confirmatory analysis) is good
practice.

Examples

Setup

. webuse grunfeld, clear

. xtset company year

Baseline level-shift test at frequency 1 (recommended default)

. xtfpss invest, model(level) freq(1)

Trend (level + trend shift) model at frequency 2

. xtfpss invest, model(trend) freq(2)

Let the data choose k in 1..3, Bartlett long-run variance

. xtfpss invest, optfreq fmax(3) varm(2)

Serially-correlated errors: Kurozumi data-dependent bandwidth

. xtfpss invest, model(level) freq(1) varm(6)

Fig. 1-style graph and keep the fitted Fourier component

. xtfpss invest, model(trend) freq(1) graph genfourier(fhat)

Use the stored results

. xtfpss invest, model(level) freq(1)

. display "FZk = " r(fzk) " p = " r(pval)

. matrix list r(kpss)

Compare with a unit-root null test on the same data (confirmatory analysis)

. xtcipsm invest, model(constant)

Stored results

xtfpss stores the following in r():

Scalars

r(fzk) panel FZk statistic

r(pval) right-tail p-value of FZk

r(fpk) panel statistic FP(k) (average of individual KPSS)

r(k) Fourier frequency used

r(N) number of cross-sections

r(T) time-series length

r(varm) long-run variance method code

r(model) deterministic model (1=level, 2=trend)

Matrices

r(kpss) N x 2 matrix of unit id and individual FKPSS statistic

Macros

r(lrv) long-run variance method label

r(cmd) xtfpss

References

Nazlioglu, S., and C. Karul. 2017. A panel stationarity test with gradual
structural shifts: re-investigate the international commodity price shocks.
Economic Modelling 61: 181-192.

Becker, R., W. Enders, and J. Lee. 2006. A stationarity test in the presence of an
unknown number of smooth breaks. Journal of Time Series Analysis 27: 381-409.

Hadri, K., and E. Kurozumi. 2011. A simple panel stationarity test in the presence
of cross-sectional dependence. Economics Letters 115: 31-34.

Sul, D., P. C. B. Phillips, and C.-Y. Choi. 2005. Prewhitening bias in HAC
estimation. Oxford Bulletin of Economics and Statistics 67: 517-546.

Kurozumi, E. 2002. Testing for stationarity with a break.
Journal of Econometrics 108: 63-99.

Author

Stata implementation:

Dr Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane

Original GAUSS code (TSPDLIB, proc PDfzk):

Saban Nazlioglu, Pamukkale University, snazlioglu@pau.edu.tr

See also:

xtpdlib, xtcipsm, xtpgc, xtunitroot