b_maxvarK: Gaussian kernel bandwidth by maximum off-diagonal var(K)

View source: R/bandwidth.R

b_maxvarKR Documentation

Gaussian kernel bandwidth by maximum off-diagonal var(K)

Description

Pick the Gaussian kernel bandwidth \sigma that maximizes the variance of the off-diagonal entries of the kernel matrix K. The idea is that this choice makes the columns of K most informative: at very small or very large \sigma, the off-diagonal entries collapse toward 0 or 1 respectively and carry little discriminating signal.

This is the bandwidth-selection convention used in kbal::b_maxvarK and the GPSS package; in KRLS 1.7+ it is also the default when sigma = NULL in krls.

b_maxvarK_nystrom is the Nystrom-aware variant: it evaluates the variance of the entries of the n by m cross-kernel C = K(X, Z) between observations and landmarks instead of forming the full n by n kernel.

Usage

b_maxvarK(X_proc, search_lower = 1e-6, search_upper = NULL,
          tol = .Machine$double.eps^0.25)

b_maxvarK_nystrom(X_proc, Z_proc, search_lower = 1e-6,
                  search_upper = NULL,
                  tol = .Machine$double.eps^0.25)

Arguments

X_proc

A numeric matrix in the same kernel-ready form that krls uses internally: continuous columns standardized to sd = 1, categorical columns one-hot encoded and multiplied by sqrt(0.5). Use krls's internal preprocessing if you want to recover the same matrix it uses.

Z_proc

Landmark matrix for the Nystrom variant. Same column structure as X_proc.

search_lower, search_upper

Lower and upper bounds of the bandwidth search interval passed to optimize. search_upper defaults to max(2 * ncol(X_proc), 2000).

tol

Tolerance forwarded to optimize. Default is .Machine$double.eps^0.25 (the optimize default).

Value

A list with components

sigma

the selected bandwidth.

var_K (or var_C)

the value of the off-diagonal variance at the selected bandwidth.

search_lower, search_upper

the bounds used for the search.

References

Hazlett, C. (2020). Kernel Balancing: A Flexible Non-Parametric Weighting Procedure for Estimating Causal Effects. Statistica Sinica.

See Also

krls, gausskernel.


KRLS documentation built on June 5, 2026, 9:06 a.m.