*! version 1.0.0 03jul2026

Title

tsadvroot qadf -- Quantile ADF unit-root test
(Koenker and Xiao 2004)

Syntax

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

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

model(string) c (constant, the Koenker-Xiao default) or
ct (constant and trend)

pmax(#) maximum number of lags of D.varname;
default pmax(8); pmax(0) forces no lags

ic(string) lag-selection criterion: aic, sic or
tstat; default tstat (the GAUSS-source default,
general-to-specific with |t| > 1.645)

graph two-panel profile plot of rho(tau) and t_n(tau) with
critical-value bands

name(string) stub name for the graph

noprint suppress the results table

The data must be tsset, contiguous within the sample.

Description

tsadvroot qadf implements the quantile autoregression unit-root test
of Koenker and Xiao (2004). For each requested quantile tau it estimates by
quantile regression

Q_y(tau | F_t-1) = alpha0(tau) + rho1(tau) y_t-1 +
sum_j alpha_j(tau) D.y_t-j [+ delta(tau) t]

and tests H0: rho1(tau) = 1 (unit root at quantile tau) with the t-ratio
statistic t_n(tau), which studentizes rho1(tau)-1 using a kernel estimate of
the sparsity function and the projection of y_t-1 off the remaining
regressors. Critical values are taken from Hansen (1995, Table II) as a
function of the nuisance parameter delta-squared, exactly as prescribed in
Koenker and Xiao (2004, section 3).

Persistence may be rejected in some parts of the conditional distribution
and not in others - e.g. shocks that die out in the lower quantiles but are
permanent in the upper quantiles - which is the main empirical attraction of
the test.

Options

tau(numlist) sets the quantile(s). With more than one value the
command prints one row per quantile and (with graph) draws the
quantile profile. Default: the nine deciles.

model(string): c includes only a constant (the default in
Koenker and Xiao 2004); ct adds a linear trend. Numeric codes
1/2 (the GAUSS convention) are also accepted.

pmax(#) and ic(): the lag order p is selected once from a
standard OLS ADF regression with constant (GAUSS: ADF(y, 1, pmax, ic))
and then used at every quantile, exactly as in the source. aic and
sic use the tspdlib penalty 2(k+2)/n and (k+2)ln(n)/n; tstat
scans from pmax down and keeps the first lag whose last-lag |t| exceeds
1.645.

graph draws a combined figure: top panel rho(tau) with the unity
reference line; bottom panel t_n(tau) with the 1%, 5% and 10% critical-value
curves. name(stub) controls the graph names
(stub, stub_rho, stub_tn).

Methods and formulas

Let p be the selected lag order and n = T - p - 1 the effective sample. The
statistic is

t_n(tau) = f(F^-1(tau)) / sqrt(tau(1-tau)) * sqrt(Y_1' P_X Y_1) *
(rho1(tau) - 1)

where f(F^-1(tau)) = 2h / (x'b(tau+h) - x'b(tau-h)) is the
difference-quotient sparsity estimate at the mean design point (Koenker-Xiao
eq. 9), h is the Hall-Sheather (1988) bandwidth with the Bofinger (1975)
fallback and the boundary caps of the source, and P_X projects off the
constant and the lagged differences (not the trend, matching the
source). delta-squared is the squared correlation-type nuisance parameter
computed from psi_tau(residuals) and D.y; the Hansen (1995) critical values
are linearly interpolated in delta-squared over the grid 0.1, 0.2, ..., 1.

Quantile regressions are computed with Stata's exact qreg solver
(same check-function objective as GAUSS quantileFit).

Source compatibility (qr_adf.src)

The following source conventions are reproduced exactly:

- lag order selected from a constant-only OLS ADF regression,
regardless of model();

- estimation sample drops the first p+1 observations; the dependent
variable is y_t in levels;

- trend variable = original observation index (not restarted after
trimming);

- the projection matrix P_X excludes the trend even under
model(ct);

- delta-squared uses w = D.y and the n-1 covariance divisor;

- density guard: f < 0 is replaced by 0.01;

- critical-value interpolation saturates below 0.1 and above 1.0.

Note for users of the SSC qadf package: this implementation
differs from ssc install qadf (same author) in using the exact
qreg solution rather than an IRLS approximation, the tspdlib lag
penalties 2(k+2)/n, the 1.645 threshold in the t-stat rule, the
tstat default criterion, and in reporting delta-squared unclamped.

Stored results

tsadvroot qadf stores the following in r():

Scalars

r(T) sample size

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

r(lags) selected lag order p

Scalars (only with a single tau)

r(tn) quantile ADF t-statistic

r(rho_tau) quantile AR(1) coefficient

r(rho_ols) OLS AR(1) coefficient

r(delta2) nuisance parameter delta-squared

r(cv1), r(cv5), r(cv10) Hansen critical values

Macros

r(cmd), r(varname), r(model), r(ic),
r(tau)

Matrices

r(results) one row per quantile: tau, rho_tau, rho_ols,
delta2, tn, cv1, cv5, cv10

Examples

. webuse air2, clear

. gen lair = ln(air)

. tsadvroot qadf lair, model(ct) graph

. tsadvroot qadf lair, tau(0.25 0.5 0.75) model(c) ic(aic)

. tsadvroot qadf lair, tau(0.5) pmax(4) ic(sic)

. matrix list r(results)

References

Hansen, B. E. 1995. Rethinking the univariate approach to unit root testing.
Econometric Theory 11: 1148-1171.

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

Author

Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane

Also see

Help: tsadvroot, tsadvroot_fqadf, tsadvroot_npadf,
tsadvroot_cisur, qreg