bwScv: Smoothed Cross-Validation for Circular Data

View source: R/bwScv.R

bwScvR Documentation

Smoothed Cross-Validation for Circular Data

Description

This function computes the optimal smoothing parameter (bandwidth) for circular data using a smoothed cross-validation (SCV) method (see doi:10.1007/s00180-023-01401-0).

Usage

bwScv(x, np = 500, lower = 0, upper = 60, tol = 0.1)

Arguments

x

Data from which the smoothing parameter is to be computed. The object is coerced to a numeric vector in radians using circular. Can be a numeric vector or an object of class circular. Note: computational complexity scales as O(n²) due to outer product operations; datasets with n > 2000 may cause performance and memory issues.

np

An integer specifying the number of points used in numerical integration to evaluate the SCV criterion. A higher number increases precision but also computational cost (recommended value is >= 100). Default is 500.

lower

Lower boundary of the interval for the optimization of the smoothing parameter kappa. Must be a positive numeric value smaller than upper. Default is 0.

upper

Upper boundary of the interval for the optimization of the smoothing parameter kappa. Must be a positive numeric value greater than lower. Default is 60.

tol

Convergence tolerance for the optimize function, determining the precision of the optimization process. Also used to detect convergence near boundaries: if the optimal value is within tol of lower or upper, a warning is issued suggesting interval adjustment. Default is 0.1.

Details

The smoothed cross-validation (SCV) method is an alternative bandwidth selection approach, originally introduced by Hall & Marron (1992) for linear densities and adapted for circular data by Zámečník et al. (2023).

The SCV criterion is given by

\mathrm{SCV}(\kappa) = \frac{R(K)}{nh} + \frac{1}{n^{2}} \sum_{i=1}^{n} \sum_{j=1}^{n} \big(K_{\kappa} * K_{\kappa} * K_{\kappa} * K_{\kappa} - 2K_{\kappa} * K_{\kappa} *K_{\kappa} + K_{\kappa} * K_{\kappa}\big)(\Theta_i - \Theta_j)

where K_\kappa is the Von Mises kernel with concentration \kappa (for the formula see 3.7, 3.8 in Zámečník et al. (2023)). The optimal bandwidth minimizes the sum ISB(\kappa) + IV(\kappa) over the interval [lower, upper].

The integral expressions involved in the SCV criterion (see Sections 3.2 in Zámečník et al., 2023) are evaluated numerically using the trapezoidal rule on a uniform grid of length np.

Value

The computed optimal smoothing parameter kappa, a numeric concentration parameter (analogous to inverse radians) that minimizes the smoothed cross-validation criterion within the interval [lower, upper] and the value of objective function at that point. Higher values indicate sharper, more concentrated kernels and less smoothing; lower values indicate broader kernels and more smoothing. If the optimization fails, a warning is issued.

References

Zámečník, S., Horová, I., Katina, S., & Hasilová, K. (2023). An adaptive method for bandwidth selection in circular kernel density estimation. Computational Statistics. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s00180-023-01401-0")}

Hall, P., & Marron, J. S. (1992). On the amount of noise inherent in bandwidth selection for a kernel density estimator. The Annals of Statistics, 20(1), 163-181.

See Also

bwTs, bwLscvg, bwCcv

Examples

# Example with circular data (Lower `nu` = more smoothing; higher = sharper peaks).
library(circular)
x <- rwrappednormal(100, mu = circular(2), rho = 0.5)
bw <- bwScv(x)
print(round(bw$minimum, 2))

x <- rvonmises(100, mu = circular(0.5), kappa = 2)
bw <- bwScv(x)
print(round(bw$minimum, 2))


circularKDE documentation built on Jan. 7, 2026, 9:06 a.m.