Skip to contents

This function calculates adaptive bandwidth values (`h`) for kernel smoothing based on a given span (`rho`) and estimated propensity scores (`p`). It is used in lbc_net but can also be applied independently for bandwidth selection in other kernel-based methods.

Usage

span_bw(rho, ck, p)

Arguments

rho

Numeric. The span (proportion of data points) used to determine the adaptive bandwidth. Ensures a sufficient local sample size for accurate balance estimation.

ck

Numeric vector. Pre-specified kernel center points, strictly between 0 and 1.

p

Numeric vector. Estimated propensity scores, with values strictly between 0 and 1. Typically generated from logistic regression but can be user-supplied.

Value

A numeric vector of bandwidth values (`h`), corresponding to each `ck`.

Details

The adaptive bandwidths (`h`) ensure that each local region contains approximately rho * N observations, where N is the total number of observations. This helps maintain stable kernel-based local balance estimation.

Examples

# Simulated dataset
set.seed(123)
N <- 500
Z <- as.data.frame(matrix(rnorm(N * 5), ncol = 5))
colnames(Z) <- paste0("X", 1:5)
T <- rbinom(N, 1, 0.5)  # Binary treatment assignment

# Logistic regression for propensity score estimation
log.fit <- glm(T ~ ., data = Z, family = "binomial")
p <- log.fit$fitted.values  # Extract estimated propensity scores

# Compute bandwidths
ck <- seq(0.01, 0.99, 0.01)  # Kernel center points
rho <- 0.15  # Span
h <- span_bw(rho, ck, p)
print(h)
#>  [1] 0.444590162 0.434590162 0.424590162 0.414590162 0.404590162 0.394590162
#>  [7] 0.384590162 0.374590162 0.364590162 0.354590162 0.344590162 0.334590162
#> [13] 0.324590162 0.314590162 0.304590162 0.294590162 0.284590162 0.274590162
#> [19] 0.264590162 0.254590162 0.244590162 0.234590162 0.224590162 0.214590162
#> [25] 0.204590162 0.194590162 0.184590162 0.174590162 0.164590162 0.154590162
#> [31] 0.144590162 0.134590162 0.124590162 0.114590162 0.104590162 0.094590162
#> [37] 0.084590162 0.074590162 0.064590162 0.054590162 0.044590162 0.034836062
#> [43] 0.026058180 0.018778042 0.013555681 0.011022614 0.008362981 0.006701713
#> [49] 0.006711111 0.007392425 0.008403778 0.008432826 0.010520541 0.013910124
#> [55] 0.019944141 0.028128455 0.036604152 0.046604152 0.056604152 0.066604152
#> [61] 0.076604152 0.086604152 0.096604152 0.106604152 0.116604152 0.126604152
#> [67] 0.136604152 0.146604152 0.156604152 0.166604152 0.176604152 0.186604152
#> [73] 0.196604152 0.206604152 0.216604152 0.226604152 0.236604152 0.246604152
#> [79] 0.256604152 0.266604152 0.276604152 0.286604152 0.296604152 0.306604152
#> [85] 0.316604152 0.326604152 0.336604152 0.346604152 0.356604152 0.366604152
#> [91] 0.376604152 0.386604152 0.396604152 0.406604152 0.416604152 0.426604152
#> [97] 0.436604152 0.446604152 0.456604152