kdbwselect: Bandwidth Selection Procedures for Kernel Density Estimation...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/kdbwselect.R

Description

kdbwselect implements bandwidth selectors for kernel density point estimators and inference procedures developed in Calonico, Cattaneo and Farrell (2018). See also Calonico, Cattaneo and Farrell (2020) for related optimality results. It also implements other bandwidth selectors available in the literature. See Wand and Jones (1995) for background references.

Companion commands are: kdrobust for kernel density point estimation and inference procedures.

A detailed introduction to this command is given in Calonico, Cattaneo and Farrell (2019). For more details, and related Stata and R packages useful for empirical analysis, visit https://nppackages.github.io/.

Usage

1
2
kdbwselect(x, eval = NULL, neval = NULL, kernel = "epa", 
bwselect = "mse-dpi", bwcheck=21, imsegrid=30, subset = NULL)

Arguments

x

independent variable.

eval

vector of evaluation point(s). By default it uses 30 equally spaced points over to support of x.

neval

number of quantile-spaced evaluation points on support of x. Default is neval=30.

kernel

kernel function used to construct the kernel estimators. Options are epa for the epanechnikov kernel, and uni for the uniform kernel. Default is kernel = epa.

bwselect

bandwidth selection procedure to be used. Options are:

mse-dpi second-generation DPI implementation of MSE-optimal bandwidth. Default option.

imse-dpi second-generation DPI implementation of IMSE-optimal bandwidth (computed using grid of evaluation points selected).

imse-rot ROT implementation of IMSE-optimal bandwidth (computed using grid of evaluation points selected).

ce-dpi second generation DPI implementation of CE-optimal bandwidth.

ce-rot ROT implementation of CE-optimal bandwidth.

all reports all available bandwidth selection procedures.

Note: MSE = Mean Square Error; IMSE = Integrated Mean Squared Error; CE = Coverage Error; DPI = Direct Plug-in; ROT = Rule-of-Thumb. For details on implementation see Calonico, Cattaneo and Farrell (2019).

bwcheck

if a positive integer is provided, then the selected bandwidth is enlarged so that at least bwcheck effective observations are available at each evaluation point. Default is bwcheck = 15.

imsegrid

number of evaluations points used to compute the IMSE bandwidth selector. Default is imsegrid = 30.

subset

optional rule specifying a subset of observations to be used.

Value

Estimate

A matrix containing eval (grid points), h and b (bandwidths).

opt

A list containing options passed to the function.

Author(s)

Sebastian Calonico, Columbia University, New York, NY. sebastian.calonico@columbia.edu.

Matias D. Cattaneo, Princeton University, Princeton, NJ. cattaneo@princeton.edu.

Max H. Farrell, University of Chicago, Chicago, IL. max.farrell@chicagobooth.edu.

References

Calonico, S., M. D. Cattaneo, and M. H. Farrell. 2018. On the Effect of Bias Estimation on Coverage Accuracy in Nonparametric Inference. Journal of the American Statistical Association, 113(522): 767-779. doi: 10.1080/01621459.2017.1285776.

Calonico, S., M. D. Cattaneo, and M. H. Farrell. 2019. nprobust: Nonparametric Kernel-Based Estimation and Robust Bias-Corrected Inference. Journal of Statistical Software, 91(8). doi: 10.18637/jss.v091.i08.

Calonico, S., M. D. Cattaneo, and M. H. Farrell. 2020. Coverage Error Optimal Confidence Intervals for Local Polynomial Regression. Working Paper.

Fan, J., and Gijbels, I. 1996. Local polynomial modelling and its applications, London: Chapman and Hall.

Wand, M., and Jones, M. 1995. Kernel Smoothing, Florida: Chapman & Hall/CRC.

See Also

kdrobust

Examples

1
2
3
x   <- rnorm(500)
est <- kdbwselect(x)
summary(est)

Example output

Call: kdbwselect

Sample size (n)                             =    500
Kernel function                             =    Epanechnikov
Bandwidth selection method                  =    mse-dpi

=======================================
      eval       h        b
=======================================
1     -2.565   0.553    2.067
2     -2.382   0.579    2.067
3     -2.198   0.591    2.067
4     -2.014   0.632    2.067
5     -1.830   0.703    2.067
---------------------------------------
6     -1.646   0.821    2.067
7     -1.462   1.044    2.067
8     -1.279   1.705    2.067
9     -1.095   1.679    2.067
10    -0.911   1.096    2.067
---------------------------------------
11    -0.727   0.926    2.067
12    -0.543   0.835    2.067
13    -0.359   0.785    2.067
14    -0.176   0.757    2.067
15     0.008   0.745    2.067
---------------------------------------
16     0.192   0.745    2.067
17     0.376   0.767    2.067
18     0.560   0.814    2.067
19     0.744   0.893    2.067
20     0.927   1.052    2.067
---------------------------------------
21     1.111   1.503    2.067
22     1.295   1.993    2.067
23     1.479   1.177    2.067
24     1.663   0.968    2.067
25     1.847   0.832    2.067
---------------------------------------
26     2.031   0.724    2.067
27     2.214   0.654    2.067
28     2.398   0.607    2.067
29     2.582   0.596    2.067
30     2.766   0.583    2.067
---------------------------------------
=======================================

nprobust documentation built on Aug. 26, 2020, 5:12 p.m.