bw_dir_pi {DirStats}R Documentation

Plug-in bandwidth selectors for directional data

Description

Plug-in bandwidth selectors for kernel density estimation with directional data, including Rule-Of-Thumb (ROT), Asymptotic MIxtures (AMI), and Exact MIxtures (EMI).

Usage

bw_dir_rot(data)

bw_dir_ami(data, fit_mix = NULL, L = NULL)

R_Psi_mixvmf(q, mu, kappa, p)

bw_dir_emi(data, fit_mix = NULL, optim = TRUE,
  h_grid = exp(seq(log(0.05), log(1.5), l = 100)), plot_it = TRUE,
  optim_par = 0.25, optim_lower = 0.06, optim_upper = 10)

Arguments

data

directional data, a matrix of size c(n, q + 1).

fit_mix

output from bic_vmf_mix. Computed internally if NULL (default).

L

kernel function. Set internally to function(x) exp(-x) (von Mises–Fisher kernel) if NULL (default).

q

dimension of S^q, q\ge 1.

mu, kappa, p

mixture parameters. mu is the mean matrix of size c(length(p), q + 1), kappa is vector of length(p) concentration parameters, and p is the vector of mixture proportions.

optim

run an optimization? Defaults to TRUE. Otherwise, a grid search on h is done. Only effective if L = NULL.

h_grid

vector of bandwidths for performing a grid search. Defaults to
exp(seq(log(0.05), log(1.5), l = 100)).

plot_it

display an informative plot on the optimization's grid search? Defaults to FALSE.

optim_par, optim_lower, optim_upper

parameters passed to par, lower, and upper in optim when using the "L-BFGS-B" method. Default to 0.25, 0.06 (to avoid numerical instabilities), and 10.

Details

See Algorithms 1 (AMI) and 2 (EMI) in García-Portugués (2013). The ROT selector is implemented according to Proposition 2, but without the paper's typo in equation (6), case q = 2, where an incorrect extra \hat\kappa appears premultiplying (1 + 4 \hat\kappa^2) \sinh(2 \hat\kappa) in the denominator.

bw_dir_ami uses R_Psi_mixvmf for computing the curvature term of a mixture of von Mises–Fisher densities.

bw_dir_emi employs Monte Carlo integration for q > 2, which results in a random output. Use set.seed before to avoid it.

Value

Selected bandwidth for bw_dir_rot and bw_dir_ami. bw_dir_emi returns a list with entries:

References

García-Portugués, E. (2013). Exact risk improvement of bandwidth selectors for kernel density estimation with directional data. Electronic Journal of Statistics, 7:1655–1685. doi:10.1214/13-ejs821

Examples

# Sample
n <- 25
q <- 2
set.seed(42)
samp <- rotasym::r_vMF(n = n, mu = c(1, rep(0, q)), kappa = 2)

# Mixture fit
fit_mix <- bic_vmf_mix(data = samp, plot_it = TRUE)

# ROT
bw_dir_rot(samp)

# AMI
bw_dir_ami(samp)
bw_dir_ami(samp, fit_mix = fit_mix)
bw_dir_ami(samp, fit_mix = fit_mix, L = function(x) exp(-x))

# EMI
bw_dir_emi(samp)
bw_dir_emi(samp, fit_mix = fit_mix, optim = FALSE, plot_it = TRUE)

[Package DirStats version 0.1.10 Index]