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 |
fit_mix |
output from |
L |
kernel function. Set internally to |
q |
dimension of |
mu , kappa , p |
mixture parameters. |
optim |
run an optimization? Defaults to |
h_grid |
vector of bandwidths for performing a grid search. Defaults
to |
plot_it |
display an informative plot on the optimization's grid search?
Defaults to |
optim_par , optim_lower , optim_upper |
parameters passed to |
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:
h_opt
: selected bandwidth.h_grid
:h_grid
, if used (otherwiseNULL
).MISE_opt
: minimum of the MISE loss.MISE_grid
: value of the MISE function ath_grid
, if used (otherwiseNULL
).
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)