*! version 1.0.0 03jul2026

Title

tsadvroot fqadf -- Fourier quantile ADF unit-root test with
smooth structural changes (Li and Zheng 2018)

Syntax

tsadvroot fqadf varname [if] [in]
[, options]

tau(numlist) quantile(s) in (0,1); default
tau(0.1(0.1)0.9)

model(string) c (constant) or ct (constant and
trend)

lags(#) fixed number of lags of D.varname
(no selection); default lags(8), the source default

freq(#) Fourier frequency k; default freq(3), the
source default (Li-Zheng recommend trying k = 1, 2, 3)

nboot(#) bootstrap replications; default nboot(1000);
nboot(0) or nobootstrap skips the bootstrap

seed(#) random-number seed for the bootstrap (0 = do not
set)

nobootstrap skip the bootstrap (statistics only)

graph profile plot of t_n(tau) with bootstrap critical-value
curves

name(string) graph name

noprint suppress the results table

The data must be tsset, contiguous within the sample.

Description

tsadvroot fqadf implements the quantile unit-root test of Li and Zheng
(2018), which augments the Koenker-Xiao (2004) quantile autoregression with
a single-frequency Fourier component

sin(2 pi k t / n) and cos(2 pi k t / n)

that captures smooth (gradual) structural changes in the deterministic part
of the series without having to date any break. The t_n(tau) statistic is
the Koenker-Xiao t-ratio computed on the Fourier-augmented quantile
regression; because its distribution depends on the Fourier terms, inference
uses a residual-based bootstrap under the unit-root null (see below).

Options

lags(#): unlike qadf, the number of lagged
differences is fixed (no information criterion), exactly as in the
source procedure. Use e.g. lags(1) or lags(4) for short series -
the source default of 8 costs 9 observations.

freq(#) is the integer Fourier frequency k. Li and Zheng (2018)
find that a single small frequency (k up to 3) captures a wide variety of
smooth-break shapes.

nboot(#), seed(#): number of bootstrap replications and RNG
seed. With several quantiles in tau(), each replication evaluates the
statistic at every requested quantile from the same pseudo-series.

Bootstrap procedure (Li and Zheng 2018, p. 86)

Exactly as in the source:

1. Estimate by OLS the null regression of y on the deterministics
(constant, trend if model(ct)), the full-sample Fourier terms and p
lagged differences; keep the residuals.

2. Fit an AR(1) (without constant) to those residuals; centre the
innovations.

3. Resample the centred innovations with replacement and cumulate
them into a pure random walk y*.

4. Recompute the full Fourier-QADF statistic on y* (including the
re-construction of the Fourier terms on the trimmed pseudo-sample).

5. Repeat nboot() times.

Critical values. The displayed decisions use the left-tail 1st,
5th and 10th percentiles of the bootstrap distribution (the test rejects for
large negative t_n), together with the bootstrap p-value
P(t_n* <= t_n observed). For strict source compatibility, the order
statistics computed by the GAUSS code - the 0.99 x B, 0.95 x B and
0.90 x B elements of the ascending-sorted bootstrap statistics - are also
stored, in columns 4-6 of r(boot) (cvsrc1, cvsrc5,
cvsrc10). Note that those source order statistics are upper-tail
quantiles; for a left-tailed test the left-tail values (columns 1-3) are the
ones consistent with the bootstrap p-value.

Source compatibility (qr_fourier_adf.src)

The following source conventions are reproduced exactly:

- lags are fixed at lags() (all p lags always included), no
selection;

- the test's Fourier terms are built on the trimmed sample:
the index restarts at 1 after dropping p+1 observations and the denominator
is the trimmed length (source line t = rows(y) after
trimr);

- the bootstrap's null-model Fourier terms are instead built on the
full sample length before trimming (source order of operations);

- the trend regressor is the original observation index;

- in the t_n statistic the projection matrix P_X removes
everything except y_t-1 (constant, lagged differences, Fourier terms
and, under model(ct), the trend);

- delta-squared uses w = quantile-regression residuals (source
passes miss());

- the pseudo-series has length T - p - 2 (AR(1) step loses one more
observation), and each bootstrap statistic is computed by the full test
routine on it;

- the GAUSS 0.99/0.95/0.90 order statistics are reported unchanged
in r(boot) columns 4-6.

Stored results

Scalars

r(T) sample size

r(N) effective sample (T - p - 1)

r(lags) p

r(k) Fourier frequency

r(nboot) bootstrap replications

Scalars (only with a single tau)

r(tn) Fourier quantile ADF statistic

r(rho_tau) quantile AR(1) coefficient

r(delta2) delta-squared

r(pboot) bootstrap p-value

r(cv1), r(cv5), r(cv10) left-tail bootstrap
critical values

r(cvsrc1), r(cvsrc5), r(cvsrc10) GAUSS-source
order statistics

Matrices

r(results) per-quantile: tau, rho_tau, ., delta2, tn

r(boot) per-quantile: cvlt1 cvlt5 cvlt10 cvsrc1 cvsrc5
cvsrc10 pboot

Examples

. webuse air2, clear

. gen lair = ln(air)

. tsadvroot fqadf lair, tau(0.5) model(ct) freq(1) lags(4) nboot(500) seed(12345)

. tsadvroot fqadf lair, model(c) freq(2) lags(2) nboot(500) seed(1) graph

. tsadvroot fqadf lair, tau(0.25 0.75) nobootstrap

References

Koenker, R., and Z. Xiao. 2004. Unit root quantile autoregression inference.
Journal of the American Statistical Association 99: 775-787.

Li, H., and C. Zheng. 2018. Unit root quantile autoregression testing with
smooth structural changes. Finance Research Letters 25: 83-89.

Author

Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane

Also see

Help: tsadvroot, tsadvroot_qadf, tsadvroot_npadf,
tsadvroot_cisur