bw_rot_polysph: Rule-of-thumb bandwidth selection for polyspherical kernel...

View source: R/bwd.R

bw_rot_polysphR Documentation

Rule-of-thumb bandwidth selection for polyspherical kernel density estimator

Description

Computes the rule-of-thumb bandwidth for the polyspherical kernel density estimator using a product of von Mises–Fisher distributions as reference in the Asymptotic Mean Integrated Squared Error (AMISE).

Usage

bw_rot_polysph(X, d, kernel = 1, kernel_type = c("prod", "sph")[1],
  bw0 = NULL, upscale = FALSE, deriv = 0, k = 10, kappa = NULL, ...)

Arguments

X

a matrix of size c(n, sum(d) + r) with the sample.

d

vector of size r with dimensions.

kernel

kernel employed: 1 for von Mises–Fisher (default); 2 for Epanechnikov; 3 for softplus.

kernel_type

type of kernel employed: 1 for product kernel (default); 2 for spherically symmetric kernel.

bw0

initial bandwidth for minimizing the CV loss. If NULL, it is computed internally by magnifying the bw_mrot_polysph bandwidths by 50%. Can be also a matrix of initial bandwidth vectors.

upscale

rescale bandwidths to work on \mathcal{S}^{d_1}\times\cdots\times \mathcal{S}^{d_r} and for derivative estimation? Defaults to FALSE. If upscale = 1, the order n is upscaled. If upscale = 2, then also the kernel constant is upscaled.

deriv

derivative order to perform the upscaling. Defaults to 0.

k

softplus kernel parameter. Defaults to 10.0.

kappa

estimate of the concentration parameters. Computed if not provided (default).

...

further arguments passed to nlm.

Details

The selector assumes that the density curvature matrix \boldsymbol{R} of the unknown density is approximable by that of a product of von Mises–Fisher densities, \boldsymbol{R}(\boldsymbol{\kappa}). The estimation of the concentration parameters \boldsymbol{\kappa} is done by maximum likelihood.

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.

Value

A list with entries bw (optimal bandwidth) and opt, the latter containing the output of nlm.

Examples

n <- 100
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_rot_polysph(X = X, d = d)$bw

polykde documentation built on April 16, 2025, 1:11 a.m.