## Stata 15 help for qreg_postestimation

```
[R] qreg postestimation -- Postestimation tools for qreg, iqreg, bsqreg, and
sqreg

Postestimation commands

The following postestimation commands are available after qreg, iqreg,
bsqreg, and sqreg:

Command            Description
-------------------------------------------------------------------------
contrast         contrasts and ANOVA-style joint tests of estimates
estat summarize  summary statistics for the estimation sample
estat vce        variance-covariance matrix of the estimators (VCE)
+ forecast         dynamic forecasts and simulations
* hausman          Hausman's specification test
lincom           point estimates, standard errors, testing, and
inference for linear combinations of coefficients
margins          marginal means, predictive margins, marginal effects,
and average marginal effects
marginsplot      graph the results from margins (profile plots,
interaction plots, etc.)
nlcom            point estimates, standard errors, testing, and
inference for nonlinear combinations of coefficients
predict          predictions, residuals, influence statistics, and
other diagnostic measures
predictnl        point estimates, standard errors, testing, and
inference for generalized predictions
pwcompare        pairwise comparisons of estimates
test             Wald tests of simple and composite linear hypotheses
testnl           Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------
* hausman is not appropriate after bsqreg, iqreg, or sqreg.
+ forecast is not appropriate with mi estimation results.

Syntax for predict

For qreg, iqreg, and bsqreg

predict [type] newvar [if] [in] [, [xb|stdp|residuals]]

For sqreg

predict [type] newvar [if] [in] [, equation(eqno[,eqno]) statistic]

statistic          Description
-------------------------------------------------------------------------
Main
xb               linear prediction; the default
stdp             standard error of the linear prediction
stddp            standard error of the difference in linear predictions
residuals        residuals
-------------------------------------------------------------------------
These statistics are available both in and out of sample; type predict
... if e(sample) ... if wanted only for the estimation sample.

Statistics > Postestimation

Description for predict

predict creates a new variable containing predictions such as linear
predictions, standard errors, and residuals.

Options for predict

+------+
----+ Main +-------------------------------------------------------------

xb, the default, calculates the linear prediction.

stdp calculates the standard error of the linear prediction.

stddp is allowed only after you have fit a model using sqreg.  The
standard error of the difference in linear predictions between
equations 1 and 2 is calculated.

residuals calculates the residuals, that is, y - xb.

equation(eqno[,eqno]) specifies the equation to which you are making the
calculation.

equation() is filled in with one eqno for the xb, stdp, and residuals
options.  equation(#1) would mean that the calculation is to be made
for the first equation, equation(#2) would mean the second, and so
on.  You could also refer to the equations by their names.
equation(income) would refer to the equation named income and
equation(hours) to the equation named hours.

If you do not specify equation(), results are the same as if you had
specified equation(#1).

To use stddp, you must specify two equations.  You might specify
equation(#1, #2) or equation(q80, q20) to indicate the 80th and 20th
quantiles.

Syntax for margins

margins [marginlist] [, options]

margins [marginlist] , predict(statistic ...) [options]

statistic          Description
-------------------------------------------------------------------------
xb                 linear prediction; the default
stdp               not allowed with margins
stddp              not allowed with margins
residuals          not allowed with margins
-------------------------------------------------------------------------

Statistics not allowed with margins are functions of stochastic
quantities other than e(b).

For the full syntax, see [R] margins.

Statistics > Postestimation

Description for margins

margins estimates margins of response for linear predictions.

Examples

Setup
. sysuse auto
. qreg price weight length foreign

Obtain predicted values
. predict hat

Obtain residuals
. predict r, resid

```