*! version 1.0 11mar2026

Title

fourierkpss -- Fourier KPSS stationarity test

Syntax

fourierkpss
varname
[if] [in]
[, options]

model(#) deterministic specification: 1=constant, 2=constant+trend; default is model(2)

kmax(#) maximum Fourier frequency; default is kmax(5)

k(#) fixed frequency; default is k(0) (data-driven)

notrend equivalent to model(1)

graph display observed vs. Fourier expansion plot

Description

fourierkpss implements the Fourier KPSS stationarity test proposed by
Becker, Enders, and Lee (2006). Unlike unit root tests
(which test H0: unit root), the KPSS test reverses the hypotheses: the null
hypothesis is stationarity.

This reversal is valuable because it provides a complementary perspective.
Using both a unit root test (e.g., fourierlm) and the KPSS test together
provides stronger inference about the order of integration.

The data must be tsset before using this command.

Options

model(#) deterministic specification: model(1) = level stationarity,
model(2) = trend stationarity. Default is model(2).

kmax(#) maximum Fourier frequency. Default is kmax(5).

k(#) fixed frequency. Default k(0) = data-driven selection.

notrend equivalent to model(1).

graph displays observed series vs. Fourier expansion plot.

Methodology

The KPSS test decomposes the series as:

y_t = d_t + r_t + epsilon_t

where d_t is the deterministic component (approximated by Fourier terms),
r_t is a random walk, and epsilon_t is a stationary error. The null hypothesis
of stationarity corresponds to H0: var(r_t) = 0.

The KPSS statistic is based on the partial sum of OLS residuals from the
regression of y_t on the Fourier deterministic terms. Under H0, the statistic
converges to a functional of Brownian motion.

Note on lag truncation: This implementation uses the Newey-West bandwidth
for long-run variance estimation.

Interpretation

Null hypothesis: The series is stationary (around a Fourier deterministic trend).

Alternative: The series has a unit root.

Decision rule: Reject stationarity if the KPSS statistic exceeds
the critical value. Note this is the opposite of unit root tests.

Confirmatory analysis strategy:

Apply both a unit root test (e.g., fourierlm) and fourierkpss to the
same series:

- If the unit root test rejects AND KPSS does not reject: strong evidence of stationarity.

- If the unit root test does not reject AND KPSS rejects: strong evidence of unit root.

- If both reject or neither rejects: evidence is inconclusive.

Cautions:

1. The KPSS test has known size distortions in small samples. Interpret
borderline rejections carefully.

2. The test may over-reject the null in the presence of strong serial
correlation or large structural breaks.

Stored results

Scalars

r(KPSSk) KPSS test statistic

r(k) optimal frequency

r(cv1) 1% critical value

r(cv5) 5% critical value

r(cv10) 10% critical value

Examples

. sysuse gnp96, clear

. tsset date

. fourierkpss gnp96

. fourierkpss gnp96, model(1) graph

References

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

Kwiatkowski, D., Phillips, P.C.B., Schmidt, P., and Shin, Y. (1992).
Testing the null hypothesis of stationarity against the alternative of a unit
root. Journal of Econometrics, 54(1-3), 159-178.

Authors

Dr. Merwan Roudane

Email: merwanroudane920@gmail.com

Also see

Help: fourierlm, fourierdf, fouriergls,
fourierfffff, fourierdfdf, fourierall