Skip to contents

Overview

The rbbnp package implements the bias-bound approach of Schennach 2020. It uses Fourier analysis to bound smoothing bias in kernel density and conditional-mean estimators, allowing inference at MSE-oriented bandwidths without treating the bias as negligible. The resulting intervals prioritize validity and can be substantially wider than conventional or undersmoothed intervals.

The reported intervals are pointwise, not simultaneous bands. The formal coverage result assumes an infinite-order kernel whose Fourier transform equals one near the origin; the default "schennach" kernel is the recommended theorem-compatible choice. The default signal-to-noise frequency window is a documented finite-sample heuristic, while control = list(frequency_window = "schennach") requests the exact Theorem 2 rule and stops with guidance if that rule selects no usable frequency.

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
bias_bound_density() Kernel density estimation with bias-aware confidence intervals
bias_bound_regression() Kernel regression with bias-aware confidence intervals

Usage

Density Estimation

library(rbbnp)

# Generate two-fold-uniform data
set.seed(123)
x <- runif(500) + runif(500)

# Estimate density with bias-aware confidence intervals
fit <- bias_bound_density(x, bw = 0.1, kernel = "schennach")

# View results
fit
#> Bias-Bound Density Estimation
#> ==============================
#> Observations: 500 | Bandwidth: 0.100 | Kernel: Schennach2004
#> Smoothness: A = 3.86, r = 2.00

# Visualize
plot(fit)

Conditional Expectation (Regression)

# Generate heteroskedastic regression data
y <- -x^2 + 3 * x + rnorm(500) * x

# Estimate E[Y|X]
fit_reg <- bias_bound_regression(x, y, bw = 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 rbbnp, please cite the package (run citation("rbbnp") for the current version):

Dai, X. and Schennach, S. M. (2026). rbbnp: A Bias Bound Approach to Non-Parametric Inference. R package version 1.2.0. https://CRAN.R-project.org/package=rbbnp

@Manual{rbbnp,
  title  = {rbbnp: A Bias Bound Approach to Non-Parametric Inference},
  author = {Xinyu Dai and Susanne M. Schennach},
  year   = {2026},
  note   = {R package version 1.2.0},
  url    = {https://CRAN.R-project.org/package=rbbnp},
}

The package implements the method introduced in Schennach (2020).

Getting Help