npregivderiv  R Documentation 
npregivderiv
uses the approach of Florens, Racine and Centorrino
(forthcoming) to compute the partial derivative of a nonparametric
estimation of an instrumental regression function phi
defined by conditional moment restrictions stemming from a structural
econometric model: E [Y  phi (Z,X)
 W ] = 0, and involving endogenous variables Y and Z and
exogenous variables X and instruments W. The derivative
function phi' is the solution of an illposed inverse
problem, and is computed using LandweberFridman regularization.
npregivderiv(y, z, w, x = NULL, zeval = NULL, weval = NULL, xeval = NULL, random.seed = 42, iterate.max = 1000, iterate.break = TRUE, constant = 0.5, start.from = c("Eyz","EEywz"), starting.values = NULL, stop.on.increase = TRUE, smooth.residuals = TRUE, ...)
y 
a one (1) dimensional numeric or integer vector of dependent data, each
element i corresponding to each observation (row) i of

z 
a pvariate data frame of endogenous regressors. The data types may be continuous, discrete (unordered and ordered factors), or some combination thereof. 
w 
a qvariate data frame of instruments. The data types may be continuous, discrete (unordered and ordered factors), or some combination thereof. 
x 
an rvariate data frame of exogenous regressors. The data types may be continuous, discrete (unordered and ordered factors), or some combination thereof. 
zeval 
a pvariate data frame of endogenous regressors on which the
regression will be estimated (evaluation data). By default, evaluation
takes place on the data provided by 
weval 
a qvariate data frame of instruments on which the regression
will be estimated (evaluation data). By default, evaluation
takes place on the data provided by 
xeval 
an rvariate data frame of exogenous regressors on which the
regression will be estimated (evaluation data). By default,
evaluation takes place on the data provided by 
random.seed 
an integer used to seed R's random number generator. This ensures replicability of the numerical search. Defaults to 42. 
iterate.max 
an integer indicating the maximum number of iterations permitted before termination occurs for LandweberFridman iteration. 
iterate.break 
a logical value indicating whether to compute all objects up to

constant 
the constant to use for LandweberFridman iteration. 
start.from 
a character string indicating whether to start from
E(Yz) (default, 
starting.values 
a value indicating whether to commence
LandweberFridman assuming
phi'[1]=starting.values (proper
LandweberFridman) or instead begin from E(yz) (defaults to

stop.on.increase 
a logical value (defaults to 
smooth.residuals 
a logical value (defaults to 
... 
additional arguments supplied to 
Note that LandweberFridman iteration presumes that
phi[1]=0, and so for derivative estimation we
commence iterating from a model having derivatives all equal to
zero. Given this starting point it may require a fairly large number
of iterations in order to converge. Other perhaps more reasonable
starting values might present themselves. When start.phi.zero
is set to FALSE
iteration will commence instead using
derivatives from the conditional mean model E(yz). Should the
default iteration terminate quickly or you are concerned about your
results, it would be prudent to verify that this alternative starting
value produces the same result. Also, check the norm.stop vector for
any anomalies (such as the error criterion increasing immediately).
LandweberFridman iteration uses an optimal stopping rule based upon
E(yw)E(phi(z,x)w)^2
. However, if insufficient training is conducted the estimates can be
overly noisy. To best guard against this eventuality set nmulti
to a larger number than the default nmulti=1
for
npreg
.
Iteration will terminate when either the change in the value of
(E(yw)E(phi(z,x)w))/E(yw)^2 from iteration to iteration is
less than iterate.diff.tol
or we hit iterate.max
or
(E(yw)E(phi(z,x)w))/E(yw)^2 stops falling in value and
starts rising.
npregivderiv
returns a list with components phi.prime
,
phi
, num.iterations
, norm.stop
and
convergence
.
This function currently supports univariate z
only. This
function should be considered to be in ‘beta test’ status until
further notice.
Jeffrey S. Racine racinej@mcmaster.ca
Carrasco, M. and J.P. Florens and E. Renault (2007), “Linear Inverse Problems in Structural Econometrics Estimation Based on Spectral Decomposition and Regularization,” In: James J. Heckman and Edward E. Leamer, Editor(s), Handbook of Econometrics, Elsevier, 2007, Volume 6, Part 2, Chapter 77, Pages 56335751
Darolles, S. and Y. Fan and J.P. Florens and E. Renault (2011), “Nonparametric instrumental regression,” Econometrica, 79, 15411565.
Feve, F. and J.P. Florens (2010), “The practice of nonparametric estimation by solving inverse problems: the example of transformation models,” Econometrics Journal, 13, S1S27.
Florens, J.P. and J.S. Racine and S. Centorrino (forthcoming), “Nonparametric instrumental derivatives,” Journal of Nonparametric Statistics.
Fridman, V. M. (1956), “A method of successive approximations for Fredholm integral equations of the first kind,” Uspeskhi, Math. Nauk., 11, 233334, in Russian.
Horowitz, J.L. (2011), “Applied nonparametric instrumental variables estimation,” Econometrica, 79, 347394.
Landweber, L. (1951), “An iterative formula for Fredholm integral equations of the first kind,” American Journal of Mathematics, 73, 61524.
Li, Q. and J.S. Racine (2007), Nonparametric Econometrics: Theory and Practice, Princeton University Press.
Li, Q. and J.S. Racine (2004), “Crossvalidated Local Linear Nonparametric Regression,” Statistica Sinica, 14, 485512.
npregiv,npreg
## Not run: ## This illustration was made possible by Samuele Centorrino ## <samuele.centorrino@univtlse1.fr> set.seed(42) n < 1500 ## For trimming the plot (trim .5% from each tail) trim < 0.005 ## The DGP is as follows: ## 1) y = phi(z) + u ## 2) E(uz) != 0 (endogeneity present) ## 3) Suppose there exists an instrument w such that z = f(w) + v and ## E(uw) = 0 ## 4) We generate v, w, and generate u such that u and z are ## correlated. To achieve this we express u as a function of v (i.e. u = ## gamma v + eps) v < rnorm(n,mean=0,sd=0.27) eps < rnorm(n,mean=0,sd=0.05) u < 0.5*v + eps w < rnorm(n,mean=0,sd=1) ## In Darolles et al (2011) there exist two DGPs. The first is ## phi(z)=z^2 and the second is phi(z)=exp(abs(z)) (which is ## discontinuous and has a kink at zero). fun1 < function(z) { z^2 } fun2 < function(z) { exp(abs(z)) } z < 0.2*w + v ## Generate two y vectors for each function. y1 < fun1(z) + u y2 < fun2(z) + u ## You set y to be either y1 or y2 (ditto for phi) depending on which ## DGP you are considering: y < y1 phi < fun1 ## Sort on z (for plotting) ivdata < data.frame(y,z,w,u,v) ivdata < ivdata[order(ivdata$z),] rm(y,z,w,u,v) attach(ivdata) model.ivderiv < npregivderiv(y=y,z=z,w=w) ylim <c(quantile(model.ivderiv$phi.prime,trim), quantile(model.ivderiv$phi.prime,1trim)) plot(z,model.ivderiv$phi.prime, xlim=quantile(z,c(trim,1trim)), main="", ylim=ylim, xlab="Z", ylab="Derivative", type="l", lwd=2) rug(z) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.