## Stata 15 help for reg3_postestimation

```
[R] reg3 postestimation -- Postestimation tools for reg3

Postestimation commands

The following postestimation commands are available after reg3:

Command            Description
-------------------------------------------------------------------------
contrast         contrasts and ANOVA-style joint tests of estimates
* estat ic         Akaike's and Schwarz's Bayesian information criteria
(AIC and BIC)
estat summarize  summary statistics for the estimation sample
estat vce        variance-covariance matrix of the estimators (VCE)
estimates        cataloging estimation results
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
-------------------------------------------------------------------------
* estat ic is not appropriate after reg3, 2sls.

Syntax for predict

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

statistic          Description
-------------------------------------------------------------------------
Main
xb               linear prediction; the default
stdp             standard error of the linear prediction
residuals        residuals
difference       difference between the linear predictions of two
equations
stddp            standard error of the difference in linear predictions
-------------------------------------------------------------------------
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, residuals, and differences between the
linear predictions of two equations.

Options for predict

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

equation(eqno[,eqno]) specifies to which equation you are referring.

equation() is filled in with one eqno for the xb, stdp, and residuals
options.  equation(#1) would mean 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
specified equation(#1).

difference and stddp refer to between-equation concepts.  To use
these options, you must specify two equations, for example,
equation(#1,#2) or equation(income,hours).  When two equations must
be specified, equation() is required.

xb, the default, calculates the linear prediction (fitted values) -- the
prediction of xb for the specified equation.

stdp calculates the standard error of the prediction for the specified
equation.  It can be thought of as the standard error of the
predicted expected value or mean for the observation's covariate
pattern.  The standard error of the prediction is also referred to as
the standard error of the fitted value.

residuals calculates the residuals.

difference calculates the difference between the linear predictions of
two equations in the system.  With equation(#1,#2), difference
computes the prediction of equation(#1) minus the prediction of
equation(#2).

stddp is allowed only after you have previously fit a multiple-equation
model.  The standard error of the difference in linear predictions
(x1b - x2b) between equations 1 and 2 is calculated.

For more information on using predict after multiple-equation estimation
commands, see [R] predict.

Syntax for margins

margins [marginlist] [, options]

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

statistic          Description
-------------------------------------------------------------------------
default            linear predictions for each equation
xb                 linear prediction for a specified equation
difference         difference between the linear predictions of two
equations
stdp               not allowed with margins
residuals          not allowed with margins
stddp              not allowed with margins
-------------------------------------------------------------------------
xb defaults to the first equation.

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 and
differences between the linear predictions of two equations.

Examples

Setup
. webuse supDem
. global demand "(qDemand: quantity price pcompete income)"
. global supply "(qSupply: quantity price praw)"
. reg3 \$demand \$supply, endog(price)
. summarize pcompete, meanonly
. replace pcompete = r(mean)
. summarize income, meanonly
. replace income = r(mean)
. summarize praw, meanonly
. replace praw = r(mean)

Predict demand
. predict demand, equation(qDemand)

Predict supply
. predict supply, equation(qSupply)

```