Skip to contents

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.

The Problem

Traditional nonparametric inference faces a dilemma: - Optimal bandwidths minimize mean squared error but introduce non-negligible bias - Undersmoothing reduces bias but produces inefficient, wider confidence intervals

The Solution

The bias-bound approach constructs confidence intervals that explicitly account for potential bias by estimating an upper bound on bias magnitude through Fourier analysis.

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)

Working with Results

Both functions return S3 objects with standard methods:

# Extract parameters (A, r, B, h)
coef(fit)

# Get confidence intervals
confint(fit)

# Detailed summary
summary(fit)

# For regression: fitted values
fitted(fit_reg)

Learning More

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

@article{schennach2020bias,
  title={A Bias Bound Approach to Non-parametric Inference},
  author={Schennach, Susanne M},
  journal={The Review of Economic Studies},
  volume={87},
  number={5},
  pages={2439--2472},
  year={2020},
  doi={10.1093/restud/rdz065}
}

Getting Help