## Stata 15 help for npregress_postestimation

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

Postestimation commands

The following postestimation commands are of special interest after
npregress:

Command            Description
-------------------------------------------------------------------------
npgraph            plot of conditional means
-------------------------------------------------------------------------

The following standard postestimation commands are also available:

Command            Description
-------------------------------------------------------------------------
estat summarize    summary statistics for the estimation sample
estat vce          variance-covariance matrix of the estimators (VCE)
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
test               Wald tests of simple and composite linear hypotheses
testnl             Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------

Syntax for predict

predict [type] newvar [if] [in] [, statistic]

predict [type] {stub*|newvarlist} [if] [in], derivatives

statistic            Description
-------------------------------------------------------------------------
Main
mean               conditional mean of the outcome; the default
residuals          residuals
-------------------------------------------------------------------------
These statistics are available for the estimation sample only.

Statistics > Postestimation

Description for predict

predict creates a new variable containing predictions such as conditional
mean of the outcome, residuals, or derivatives of the mean function.

Options for predict

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

mean, the default, calculates the conditional mean of the outcome
variable.

residuals calculates the residuals.

derivatives calculates the derivatives of the conditional mean.

Syntax for margins

margins [marginlist] [, options]

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

statistic            Description
-------------------------------------------------------------------------
Main
mean               conditional mean of the outcome; the default
residuals          not allowed with margins
derivatives        not allowed with margins
-------------------------------------------------------------------------

options              Description
-------------------------------------------------------------------------
SE
nose               do not estimate standard errors; the default
vce(vcetype)       vcetype may be nose or bootstrap
reps(#)            equivalent to vce(bootstrap, reps(#))
seed(#)            set random-number seed to #; must also specify
reps(#)

Reporting
citype(citype)     method to compute bootstrap confidence intervals;
default is citype(percentile)
-------------------------------------------------------------------------

citype               Description
-------------------------------------------------------------------------
percentile           percentile confidence intervals; the default
bc                   bias-corrected confidence intervals
normal               normal-based confidence intervals
-------------------------------------------------------------------------

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 the conditional mean.

Options for margins

+----+
----+ SE +---------------------------------------------------------------

nose suppresses calculation of the VCE and standard errors.  This is the
default.

vce(vcetype) specifies the type of standard error reported, which may be
either that no standard errors are reported (nose; the default) or
that bootstrap standard errors are reported (bootstrap); see [R]
vce_option.

We recommend that you select the number of replications using reps(#)
instead of specifying vce(bootstrap), which defaults to 50
replications. Be aware that the number of replications needed to
produce good estimates of the standard errors varies depending on the
problem.

reps(#) specifies the number of bootstrap replications to be performed.
Specifying this option is equivalent to specifying vce(bootstrap,
reps(#)).

seed(#) sets the random-number seed.  You must specify reps(#) with
seed(#).

+-----------+
----+ Reporting +--------------------------------------------------------

citype(citype) specifies the type of confidence interval to be computed.
By default, bootstrap percentile confidence intervals are reported as
recommended by Cattaneo and Jansson (2017).  citype may be one of
percentile, bc, or normal.

Syntax for npgraph

npgraph [if] [in] [, options]

options                   Description
-------------------------------------------------------------------------
Plot
marker_options          change look of markers (color, size, etc.)
marker_label_options    add marker labels; change look or position
noscatter               suppress scatterplot

Smoothed line
lineopts(cline_options) affect rendition of the smoothed line

Y axis, X axis, Titles, Legend, Overall
twoway_options          any options other than by() documented in [G-3]
twoway_options
-------------------------------------------------------------------------

Description for npgraph

npgraph plots the conditional mean estimated by npregress overlayed on a
scatterplot of the data.  npgraph is available only after fitting models
with one covariate.

Options for npgraph

+------+
----+ Plot +-------------------------------------------------------------

marker_options affect the rendition of markers drawn at the plotted
points, including their shape, size, color, and outline; see [G-3]
marker_options.

marker_label_options specify if and how the markers are to be labeled;
see [G-3] marker_label_options

noscatter suppresses superimposing a scatterplot of the observed data
over the smooth.  This option is useful when the number of resulting
points would be so large as to clutter the graph.

+---------------+
----+ Smoothed line +----------------------------------------------------

lineopts(cline_options) affects the rendition of the smoothed line; see
[G-3] cline_options.

+-----------+

addplot(plot) provides a way to add other plots to the generated graph;

+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

twoway_options are any of the options documented in [G-3] twoway_options,
excluding by().  These include options for titling the graph (see
[G-3] title_options) and for saving the graph to disk (see [G-3]
saving_option).

Examples

Setup
. webuse dui

Nonparametric regression of citations as a function of fines
. npregress kernel citations fines

Plot the estimated conditional mean function
. npgraph

Add taxes as a discrete covariate
. npregress kernel citations fines i.taxes

Estimate the mean number of citations when fines are increased by 15%
. margins, at(fines=generate(fines*1.15))

Reference

Cattaneo, M. D., and M. Jansson. 2017. Kernel-based semiparametric
estimators:  Small bandwidth asymptotics and bootstrap consistency.
Working paper.
http://eml.berkeley.edu/~mjansson/Papers/CattaneoJansson_Bootstrappin
> gSemiparametrics.pdf.

```