| Title: | Bootstrap Inference with Debiased Nonparametric Estimators |
|---|---|
| Description: | Implements debiased kernel density and local-linear regression estimators with empirical-bootstrap simultaneous confidence bands, as proposed by Cheng and Chen (2019) <doi:10.1214/19-EJS1575>. Also provides bandwidth selectors and grid-based confidence sets for density level sets and inverse regression. |
| Authors: | Gang Cheng [aut, cre], Yen-Chi Chen [aut] |
| Maintainer: | Gang Cheng <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-09-30 10:57:43 UTC |
| Source: | https://github.com/mathcg/debiased-inference |
Evaluate the Gaussian debiased KDE in equation (3) of Cheng and Chen or construct its empirical-bootstrap simultaneous confidence band (Figure 2).
debiased_kde(x, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L) kde_confidence_band(x, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, studentized = FALSE, random_state = NULL, grid_size = 200L)debiased_kde(x, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L) kde_confidence_band(x, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, studentized = FALSE, random_state = NULL, grid_size = 200L)
x |
Numeric observations or a numeric matrix with observations in rows. |
points |
Optional evaluation vector or matrix; required for multivariate data. |
bandwidth |
Positive isotropic bandwidth selected for the ordinary KDE. |
tau |
Positive ratio |
grid_size |
Generated grid size for one-dimensional data. |
confidence |
Confidence level strictly between zero and one. |
n_boot |
Positive number of empirical-bootstrap replicates. |
studentized |
Whether to use the variable-width band in Remark 1. |
random_state |
Optional local random seed; the caller's RNG state is preserved. |
debiased_kde() returns a di_estimate;
kde_confidence_band() returns a di_band.
Cheng, G. and Chen, Y.-C. (2019). Nonparametric Inference via Bootstrapping the Debiased Estimator. Electronic Journal of Statistics, 13(1). doi:10.1214/19-EJS1575.
x <- rnorm(50) fit <- debiased_kde(x, bandwidth = 0.4) band <- kde_confidence_band(x, bandwidth = 0.4, n_boot = 19, random_state = 1)x <- rnorm(50) fit <- debiased_kde(x, bandwidth = 0.4) band <- kde_confidence_band(x, bandwidth = 0.4, n_boot = 19, random_state = 1)
Fit the debiased local-linear estimator in equation (5) of Cheng and Chen or construct its paired-bootstrap simultaneous confidence band (Figure 3).
debiased_local_linear(x, y, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L, n_folds = 5L, random_state = 0L) regression_confidence_band(x, y, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, random_state = NULL, grid_size = 200L, n_folds = 5L, max_attempts = NULL)debiased_local_linear(x, y, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L, n_folds = 5L, random_state = 0L) regression_confidence_band(x, y, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, random_state = NULL, grid_size = 200L, n_folds = 5L, max_attempts = NULL)
x |
Numeric one-dimensional covariates. |
y |
Numeric responses of the same length as |
points |
Optional numeric evaluation grid. |
bandwidth |
Positive bandwidth selected for the ordinary smoother. |
tau |
Positive ratio |
grid_size |
Generated grid size when |
n_folds |
Number of cross-validation folds for bandwidth selection. |
random_state |
Optional local random seed. |
confidence |
Confidence level strictly between zero and one. |
n_boot |
Positive number of paired-bootstrap replicates. |
max_attempts |
Maximum resamples attempted if singular fits occur. |
A di_estimate or di_band object.
Cheng, G. and Chen, Y.-C. (2019). Nonparametric Inference via Bootstrapping the Debiased Estimator. Electronic Journal of Statistics, 13(1). doi:10.1214/19-EJS1575.
x <- seq(-1, 1, length.out = 50) y <- sin(pi * x) + rnorm(50, sd = 0.1) fit <- debiased_local_linear(x, y, bandwidth = 0.3) band <- regression_confidence_band(x, y, bandwidth = 0.3, n_boot = 19, random_state = 1)x <- seq(-1, 1, length.out = 50) y <- sin(pi * x) + rnorm(50, sd = 0.1) fit <- debiased_local_linear(x, y, bandwidth = 0.3) band <- regression_confidence_band(x, y, bandwidth = 0.3, n_boot = 19, random_state = 1)
Select the bandwidth on the ordinary estimator, as required by the debiasing
method. Density estimation uses a normal-reference rule and regression uses
K-fold cross-validation of the ordinary local-linear smoother. In one
dimension, the density rule is
, matching the paper's use of the
normal-scale selector from the ks package.
density_bandwidth(x, method = "normal_reference", candidates = NULL, block_size = 512L) regression_bandwidth(x, y, candidates = NULL, n_folds = 5L, random_state = 0L)density_bandwidth(x, method = "normal_reference", candidates = NULL, block_size = 512L) regression_bandwidth(x, y, candidates = NULL, n_folds = 5L, random_state = 0L)
x |
Numeric observations or covariates. |
y |
Numeric responses. |
method |
For density estimation, either |
candidates |
Optional positive candidate bandwidths for cross-validation. |
block_size |
Positive pairwise-computation block size for density cross-validation. |
n_folds |
Number of cross-validation folds. |
random_state |
Optional local random seed. |
A positive numeric scalar.
Estimate equality level sets on a one-dimensional or rectangular two- dimensional grid, invert a simultaneous band to obtain a confidence set, or calculate finite-point-cloud Hausdorff distance.
level_set(estimate, level) invert_confidence_band(band, level) hausdorff_distance(a, b) density_level_set(x, level, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L) density_level_set_confidence(x, level, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, method = "hausdorff", random_state = NULL, grid_size = 200L, max_attempts = NULL) inverse_regression(x, y, level, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L, n_folds = 5L, random_state = 0L) inverse_regression_confidence(x, y, level, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, method = "hausdorff", random_state = NULL, grid_size = 200L, n_folds = 5L, max_attempts = NULL)level_set(estimate, level) invert_confidence_band(band, level) hausdorff_distance(a, b) density_level_set(x, level, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L) density_level_set_confidence(x, level, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, method = "hausdorff", random_state = NULL, grid_size = 200L, max_attempts = NULL) inverse_regression(x, y, level, points = NULL, bandwidth = NULL, tau = 1, grid_size = 200L, n_folds = 5L, random_state = 0L) inverse_regression_confidence(x, y, level, points = NULL, bandwidth = NULL, tau = 1, confidence = 0.95, n_boot = 999L, method = "hausdorff", random_state = NULL, grid_size = 200L, n_folds = 5L, max_attempts = NULL)
estimate |
A |
band |
A |
level |
Finite target level. |
a |
First non-empty numeric vector or point matrix. |
b |
Second non-empty numeric vector or point matrix. |
x |
Numeric observations or covariates. |
y |
Numeric responses for inverse regression. |
points |
Optional evaluation grid. Density level sets accept a vector or a complete rectangular two-dimensional point matrix; inverse regression accepts a vector. |
bandwidth |
Optional positive bandwidth. |
tau |
Positive ratio |
grid_size |
Generated grid size when points are omitted. |
confidence |
Confidence level strictly between zero and one. |
n_boot |
Positive number of bootstrap replicates. |
method |
Either |
random_state |
Optional local random seed. |
max_attempts |
Maximum resamples attempted when sets are empty. |
n_folds |
Cross-validation folds for a regression bandwidth. |
Level-set and inverse-regression functions return a di_set;
hausdorff_distance() returns a nonnegative scalar.
Compact summaries of estimates, confidence bands, and level sets.
## S3 method for class 'di_estimate' print(x, ...) ## S3 method for class 'di_band' print(x, ...) ## S3 method for class 'di_set' print(x, ...)## S3 method for class 'di_estimate' print(x, ...) ## S3 method for class 'di_band' print(x, ...) ## S3 method for class 'di_set' print(x, ...)
x |
A result object. |
... |
Unused. |
The input object, invisibly.