*! version 1.0.0 12jun2026

Title

mmqrtest scalepos -- Positivity check for the MM-QR fitted
scale function

Syntax

mmqrtest scalepos [depvar indepvars] [if] [in]
[, id(panelvar) quantile(numlist) graph
name(string) generate(stub) noheader]

Description

The MM-QR panel model requires Pr(delta_i + X_it'gamma > 0) = 1
(Machado and Santos Silva 2019, eq. 5): the scale attached to every
observation must be strictly positive, otherwise the standardized residual
U_it = R_it/sigma_it -- and with it every estimated
quantile -- is meaningless for that observation. This is a
diagnostic / violation check rather than a classical hypothesis test:
the condition is part of the model definition.

mmqrtest scalepos re-runs the MM-QR sequential algorithm, computes
sigma_it = delta_i + X_it'gamma for every in-sample
observation, and reports: the minimum and mean fitted scale, the number and
share of observations with sigma_it <= 0, the number of cross-section
units affected, and the number of units whose scale intercept
delta_i is non-positive. The verdict is PASS (no violations) or
VIOLATION.

Run this check first: the other mmqrtest subcommands exclude
non-positive-scale observations from U-based computations and refer
you back here when violations exist.

Options

id(panelvar), quantile(numlist) -- see mmqrtest.

graph draws a histogram of the fitted scale with a reference line at
zero; any mass at or left of the line is a violation.

name(string) names the graph (default mmqrt_scalepos).

generate(stub) saves stub_sigma (fitted scale) and
stub_delta (unit scale intercept delta_i) as new variables.

noheader suppresses the title box (used internally by
mmqrtest all).

Examples

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

. mmqrtest scalepos, graph

. mmqrtest scalepos, generate(sc)

. list idcode year sc_sigma if sc_sigma<=0

Stored results

Scalars

r(N) observations used

r(G) number of units

r(nneg) observations with sigma_it <= 0

r(pctneg) percent of observations with sigma_it <= 0

r(Gneg) units with at least one violation

r(minsigma) minimum fitted scale

Macros

r(verdict) PASS or VIOLATION

Author

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