*! version 1.1.2 25oct2017
help npiv (SJ18-4: st0547)

Title

npiv -- Nonparametric instrumental-variable regression of
a scalar outcome on a scalar endogenous regressor and a vector of exogenous
covariates with an instrument

Syntax

Nonparametric instrumental-variable (NPIV) regression with a B-spline basis

npiv depvar expvar inst [exovar] [if] [in]
[, options]

NPIV regression with a power polynomial basis

npiv depvar expvar inst [exovar] [if] [in]
[, polynomial options]

NPIV regression with an increasing shape restriction

npiv depvar expvar inst [exovar] [if] [in]
[, increasing options]

NPIV regression with a decreasing shape restriction

npiv depvar expvar inst [exovar] [if] [in]
[, decreasing options]

options

power_exp(integer) degree of the power of the basis
function for the endogenous regressor; default is power_exp(2)

power_inst(integer) degree of the power of the basis
function for the instrument; default is power_inst(3)

num_exp(integer) number of knots for the basis of
the endogenous regressor; default is num_exp(2)

num_inst(integer) number of knots for the basis of
the instrument; default is num_inst(3)

pctile(integer) domain over which the nonparametric
sieve estimator is evaluated; default is pctile(5)

polynomial specify the type of both bases p(x) and q(w) to be power polynomials

increasing impose that the NPIV estimator is an increasing function of the endogenous regressor

decreasing impose that the NPIV estimator is a decreasing function of the endogenous regressor

expvar is an endogenous regressor, inst an instrument, and exovar a list of exogenous covariates.

exovar may contain factor variables; see fvvarlist.

Description

npiv provides NPIV models with or without imposing monotonicity
restrictions on the function of interest. Suppose Y is an outcome, X an
endogenous regressor, Z a list of exogenous covariates, and W an instrument.
Given a model equation, Y = g(X) + Z'γ+ e, and the assumption, E(e | W, Z) =
0, npiv gives estimators for g(X) and γ. Under the default setup,
npiv runs series instrumental-variable regression on a B-spline basis
with no shape restriction.

npiv requires that community-contributed commands bspline and
polyspline be installed from Statistical Software Components.

npiv with polynomial uses a power polynomial basis instead of a
B-spline basis. Options num_exp() and num_inst() are unnecessary
and are ignored if they are specified by the user.

npiv with increasing (or decreasing) imposes an increasing
(or decreasing) shape restriction on the nonparametric function g(X). A
monotone shape restriction may significantly improve the performance of the
NPIV estimator (Chetverikov and Wilhelm 2017).

npiv stores the fitted values of g(X) in the variable npest. Other
results are stored in e().

Options

power_exp(integer) specifies a positive integer for the degree of the
spline basis for the endogenous regressor. The default is power_exp(2).

power_inst(integer) specifies a positive integer for the degree of the
spline basis for the instrument. power_inst() must be equal to or
larger than power_exp(). The default is power_inst(3).

num_exp(integer) specifies a positive integer greater than 1 for the
number of knots of the spline basis for the endogenous regressor.
num_exp() must be no less than power_exp(). The default is
num_exp(2). The user need not specify this option if polynomial is used.

num_inst(integer) specifies a positive integer greater than 1 for the
number of knots of the spline basis for the instrument. num_inst() must be no less than num_exp(). The default is num_inst(3). The
user need not specify this option if polynomial is used.

pctile(integer) specifies the domain of the endogenous regressor over
which the NPIV estimator of g is to be computed. pctile(integer) must be a positive integer smaller than 50. For a given value of k, the NPIV
estimator is computed at fine grid points within the kth and the (100-k)th
percentiles of the empirical distribution of X. The default is
pctile(5).

polynomial specifies the type of both bases p(x) and q(w) to be power
polynomials. Choices of numbers of knots are ignored under this option.
Shape restrictions cannot be imposed for this basis, and an error message is
generated if this option is used together with decreasing or
increasing.

increasing imposes that the NPIV estimator is an increasing function of
the endogenous regressor. If this option is specified, the basis p(x) is
forced to be quadratic B-spline, and the option power_exp(integer) is not
used. An error occurs when this option is used together with one of the
options decreasing or polynomial. The basis q(w) for the
instrument is also restricted to be a B-spline, but the power and number of
knots can be freely chosen through power_inst(integer) and
num_inst(integer).

decreasing imposes that the NPIV estimator is a decreasing function of
the endogenous regressor. The same restrictions as for increasing apply
to this option.

Examples

Setup - Y = price, X = mpg, W = trunk, Z = weight

. sysuse auto

NPIV regression under a default setting

. npiv price mpg trunk

NPIV regression with a cubic B-spline (four knots) for mpg and a quintic
B-spline (five knots) for trunk

. npiv price mpg trunk, power_exp(3) power_inst(5) num_exp(4) num_inst(5)

NPIV regression with a polynomial basis

. npiv price mpg trunk, polynomial

NPIV regression with a cubic polynomial for mpg and a quintic polynomial
for trunk

. npiv price mpg trunk, power_exp(3) power_inst(5) polynomial

NPIV regression imposing increasing shape with a cubic B-spline (four knots)
for mpg and a quintic B-spline (five knots) for trunk

. npiv price mpg trunk, power_exp(3) power_inst(5) num_exp(4) num_inst(5) increasing

Default setup regression without Z and plot the fitted value with data

. npiv price mpg trunk

. scatter price mpg || line npest grid

Stored results

npiv stores the following in e():

Scalars

e(N) number of observations

e(powerexp) power of basis for endogenous regressor

e(powerinst) power of basis for instrument

e(numexp) number of knots of basis for endogenous regressor

e(numinst) number of knots of basis for instrument

e(pct) value specified by pctile() option

e(xmin) minimum of endogenous regressor

e(xmax) maximum of endogenous regressor

e(wmin) minimum of instrument

e(wmax) maximum of instrument

e(gmin) minimum of grid on which g is evaluated

e(gmax) maximum of grid on which g is evaluated

Macros

e(cmd) npiv

e(depvar) name of outcome

e(expvar) name of endogenous regressor

e(inst) name of instrument

e(exovar) list of exogenous covariates

e(basis) type of spline basis

e(title) NPIV regression

e(shape) type of imposed shape restriction

Matrices

e(b) coefficient vector

Remarks

This is a first and preliminary version. Please feel free to share your
comments, reports of bugs, and propositions for extensions.

If you use this command in your work, please cite Chetverikov and Wilhelm
(2017) and Chetverikov, Kim, and Wilhelm (2018).

References

Chetverikov, D., D. Kim, and D. Wilhelm. 2018.
Nonparametric instrumental-variable estimation.
Stata Journal 18: 937-950.

Chetverikov, D., and D. Wilhelm. 2017. Nonparametric instrumental variable
estimation under monotonicity. Econometrica 85: 1303-1320.

Authors

Denis Chetverikov

Department of Economics

University of California, Los Angeles

Los Angeles, CA

chetverikov@econ.ucla.edu

Dongwoo Kim

Department of Economics

University College London

London, UK

dongwoo.kim.13@ucl.ac.uk

Daniel Wilhelm

Department of Economics

University College London

London, UK

d.wilhelm@ucl.ac.uk

Also see

Article: Stata Journal, volume 18, number 4: st0547