bw_cv_polysph | R Documentation |
Likelihood Cross-Validation (LCV) and Least Squares Cross-Validation (LSCV) bandwidth selection for the polyspherical kernel density estimator.
bw_cv_polysph(X, d, kernel = 1, kernel_type = 1, k = 10,
intrinsic = FALSE, type = c("LCV", "LSCV")[1], M = 10000, bw0 = NULL,
na.rm = FALSE, h_min = 0, upscale = FALSE, deriv = 0,
imp_mc = TRUE, seed_mc = NULL, exact_vmf = FALSE, common_h = FALSE,
spline = FALSE, opt = c("optim", "nlm")[1], ncores = 1, ...)
X |
a matrix of size |
d |
vector of size |
kernel |
kernel employed: |
kernel_type |
type of kernel employed: |
k |
softplus kernel parameter. Defaults to |
intrinsic |
use the intrinsic distance, instead of the
extrinsic-chordal distance, in the kernel? Defaults to |
type |
cross-validation type, either |
M |
Monte Carlo samples to use for approximating the integral in the LSCV loss. |
bw0 |
initial bandwidth vector for minimizing the CV loss. If
|
na.rm |
remove |
h_min |
minimum h enforced (componentwise). Defaults to |
upscale |
rescale the resulting bandwidths to work for derivative
estimation? Defaults to |
deriv |
derivative order to perform the upscaling. Defaults to |
imp_mc |
use importance sampling in the Monte Carlo approximation of
the integral in the LSCV loss? It is more accurate but also more time
consuming. Defaults to |
seed_mc |
seed for the Monte Carlo simulations used to estimate the
integral in the LSCV loss. Defaults to |
exact_vmf |
use the closed-form for the LSCV loss with the
von Mises–Fisher kernel? Defaults to |
common_h |
use the same bandwidth for all dimensions? Defaults to
|
spline |
use a faster spline approximation to compute Bessel functions?
Defaults to |
opt |
optimizer to use; either |
ncores |
number of cores used during the optimization. Defaults to
|
... |
further arguments passed to |
If bw0
is a matrix, then the optimization is started at that
row of bandwidths that is most promising for the optimization, i.e., the
bandwidths that minimized the CV loss.
A list with entries bw
(optimal bandwidth) and opt
,
the latter containing the output of nlm
,
optim
, or optimParallel
.
n <- 20
d <- 1:2
kappa <- rep(10, 2)
X <- r_vmf_polysph(n = n, d = d, mu = r_unif_polysph(n = 1, d = d),
kappa = kappa)
bw_cv_polysph(X = X, d = d, type = "LCV")$bw
bw_cv_polysph(X = X, d = d, type = "LSCV", exact_vmf = TRUE)$bw
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.