We consider the problem of choosing two bandwidths simultaneously for estimating the difference of two functions at given points. When the asymptotic approximation of the mean squared error (AMSE) criterion is used, we show that minimisation problem is not well-defined when the sign of the product of the second derivatives of the underlying functions at the estimated points is positive. To address this problem, we theoretically define and construct estimators of the asymptotically first-order optimal (AFO) bandwidths which are well-defined regardless of the sign. They are based on objective functions which incorporate a second-order bias term. Our approach is general enough to cover estimation problems related to densities and regression functions at interior and boundary points. We provide a detailed treatment of the sharp regression discontinuity design.
This article is accompanied by a web appendix in which we present omitted discussions, an algorithm to implement the proposed method for the sharp RSS and proofs for the main results.