*! version 1.0.0 12jun2026

Title

mmqrtest postestimation -- Running the MM-QR test battery
after estimation

Description

Every mmqrtest subcommand can be invoked with no variable list
right after fitting a panel quantile model. The command then reads the
model specification from the estimation results in memory, restricts all
computations to e(sample), and restores your estimation results
when it finishes, so you can keep working with the fitted model
(replay, test, predict, ...).

Supported estimators

mmqreg recommended. Dependent variable from
e(depvar); regressors from the location equation of e(b);
quantiles from e(qth); panel id from e(fevlist) when
absorb() contained a single variable, otherwise from xtset.
The scalerel subcommand additionally reuses e(b)/e(V)
directly, inheriting your VCE (robust, cluster, jackknife).

xtqreg regressors from e(b_location); quantiles from
e(q); panel id from xtset.

qregfe specification recovered from e(cmdline);
quantile from e(quantile); panel id from e(absorb) or
xtset.

Anything else raises error 301 with a pointer to the standalone syntax.

What is recomputed and why

The tests need objects that estimators do not store: residuals R_it,
the fitted scale sigma_it, the unit effects alpha_i and
delta_i, and the standardized residuals U_it. mmqrtest
therefore re-runs the MM-QR sequential algorithm (Machado and Santos Silva
2019, sec. 3.1) internally on e(sample) -- ordinary least
squares within regressions plus one-dimensional quantile estimation, so the
cost is negligible. Coefficient estimates reproduce mmqreg with a
single absorbed panel variable; if you absorbed several variables, the
tests use one-way (panel) fixed effects and a note about the difference
applies.

Note that the tests are defined for the one-way fixed-effects panel
location-scale model; the panel identifier is required even in standalone
mode.

Guarantees

1. your e() results are held and restored on exit, even on
error (_estimates hold);

2. computations are restricted to e(sample);

3. the sort order of your data is preserved;

4. observations with non-positive fitted scale are excluded from
U-based statistics and flagged.

Examples

. webuse nlswork, clear

. xtset idcode year

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

. mmqrtest all, seed(12345) graph

. mmqreg // replay still works: e() was restored

Author

Merwan Roudane --
merwanroudane920@gmail.com
-- https://github.com/merwanroudane