*! version 1.0.0 12jun2026

Title

mmqrtest -- Specification and diagnostic tests for MM-QR
location-scale panel quantile models (Machado and Santos Silva 2019;
Canay 2011)

Syntax

mmqrtest subcommand [depvar indepvars] [if] [in]
[, options]

subcommand

scalepos positivity of the fitted scale
sigma_it = delta_i + X'gamma

scalerel Wald test of gamma = 0
(scale relevance; quantile-slope homogeneity)

spec location-scale adequacy /
overidentification test

distfe distributional fixed effects;
H0: delta_i homogeneous

canay Canay (2011) location-shift validity
(bootstrap Hausman-type contrast)

all run the full battery and print a verdict summary

guide open the researcher's guide
(detailed interpretation of every test)

All subcommands run either as postestimation after mmqreg,
xtqreg or qregfe (omit depvar indepvars), or
standalone by supplying the variable list; see
mmqrtest postestimation.

common options

id(panelvar) panel identifier; default is taken from the
estimation results or xtset

quantile(numlist) quantiles in percent, e.g.
quantile(25 50 75); default is the estimated quantiles or 25 50 75

graph draw the diagnostic graph(s)

name(string) name of the graph; for all it is the
prefix of the five diagnostic graphs (name_d1 ...
name_d5) and of the combined dashboard
(name_dash)

noheader suppress the title box

subcommand-specific

aux(varlist) (spec) user-supplied auxiliary functions w(X)

reps(#) (canay, all) bootstrap replications; default 200

seed(#) (canay, all) random-number seed

pvar(varname) (canay) regressor shown in the comparison plot

generate(stub) (scalepos, distfe) save fitted
objects as new variables

nodots (canay, all) suppress bootstrap dots

Description

mmqrtest provides the testing toolbox that Machado and Santos Silva
(2019) call for but do not develop. Their method-of-moments quantile
regression (MM-QR) is built on a conditional location-scale model, and the
authors note that "although we do not develop such tests here, it is
possible to test the assumption that the covariates only affect the
location and scale functions" (sec. 1) and that such tests "can be
constructed as tests for overidentifying restrictions, but it may be
possible to develop simpler regression-based procedures" (sec. 7).
mmqrtest implements that program: every maintained assumption of the
MM-QR panel model is mapped to a computable diagnostic with a clear verdict,
publication-style tables, and optional graphs.

It is designed as the natural companion to mmqreg: fit your model,
then type mmqrtest all. Each table is printed in journal style with
explanatory notes beneath it; for a full discussion of what each test
means, when to run it, how to read every possible outcome, and ready-made
reporting language for papers, see the researcher's guide:
help mmqrtest_guide (or type mmqrtest guide).

The model being tested

MM-QR assumes the panel location-scale data generating process
(Machado and Santos Silva 2019, eq. 5)

Y_it = alpha_i + X_it'beta +
(delta_i + X_it'gamma) U_it,
Pr(delta_i + X_it'gamma > 0) = 1,

with U_it i.i.d., independent of X, E(U) = 0, E(|U|) = 1.
The implied conditional quantiles are (eq. 6)

Q_Y(tau|X_it) = (alpha_i + delta_i q(tau)) + X_it'beta
+ X_it'gamma q(tau).

Each maintained restriction is testable, and each mmqrtest subcommand
targets one of them.

The tests at a glance

scalepos Is the fitted scale positive for
every observation, as eq. (5) requires? A violation makes the standardized
residuals, and hence all MM-QR quantiles, unreliable.

scalerel H0: gamma = 0. Under H0 the
quantile coefficients beta(tau) = beta + q(tau)gamma are the
same at every tau -- quantile regression adds nothing beyond a
location model. Uses the analytic covariance of the scale coefficients
(Theorem 2).

spec H0: regressors act only through location
and scale, i.e. U independent of X. Cluster-robust orthogonality
(overidentification) tests between functions of U and functions of
X, the regression-based procedure suggested in fn. 5 and sec. 7 of the
paper.

distfe H0: delta_i = delta for all
i. Under H0 the individual effects are pure location shifters; under
the alternative they are distributional fixed effects that move
dispersion and tails.

canay H0: Canay's (2011) location-shift
assumption holds. Bootstrap Hausman-type contrast between the Canay
two-step and MM-QR coefficient paths (cf. Machado and Santos Silva 2019,
fn. 17).

all Runs the five tests in sequence and prints a one-screen
verdict summary; with graph also builds a combined dashboard.

Options

id(panelvar) supplies the panel identifier. When omitted,
mmqrtest uses, in this order: the single variable in e(fevlist)
left by mmqreg, absorb(); the xtset panel variable.

quantile(numlist) sets the quantiles (in percent, each strictly
between 0 and 100). When omitted, the quantiles of the estimation in
memory are reused; standalone, the default is 25 50 75.

graph requests the diagnostic graph of each subcommand. Graphs use a
'Parula'-inspired palette and can be combined freely since each accepts
name().

See the subcommand help files for the remaining options.

Examples

Postestimation workflow (recommended)

. webuse nlswork, clear

. xtset idcode year

. mmqreg ln_wage tenure ttl_exp, absorb(idcode) quantile(25 50 75)

. mmqrtest all, reps(200) seed(12345) graph

Single tests

. mmqrtest scalepos, graph

. mmqrtest scalerel

. mmqrtest spec

. mmqrtest distfe, generate(fe) graph

. mmqrtest canay, reps(500) pvar(tenure) graph

Standalone (no prior estimation)

. mmqrtest spec ln_wage tenure ttl_exp, id(idcode) quantile(10 50 90)

Stored results

Each subcommand returns its statistics in r(); see the subcommand
help files. mmqrtest all returns:

Scalars

r(pctneg) percent of observations with non-positive scale

r(nneg) number of such observations

r(p_scalerel) p-value, scale relevance Wald test

r(p_spec) p-value, location-scale specification test

r(p_distfe) p-value, distributional fixed-effects test

r(p_canay) p-value, Canay location-shift test

Macros

r(v_scalepos)...r(v_canay) verdict strings

References

Canay, I. A. 2011. A simple approach to quantile regression for panel
data. The Econometrics Journal 14: 368-386.
https://doi.org/10.1111/j.1368-423X.2011.00349.x

Dhaene, G., and K. Jochmans. 2015. Split-panel jackknife estimation of
fixed-effect models. Review of Economic Studies 82: 991-1030.
https://doi.org/10.1093/restud/rdv007

Glejser, H. 1969. A new test for heteroskedasticity.
Journal of the American Statistical Association 64: 316-323.
https://doi.org/10.1080/01621459.1969.10500976

Hansen, L. P. 1982. Large sample properties of generalized method of
moments estimators. Econometrica 50: 1029-1054.
https://doi.org/10.2307/1912775

Koenker, R. 2004. Quantile regression for longitudinal data.
Journal of Multivariate Analysis 91: 74-89.
https://doi.org/10.1016/j.jmva.2004.05.006

Machado, J. A. F., and J. M. C. Santos Silva. 2019. Quantiles via moments.
Journal of Econometrics 213: 145-173.
https://doi.org/10.1016/j.jeconom.2019.04.009

Newey, W. K. 1985. Generalized method of moments specification testing.
Journal of Econometrics 29: 229-256.
https://doi.org/10.1016/0304-4076(85)90154-X

Author

Merwan Roudane

Email: merwanroudane920@gmail.com

GitHub: https://github.com/merwanroudane

mmqrtest is a companion to mmqreg (Rios-Avila; Roudane) and
implements the testing agenda outlined in Machado and Santos Silva (2019).