help nl postestimation dialog: predict
also see: nl
-------------------------------------------------------------------------------
Title
[R] nl postestimation -- Postestimation tools for nl
Description
The following postestimation commands are available for nl:
command description
-------------------------------------------------------------------------
estat AIC, BIC, VCE, and estimation sample summary
estat (svy) postestimation statistics for survey data
estimates cataloging estimation results
lincom point estimates, standard errors, testing, and
inference for linear combinations of coefficients
(1) lrtest likelihood-ratio test
(2) margins marginal means, predictive margins, marginal effects,
and average marginal effects
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
-------------------------------------------------------------------------
(1) lrtest is not appropriate with svy estimation results.
(2) You must specify the variables() option with nl.
Syntax for predict
predict [type] newvar [if] [in] [, statistic]
predict [type] {stub*|newvar_1 ... newvar_k} [if] [in] , scores
where k is the number of parameters in the model.
statistic description
-------------------------------------------------------------------------
Main
yhat fitted values; the default
residuals residuals
pr(a,b) Pr(y | a < y < b)
e(a,b) E(y | a < y < b)
ystar(a,b) E(y*), y* = max(a,min(y,b))
-------------------------------------------------------------------------
These statistics are available both in and out of sample; type predict
... if e(sample) ... if wanted only for the estimation sample.
Menu
Statistics > Postestimation > Predictions, residuals, etc.
Options for predict
+------+
----+ Main +-------------------------------------------------------------
yhat, the default, calculates the fitted value.
residuals calculates the residuals.
pr(a,b) calculates Pr(a < xb + u < b), the probability that y|x would be
observed in the interval (a,b).
a and b may be specified as numbers or variable names; lb and ub are
variable names;
pr(20,30) calculates Pr(20 < xb + u < 30);
pr(lb,ub) calculates Pr(lb < xb + u < ub); and
pr(20,ub) calculates Pr(20 < xb + u < ub).
a missing (a > .) means minus infinity; pr(.,30) calculates
Pr(-infinity < xb + u < 30);
pr(lb,30) calculates Pr(-infinity < xb + u < 30) in observations for
which lb > .
and calculates Pr(lb < xb + u < 30) elsewhere.
b missing (b > .) means plus infinity; pr(20,.) calculates
Pr(+infinity > xb + u > 20);
pr(20,ub) calculates Pr(+infinity > xb + u > 20) in observations for
which ub > .
and calculates Pr(20 < xb + u < ub) elsewhere.
e(a,b) calculates E(y | a < y < b), the expected value of y|x conditional
on y|x being in the interval (a,b), meaning that y|x is censored,
assuming that the error term in the model is independent and
identically distributed.
a and b are specified as they are for pr().
ystar(a,b) calculates E(y*), where y* = a if y < a, y* = b if y > b, and
y* = y otherwise, meaning that y* is truncated, assuming that the
error term in the model is independent and identically distributed.
a and b are specified as they are for pr().
scores calculates the scores. The jth new variable created will contain
the score for the jth parameter in e(b).
Examples
---------------------------------------------------------------------------
Setup
. sysuse auto
. nl (mpg = {b0} + {b1} / turn)
Calculate predicted value of mpg
. predict mpghat
Calculate residuals
. predict mpgerr, residuals
---------------------------------------------------------------------------
Setup
. sysuse auto
. nl (mpg = {b0} + {b1}*weight^{gamma=-1}), variables(weight)
Obtain elasticity of weight with respect to mpg
. margins, eyex(weight)
---------------------------------------------------------------------------
Also see
Manual: [R] nl postestimation
Help: [R] nl