npiv_choose_J: Data-driven Choice of Sieve Dimension for Nonparametric...

View source: R/npiv.R

npiv_choose_JR Documentation

Data-driven Choice of Sieve Dimension for Nonparametric Instrumental Variables Estimation and Inference

Description

npiv_choose_J implements the data-driven choice of sieve dimension developed in Chen, Christensen, and Kankanala (2024) for nonparametric instrumental variables estimation using a B-spline sieve. It applies to nonparametric regression as a special case.

Usage

npiv_choose_J(Y, 
              X,
              W,
              X.grid = NULL,
              J.x.degree = 3,
              K.w.degree = 4,
              K.w.smooth = 2,
              knots = c("uniform", "quantiles"),
              basis = c("tensor", "additive", "glp"),
              X.min = NULL,
              X.max = NULL,
              W.min = NULL,
              W.max = NULL,
              grid.num = 50,
              boot.num = 99,
              check.is.fullrank = FALSE,
              progress = TRUE)

Arguments

Y

dependent variable vector.

X

matrix of endogenous regressors.

W

matrix of instrumental variables. Set W=X for nonparametric regression.

X.grid

vector of grid point(s). Default uses 50 equally spaced points over the support of each X variable.

J.x.degree

B-spline degree (integer or vector of integers of length ncol(X)) for approximating the structural function. Default is degree=3 (cubic B-spline).

K.w.degree

B-spline degree (integer or vector of integers of lenth ncol(W)) for estimating the nonparametric first-stage. Default is degree=4 (quartic B-spline).

K.w.smooth

non-negative integer. Basis for the nonparametric first-stage uses 2^{K.w.smooth} more B-spline segments for each instrument than the basis approximating the structural function. Default is 2. Setting K.w.smooth=0 uses the same number of segments for X and W.

knots

knots type, a character string. Options are:

quantiles interior knots are placed at equally spaced quantiles (equal number of observations lie in each segment).

uniform interior knots are placed at equally spoaced intervals over the support of the variable. Default option.

basis

basis type (if X or W are multivariate), a character string. Options are:

tensor tensor product basis. Default option.

additive additive basis for additively separable models.

glp generalized B-spline polynomial basis.

X.min

lower bound on the support of each X variable. Default is min(X).

X.max

upper bound on the support of each X variable. Default is max(X).

W.min

lower bound on the support of each W variable. Default is min(W).

W.max

upper bound on the support of each W variable. Default is max(W).

grid.num

number of grid points for each X variable if X.grid is not provided.

boot.num

number of bootstrap replications.

check.is.fullrank

check that X and W have full rank. Default is FALSE.

progress

whether to display progress bar or not. Default is TRUE.

Value

J.hat.max

largest element of candidate set of sieve dimensions searched over.

J.hat.n

second largest element of candidate set of sieve dimensions searched over.

J.hat

bootstrap-based Lepski choice of sieve dimension.

J.tilde

data-driven choice of sieve dimension using the method of Chen, Christensen, and Kankanala (2024). Minimum of J.hat and J.hat.n.

J.x.seg

data-driven number of segments for X using the method of Chen, Christensen, and Kankanala (2024).

K.w.seg

data-driven number of segments for W using the method of Chen, Christensen, and Kankanala (2024).

theta.star

Lepski critical value used in determination of J.hat.

Author(s)

Jeffrey S. Racine <racinej@mcmaster.ca>, Timothy Christensen <timothy.christensen@yale.edu>

References

Chen, X., T. Christensen and S. Kankanala (2024). “Adaptive Estimation and Uniform Confidence Bands for Nonparametric Structural Functions and Elasticities.” Review of Economic Studies, forthcoming. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/restud/rdae025")}

See Also

npiv

Examples

library(MASS)

## Simulate the data
n <- 10000
cov.ux <- 0.5
var.u <- 0.1
mu <- c(1,1,0)
Sigma <- matrix(c(1.0,0.85,cov.ux,
                  0.85,1.0,0.0,
                  cov.ux,0.0,1.0),
                3,3,
                byrow=TRUE)
foo <- mvrnorm(n = n,
               mu,
               Sigma)
X <- 2*pnorm(foo[,1],mean=mu[1],sd=sqrt(Sigma[1,1])) -1
W <- 2*pnorm(foo[,2],mean=mu[2],sd=sqrt(Sigma[2,2])) -1
U <- foo[,3]
## Cosine structural function
h0 <- sin(pi*X)
Y <- h0 + sqrt(var.u)*U

npiv_choose_J(Y,X,W)

JeffreyRacine/npiv documentation built on Jan. 17, 2025, 8:29 p.m.