*! version 1.1.0 29may2026

Title

qqr -- Bivariate Quantile-on-Quantile Regression (Sim & Zhou 2015)

Syntax

qqr depvar indepvar [if] [in] [, options]

Grid & estimator
tau(numlist) Y-quantile grid (default 0.05(0.05)0.95)

theta(numlist) X-quantile grid (default 0.05(0.05)0.95)

bandwidth(#) kernel bandwidth (default: Silverman plug-in)

method(string) kernel (default) or subset

Standard errors
bootse use pointwise bootstrap SE (per cell)

nboot(#) bootstrap replications (default 200)

Joint bootstrap & inference
bci add joint-bootstrap pointwise CI columns (cilo cihi)

bsave(filename) write the joint-bootstrap draws file for qqtest/qqribbon/qqdiff

level(#) confidence level for bci (default c(level))

Output
saving(filename) save long-format results .dta

replace overwrite existing file(s)

noprogress suppress progress output

Description

qqr estimates a bivariate quantile-on-quantile regression following
Sim & Zhou (2015). For each pair (τ, θ) the procedure
fits a locally-weighted quantile regression

y = β₀(τ,θ) + β₁(τ,θ) (x − x_θ) + u

with kernel weights centred on the θ-quantile of x. The slope
coefficient β₁(τ,θ) traces how the τ-quantile of y responds to
x when x is at its θ-quantile. The result is an M×L surface that
generalises both standard quantile regression (one θ) and OLS (the mean).

Options

Grid & estimator

tau(numlist) and theta(numlist) give the response- and
predictor-quantile grids. Finer grids give smoother surfaces but cost time.

bandwidth(#) sets the kernel bandwidth on the empirical CDF of x;
by default a Silverman plug-in is used. method(string) selects the
estimator — see Methods.

Standard errors

bootse replaces the analytic standard error of each cell with a
pointwise bootstrap SE (each cell resampled independently); nboot(#)
sets the number of replications.

Joint bootstrap & inference

bci runs the joint bootstrap — one resample index reused across the
whole grid per replication — and appends pointwise percentile CI columns
cilo and cihi to the saved results, at the level() confidence
level.

bsave(filename) writes the full joint-bootstrap draws file in long
format (rep tau theta beta: rep==0 is the point estimate, rep
1..B the draws). This file is the input to the inference and diagnostic
commands qqtest, qqribbon and
qqdiff. Specifying bsave() implies the joint bootstrap
even without bci.

level(#) sets the confidence level used by bci (default
c(level), usually 95).

Output

saving(filename) writes the long-format results dataset (see
format below); replace overwrites existing files;
noprogress silences the console output.

Methods

method(kernel) — true Sim-Zhou local linear weighted QR using a
Gaussian kernel on the empirical CDF of x. Recommended.

method(subset) — simplified variant: subset to x ≤ x_θ and
fit an unweighted quantile regression. Faster, used in some applied papers.

Inference workflow

For formal inference on the surface, estimate once with the joint bootstrap
and a draws file, then run the diagnostic commands against it:

. qqr y x, tau(0.1(0.1)0.9) theta(0.1(0.1)0.9) nboot(500) ///

. bci bsave(draws.dta) saving(qq.dta) replace

. qqtest using draws.dta, test(zero) // is the surface non-zero?

. qqtest using draws.dta, test(symmetry) // tail-asymmetric?

. qqribbon using draws.dta, theta(0.5) joint // CI ribbon slice

. qqdiff using draws.dta // asymmetry heatmap

Stored results

Scalars

r(N) number of observations

Macros

r(method) estimator used

r(depvar) response variable

r(indvar) predictor variable

Matrices

r(coef) M×L matrix of slope coefficients β₁(τ,θ)

r(se) M×L matrix of standard errors

r(t) M×L matrix of t-statistics

r(p) M×L matrix of p-values

r(r2) M×L matrix of pseudo R²

r(tau) τ grid (M×1)

r(theta) θ grid (L×1)

Saved dataset format

When saving() is used, a long-format .dta is written with
columns tau theta coef se t p r2 (plus cilo cihi when bci is
specified). This is the format consumed by qqheat,
qqsurf, qqsurf3d and qqtable.

bsave() writes a separate draws file (rep tau theta
beta) consumed by qqtest, qqribbon and
qqdiff.

Examples

Estimate and visualise

. qqr sp500 oil, saving(qq.dta) replace

. qqheat using qq.dta, value(coef) colormap(jet) sigmark

. qqsurf3d using qq.dta, value(coef) colormap(jet)

Custom grid and the coefficient matrix

. qqr sp500 oil, tau(0.1(0.1)0.9) theta(0.1(0.1)0.9)

. matrix list r(coef)

Joint bootstrap + formal tests

. qqr sp500 oil, nboot(500) bci bsave(draws.dta) saving(qq.dta) replace

. qqtest using draws.dta, test(zero)

References

Sim, N. and Zhou, H. (2015). Oil prices, US stock return, and the
dependence between their quantiles. Journal of Banking & Finance 55:1-12.

Koenker, R. (2005). Quantile Regression. Cambridge University Press.

Author

Merwan Roudane. merwanroudane920@gmail.com

See also

mqqr, qqgcause, qqkrls, qqheat,
qqsurf3d, qqtable, qqtest, qqribbon,
qqdiff, qqr_package