Density estimation and inference methods are widely used in empirical work. When the underlying distribution has compact support, conventional kernel-based density estimators are no longer consistent near or at the boundary because of their well-known boundary bias. Alternative smoothing methods are available to handle boundary points in density estimation, but they all require additional tuning parameter choices or other typically ad hoc modifications depending on the evaluation point and/or approach considered. This article discusses the R and Stata package lpdensity implementing a novel local polynomial density estimator proposed and studied in Cattaneo, Jansson, and Ma (2020, 2021), which is boundary adaptive and involves only one tuning parameter. The methods implemented also cover local polynomial estimation of the cumulative distribution function and density derivatives. In addition to point estimation and graphical procedures, the package offers consistent variance estimators, mean squared error optimal bandwidth selection, robust bias-corrected inference, and confidence bands construction, among other features. A comparison with other density estimation packages available in R using a Monte Carlo experiment is provided.
翻译:在经验工作中广泛使用密度估计和推断方法。当基础分布得到紧凑支持时,传统内核密度估计器由于众所周知的边界偏差,不再在边界附近或边界线上保持一致。在密度估计中,有处理边界点的其他平滑方法可供选择,但它们都需要根据所考虑的评价点和/或方法,进行额外的调整参数选择或其他通常特别的修改。本文章讨论了R和Stata软件包的倾斜度,在Cattaneo、Jansson和Ma(202020,2021年)提出并研究的新型多米密度估计器,这是边界适应性的,只涉及一个调幅参数。所实施的方法还包括对累积分布函数和密度衍生物的局部多米估计。除了点估计和图形程序外,包还提供一致的差异估计器、平均正方位误差最佳带宽选择、稳健的偏差校正的推断力和信心带结构等特征。提供了与使用蒙特卡洛试验的R现有其他密度估计包的比较。