kdrobust: Kernel Density Methods with Robust Bias-Corrected Inference

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

View source: R/kdrobust.R

Description

kdrobust implements kernel density point estimators, with robust bias-corrected confidence intervals 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 estimation and inference procedures available in the literature. See Wand and Jones (1995) for background references.

Companion commands: kdbwselect for kernel density data-driven bandwidth selection, and nprobust.plot for plotting results.

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
kdrobust(x, eval = NULL, neval = NULL, h = NULL, b = NULL, rho = 1, 
kernel = "epa", bwselect = NULL, bwcheck = 21, imsegrid=30, level = 95, 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.

h

main bandwidth used to construct the kernel density point estimator. Can be either scalar (same bandwidth for all evaluation points), or vector of same dimension as eval. If not specified, bandwidth h is computed by the companion command kdbwselect.

b

bias bandwidth used to construct the bias-correction estimator. Can be either scalar (same bandwidth for all evaluation points), or vector of same dimension as eval. By default it is set equal to h. If rho is set to zero, b is computed by the companion command kdbwselect.

rho

Sets b=h/rho. Default is rho = 1.

kernel

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

bwselect

bandwidth selection procedure to be used via lpbwselect. By default it computes h and sets b=h/rho (with rho=1 by default). It computes both h and b if rho is set equal to zero. Options are:

mse-dpi second-generation DPI implementation of MSE-optimal bandwidth. Default option if only one evaluation point is chosen.

imse-dpi second-generation DPI implementation of IMSE-optimal bandwidth (computed using a grid of evaluation points). Default option if more than one evaluation point is chosen.

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

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 = 21.

imsegrid

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

level

confidence level used for confidence intervals; default is level = 95.

subset

optional rule specifying a subset of observations to be used.

Value

Estimate

A matrix containing eval (grid points), h, b (bandwidths), N (effective sample sizes), tau.us (point estimates with p-th order kernel function), tau.bc (bias corrected point estimates, se.us (standard error corresponding to tau.us), and se.rb (robust standard error).

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): 1-33. 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

kdbwselect

Examples

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

Example output

Call: kdrobust

Sample size (n)                            =     500
Kernel order for point estimation (p)      =     2
Kernel function                            =     Epanechnikov
Bandwidth selection method                 =     mse-dpi

=============================================================================
                                     Point      Std.       Robust B.C.       
          eval        bw   Eff.n      Est.     Error      [ 95% C.I. ]       
=============================================================================
1       -3.215     0.579       4     0.003     0.003    [-0.003 , 0.007]     
2       -2.994     0.550      10     0.005     0.003    [-0.002 , 0.010]     
3       -2.773     0.537      15     0.007     0.004    [-0.001 , 0.013]     
4       -2.552     0.561      23     0.016     0.005     [0.003 , 0.025]     
5       -2.331     0.594      36     0.029     0.008     [0.012 , 0.042]     
-----------------------------------------------------------------------------
6       -2.110     0.622      50     0.043     0.009     [0.022 , 0.058]     
7       -1.889     0.690      81     0.065     0.010     [0.042 , 0.082]     
8       -1.668     0.849     118     0.103     0.011     [0.078 , 0.122]     
9       -1.447     1.298     226     0.163     0.010     [0.139 , 0.181]     
10      -1.225     1.690     313     0.208     0.008     [0.192 , 0.231]     
-----------------------------------------------------------------------------
11      -1.004     1.058     266     0.254     0.013     [0.232 , 0.286]     
12      -0.783     0.884     281     0.310     0.015     [0.285 , 0.348]     
13      -0.562     0.807     304     0.359     0.017     [0.331 , 0.400]     
14      -0.341     0.766     318     0.384     0.018     [0.355 , 0.427]     
15      -0.120     0.746     336     0.387     0.018     [0.357 , 0.431]     
-----------------------------------------------------------------------------
16       0.101     0.753     333     0.375     0.018     [0.346 , 0.418]     
17       0.322     0.791     309     0.353     0.017     [0.325 , 0.393]     
18       0.543     0.869     291     0.314     0.015     [0.288 , 0.352]     
19       0.764     1.023     279     0.272     0.013     [0.249 , 0.305]     
20       0.986     1.425     318     0.231     0.009     [0.212 , 0.257]     
-----------------------------------------------------------------------------
21       1.207     2.341     382     0.195     0.005     [0.175 , 0.210]     
22       1.428     1.141     181     0.154     0.010     [0.128 , 0.173]     
23       1.649     0.894     115     0.109     0.011     [0.083 , 0.128]     
24       1.870     0.799      81     0.076     0.010     [0.053 , 0.093]     
25       2.091     0.715      56     0.049     0.009     [0.029 , 0.064]     
-----------------------------------------------------------------------------
26       2.312     0.643      39     0.031     0.008     [0.014 , 0.044]     
27       2.533     0.601      26     0.018     0.006     [0.005 , 0.028]     
28       2.754     0.577      18     0.010     0.004     [0.000 , 0.016]     
29       2.976     0.552      10     0.004     0.003    [-0.002 , 0.009]     
30       3.197     0.550       6     0.003     0.003    [-0.003 , 0.007]     
-----------------------------------------------------------------------------
=============================================================================

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