*! version 1.0.0 25apr2026

Title

lzqreg -- Quantile regression to analyze logarithmic relationships with non-positive values in the outcome variable

Syntax

lzqreg
depvar
[indepvars]
[if] [in]
[weight]
[, qreg_options]

fweights, iweights, and pweights are allowed; see
weight.

See qreg postestimation for features available after estimation.

Description

lzqreg fits a quantile regression model where the raw dependent variable,
specified in depvar, is transformed with a calibrated extensive margin (CEM)
transformation of the form

y* = ln(depvar) if depvar > 0

y* = -psi if depvar <= 0.

lzqreg is essentially a wrapper for qreg.
If the fitted values of a quantile regression on this CEM-transformed outcome
are all greater than -psi, then results are displayed. The resulting coefficients can be meaningfully interpreted as logarithmic intensive-margin relationships between the outcome variable and
the independent variables, even with non-positive values in the outcome
variable. If the condition does not hold for the specified quantile, then the command iteratively makes psi larger and checks again. After ten iterations where the condition does not hold, lzqreg returns an error and suppresses results. This implementation is an automated adaptation of the algorithm described
by Liu & Kaplan (2025).

All estimation options, weight types, and postestimation features supported
by qreg are available with lzqreg.

Options

See qreg_options.

Stored results

lzqreg stores the same results in e() as qreg, with the
following differences:

Macros

e(cmd) lzqreg

e(depvar) name of the original (untransformed) dependent variable, displayed as ln(depvar) in output

e(cmdline) command as typed

All other e() scalars, matrices, and macros are as documented in
qreg.

Examples

Consider the NLSW88 dataset.

. sysuse nlsw88, clear

Variable tenure is equal to zero for just over 2% of observations.

. tab tenure

Because the median of tenure, conditional on collgrad, is above
zero for all values of collgrad, the log difference between tenure's
conditional medians is defined. lzqreg thus returns results at quantile
0.5.

. lzqreg tenure collgrad, quantile(0.5)

However, the first percentile of tenure, conditional on collgrad,
is not above zero for all values of collgrad, so lzqreg suppresses
results and returns an error at quantile 0.01.

. lzqreg tenure collgrad, quantile(0.01)

Author

Written by Jack Fitzgerald (jackfitzgeraldresearch@gmail.com)
with assistance from Claude. Based on qreg (StataCorp).

References

Fitzgerald, J., Adema, J., Fiala, L., Kujansuu, E., & Valenta, D. (2026).
"Non-Robustness in Log-Like Specifications." MetaArXiv.
https://doi.org/10.31222/osf.io/juda7_v1

Liu, X., & Kaplan, D. M. (2025). "Quantile Regression with Log(0) Outcomes."
https://drive.google.com/file/d/1F3dnhm8MrlO5aRrGt48rBWAEaBqdCBH-/view

Also see

Manual: [R] qreg

Online: qreg, qreg postestimation