Overview
The rbbnp package implements the bias-bound approach to nonparametric inference developed by Schennach (2020). This method provides valid confidence intervals for kernel density and regression estimators using optimal bandwidths, without requiring undersmoothing.
Installation
# Install from CRAN
install.packages("rbbnp")
# Or install development version from GitHub
# install.packages("devtools")
devtools::install_github("xinyu-daidai/rbbnp-dev")Key Functions
| Function | Purpose |
|---|---|
biasBound_density() |
Density estimation with bias-aware confidence intervals |
biasBound_condExpectation() |
Regression with bias-aware confidence intervals |
select_bandwidth() |
Cross-validation or Silverman bandwidth selection |
Usage
Density Estimation
library(rbbnp)
# Generate sample data
X <- gen_sample_data(size = 500, dgp = "2_fold_uniform", seed = 123)
# Estimate density with bias-aware confidence intervals
fit <- biasBound_density(X, h = 0.1, kernel.fun = "Schennach2004")
# View results
fit
#> Bias-Bound Density Estimation
#> ==============================
#> Observations: 500 | Bandwidth: 0.100 | Kernel: Schennach2004
#> Smoothness: A = 4.30, r = 2.00
# Visualize
plot(fit)Conditional Expectation (Regression)
# Generate regression data
Y <- -X^2 + 3*X + rnorm(500) * X
# Estimate E[Y|X]
fit_reg <- biasBound_condExpectation(Y, X, h = 0.1)
# Visualize
plot(fit_reg)Learning More
- Get Started - Quick introduction and basic workflow
- Density Estimation - Detailed guide to density estimation
- Regression - Conditional expectation estimation
- Theoretical Background - Mathematical foundations
Citation
If you use this package, please cite:
Schennach, S. M. (2020). A Bias Bound Approach to Non-parametric Inference. The Review of Economic Studies, 87(5), 2439-2472. https://doi.org/10.1093/restud/rdz065
Getting Help
- Contact: Xinyu Dai (xinyu_dai@brown.edu)