kernel.bandwidth: Kernel bandwidth estimation by median heuristic method with...

View source: R/BAT.R

kernel.bandwidthR Documentation

Kernel bandwidth estimation by median heuristic method with bootstrap CI

Description

Computes the Gaussian-kernel (Radial Basis Function) bandwidth \sigma using the median-heuristic (inverse of the median of squared Euclidean distances), and returns a bootstrap confidence interval. This assumes the kernel is parameterized as k(x_i, x_j) = \exp(-\sigma ||x_i - x_j||^2).

Usage

kernel.bandwidth(
  comm,
  scale_data = FALSE,
  ci_type = "bca",
  runs = 1000,
  conf = 0.95,
  cores = 1
)

Arguments

comm

A numeric matrix or data frame.

scale_data

Logical; if TRUE, variables are centered and scaled before distances are computed.

ci_type

Character; passed to boot.ci. One of "norm", "basic", "stud", "perc", or "bca".

runs

Integer; number of bootstrap resamples.

conf

Confidence level for the CI (between 0 and 1).

cores

Number of cores to be used in parallel processing. If = 0 all available cores are used.

Value

An object of class sigma_bootstrap_result containing:

sigma_original

Point estimate from the full data.

sigma_bootstrap

Bootstrap mean estimate.

bootstrap_se

Bootstrap standard error.

ci

Confidence interval object from boot.ci.

bootstrap_distribution

Vector of bootstrap values.

boot_object

The full boot object from boot().

References

Carvalho, J.C. & Cardoso, P. (2025) Quantifying species distribution within the functional space.

See Also

boot, boot.ci

Examples

set.seed(1)
comm <- matrix(rexp(200, rate = 0.1), ncol = 4)
res <- kernel.bandwidth(comm, runs = 99)
print(res)

BAT documentation built on Aug. 8, 2025, 6:35 p.m.

Related to kernel.bandwidth in BAT...