# LPPOptBW.fit: Optimal bandwidth selection for inference at a point In kolesarm/RDHonest: Honest inference in sharp regression discontinuity designs

## Description

Basic computing engine called by `LPPOptBW` used to find optimal bandwidth

## Usage

 ```1 2``` ```LPPOptBW.fit(d, M, kern = "triangular", opt.criterion, alpha = 0.05, beta = 0.8, sclass = "H", order = 1, se.initial = "ROTEHW") ```

## Arguments

 `d` object of class `"LPPData"` `M` Bound on second derivative of the conditional mean function. `kern` specifies kernel function used in the local regression. It can either be a string equal to `"triangular"` (k(u)=(1-|u|)_{+}), `"epanechnikov"` (k(u)=(3/4)(1-u^2)_{+}), or `"uniform"` (k(u)= (|u|<1)/2), or else a kernel function. `opt.criterion` Optimality criterion that bandwidth is designed to optimize. It can either be based on exact finite-sample maximum bias and finite-sample estimate of variance, or asymptotic approximations to the bias and variance. The options are: `"MSE"`Finite-sample maximum MSE `"FLCI"`Length of (fixed-length) two-sided confidence intervals. `"OCI"`Given quantile of excess length of one-sided confidence intervals The finite-sample methods use conditional variance given by `sigma2`, if supplied. Otherwise, for the purpose of estimating the optimal bandwidth, conditional variance is assumed homoscedastic, and estimated using a nearest neighbor estimator. `alpha` determines confidence level, `1-alpha` for constructing/optimizing confidence intervals. `beta` Determines quantile of excess length to optimize, if bandwidth optimizes given quantile of excess length of one-sided confidence intervals. `sclass` Smoothness class, either `"T"` for Taylor or `"H"` for Hölder class. `order` Order of local regression 1 for linear, 2 for quadratic. `se.initial` Method for estimating initial variance for computing optimal bandwidth. Ignored if data already contains estimate of variance. "ROTEHW"Based on residuals from a local linear regression using a triangular kernel and ROT bandwidth "ROTdemeaned"Based on sum of squared deviations of outcome from estimate of intercept in local linear regression with triangular kernel and ROT bandwidth

## Value

a list with the following elements

`h`

Bandwidth

`sigma2`

estimate of conditional variance, from `d`

## Examples

 ```1 2 3``` ```# Lee dataset d <- LPPData(lee08[lee08\$margin>0, ], point=0) LPPOptBW.fit(d, kern = "uniform", M = 0.1, opt.criterion = "MSE")\$h ```

kolesarm/RDHonest documentation built on Jan. 14, 2019, 7:04 a.m.