*! version 1.0.1 27may2026

Title

dnqr -- Dynamic Network Quantile Regression (Xu et al. 2024)

Syntax

dnqr depvar [if] [in],
network(name) [options]

Main
network(name) Stata or Mata matrix holding the N x N adjacency or weights matrix W

mata declare that network() refers to a Mata matrix

rowstd row-standardise W on the fly

quantile(numlist) quantile grid; default 0.5

z(varlist) time-invariant nodal covariates

factors(varlist) time-varying common factors

plags(#) lags of F to include (default 0)

IVQR settings
ivtype(wy2|wy3|wy23) instrument set for the contemporaneous WY: wy2=W²Y-1, wy3=W³Y-1, wy23=both (default)

gridpoints(#) half-grid length (one side); default 41 => 83-point grid

gridscale(#) grid radius in pilot-SE units; default 4

grid(numlist) user-supplied alpha grid that overrides gridpoints/gridscale

Inference
bandwidth(HS|HB) Powell SE bandwidth (default HS)

bscale(#) multiplicative scale for the bandwidth (default 1)

level(#) confidence level; default 95

Cosmetic
title(string) custom title

notable suppress the table; useful in loops

Description

dnqr estimates the Dynamic Network Quantile Regression model of
Xu, Wang, Shin and Zheng (2024). For each quantile tau in (0,1) the
conditional quantile of depvar given the information set is

QY(tau | F_t) = gamma0(tau) + Z'alpha(tau)
+ gamma1(tau) (1/n_i) sum_j a_{ij} Y_{j,t}
+ gamma2(tau) (1/n_i) sum_j a_{ij} Y_{j,t-1}
+ gamma3(tau) Y_{i,t-1}
+ sum_{k=0..p} F_{t-k}' beta_k(tau)

The contemporaneous network mean sum_j w_{ij} Y_{jt} is endogenous
under the simultaneous-spillover assumption. Plugging it directly into
qreg would produce an inconsistent estimator. dnqr therefore
follows the instrumental variable quantile regression (IVQR) approach of
Chernozhukov and Hansen (2006) and estimates gamma1(tau) by a
one-dimensional grid search: for each candidate alpha, the working
quantile regression of Y - alpha * W Y_t on (instruments, exogenous
regressors) is fit and the L2 norm of the instrument coefficients
is computed; alpha-hat is the minimiser. Standard errors follow Powell
(1986) sandwich with Hall-Sheather or Bofinger bandwidth (Koenker-Xiao
2006).

The estimator works in Stata 13 and above and requires only the built-in
qreg. In particular, it does not depend on the official
ivqregress command, which is available only from Stata 18 onward.

Options

network(name) specifies the N x N adjacency or weights matrix.
By default dnqr expects a Stata matrix; add mata when W lives
in Mata.

mata declares that name in network() is a Mata
matrix.

rowstd row-standardises W.

quantile(numlist) sets the quantile grid.

z(varlist) adds nodal time-invariant covariates.

factors(varlist) adds time-varying common factors.

plags(#) number of lags of the common factors.

ivtype(wy2|wy3|wy23) chooses the instrument set:

wy2 - the single instrument W2Yt-1;

wy3 - the single instrument W3Yt-1;

wy23 - both (over-identified; default).

gridpoints(#) sets the one-sided grid length. The
actual grid has 2*#+1 points centred at the pilot estimate.

gridscale(#) sets the grid radius in pilot-SE units;
larger values widen the search but slow estimation.

grid(numlist) overrides the default grid construction with
a user-supplied numlist (sorted automatically by the syntax parser).

bandwidth(HS|HB) Powell-bandwidth family.

bscale(#) bandwidth scaling.

level(#) confidence level.

notable suppresses the textual table; useful inside Monte
Carlo loops.

Identification and the IVQR grid

The contemporaneous spatial mean W Y_t is correlated with Y_t by
construction. Following Su and Yang (2011) and the DNQR paper, valid
instruments are higher powers of W applied to the lagged response,
i.e. W2 Y_{t-1}, W3 Y_{t-1}, ..., which are correlated with
W Y_t through the reduced-form (I - gamma1 W)-1 but
uncorrelated with the time-t innovation. Over-identification (option
wy23) is recommended in practice as it tightens the grid-search
minimum.

By default the grid is centred at the pilot qreg estimate of
gamma1 (i.e., qreg with the endogenous term included) and spans
gridscale pilot-SE units in each direction with gridpoints
nodes per side. Override the entire grid with grid(numlist) when
you need a domain-specific search range, e.g. grid(-0.05(0.005)0.55).

Examples

. * 1. simulate a DGP with contemporaneous network effect

. dnqr_simulate, n(100) t(60) gamma1(0.30) gamma2(0.20) gamma3(0.30) z(2) factors(2) clear wname(W)

. * 2. fit DNQR at five quantiles

. dnqr y, network(W) rowstd quantile(0.1 0.25 0.5 0.75 0.9) z(Z1 Z2) factors(F1 F2) ivtype(wy23)

. * 3. quantile coefficient plot

. dnqr_plot WY WY_L1 Y_L1 Z1 Z2

. * 4. tail impulse at tau = 0.9

. dnqr_impulse, network(W) rowstd horizon(12) quantile(0.9) shocknode(1) plot

. * 5. user-supplied grid (e.g. to explore wider alpha range)

. dnqr y, network(W) rowstd quantile(0.5) grid(-0.05(0.005)0.55)

Stored results

dnqr stores the following in e().

Scalars

e(plags) common-factor lags

e(level) CI level

e(bscale) bandwidth scale

e(gridpts) grid points per side

e(gridscale) grid radius

e(netdens) network density

Macros

e(cmd) dnqr

e(cmdline) command as typed

e(depvar) dependent variable

e(zvars) nodal covariates

e(factors) common factors

e(bandwidth) HS or HB

e(ivtype) wy2 / wy3 / wy23

e(panelvar) xtset panel variable

e(timevar) xtset time variable

Matrices

e(quantile) 1 x q quantile grid

e(b_q) coefficients per quantile (rows = vars, cols = tau)

e(se_q) Powell standard errors

e(t_q) z-statistics

e(p_q) two-sided p-values

e(lo_q) lower CI

e(hi_q) upper CI

e(alphahat) IVQR grid minimiser per tau

e(gnorm) value of the IV norm at the minimiser

References

Chernozhukov, V., and C. Hansen. 2006. Instrumental quantile regression
inference for structural and treatment effect models. Journal of
Econometrics 132: 491-525.

Koenker, R., and Z. Xiao. 2006. Quantile autoregression. Journal of
the American Statistical Association 101: 980-990.

Powell, J. L. 1986. Censored regression quantiles. Journal of
Econometrics 32: 143-155.

Su, L., and Z. Yang. 2011. Instrumental variable quantile estimation of
spatial autoregressive models. Working Paper.

Xu, X., W. Wang, Y. Shin, and C. Zheng. 2024. Dynamic Network
Quantile Regression Model. SSRN Working Paper 3690631.

Also see

Package TOC: dnqrlib

NQAR (lagged-network baseline): nqar

Postestimation: dnqr_postestimation, dnqr_plot,
dnqr_impulse

Simulator: dnqr_simulate

Stata builtin: qreg, xtset

Author: Dr Merwan Roudane -
merwanroudane920@gmail.com