## Stata 15 help for nlsur_postestimation

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

Postestimation commands

The following postestimation commands are available after nlsur:

Command            Description
-------------------------------------------------------------------------
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)
forecast         dynamic forecasts and simulations
hausman          Hausman's specification test
lincom           point estimates, standard errors, testing, and
inference for linear combinations of coefficients
lrtest           likelihood-ratio test
* 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 and residuals
predictnl        point estimates, standard errors, testing, and
inference for generalized predictions
test             Wald tests of simple and composite linear hypotheses
testnl           Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------
* You must specify the variables() option with nlsur.

Syntax for predict

predict [type] newvar [if] [in] [, equation(#eqno) yhat 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 fitted
values and residuals.

Options for predict

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

equation(#eqno) specifies to which equation you are referring.
equation(#1) would mean the calculation is to be made for the first
equation, equation(#2) would mean the second, and so on.  If you do
not specify equation(), results are the same as if you specified
equation(#1).

yhat, the default, calculates the fitted values for the specified
equation.

residuals calculates the residuals for the specified equation.

Syntax for margins

margins [marginlist] [, options]

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

statistic          Description
-------------------------------------------------------------------------
yhat               fitted values; the default
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 fitted values.

Examples

---------------------------------------------------------------------------
Setup
. sysuse auto
. nlsur (mpg = {b0} + {b1} / turn) (gear_ratio = {c0} + {c1}*length)

Calculate fitted values for the first equation
. predict mpghat, equation(#1)

Calculate residuals for the second equation
. predict gearerr, residuals equation(#2)

---------------------------------------------------------------------------
Setup
. webuse mfgcost, clear
. nlsur (s_k = {bk} + {dkk}*ln(pk/pm) + {dkl}*ln(pl/pm) +
{dke}*ln(pe/pm)) (s_l = {bl} + {dkl}*ln(pk/pm) + {dll}*ln(pl/pm)
+ {dle}*ln(pe/pm)) (s_e = {be} + {dke}*ln(pk/pm) +
{dle}*ln(pl/pm) + {dee}*ln(pe/pm)), ifgnls variables(pk pm pl pe)

Measure change in energy cost share with respect to change in price of
energy
. margins, dydx(pe) predict(equation(#3))

---------------------------------------------------------------------------

```