bw.L2PCO {PCObw}R Documentation

Compute the full PCO bandwith

Description

bw.L2PCO tries to minimise the PCO criterion (described and studied in Varet, S., Lacour, C., Massart, P., Rivoirard, V., (2019)) with a gold section search. For multivariate data, it searches for a full matrix.

Usage

bw.L2PCO(
  x_i,
  nh = 40,
  K_name = "gaussian",
  binning = FALSE,
  nb = 32,
  tol = 1e-06,
  adapt_nb_bin = FALSE,
  nb_bin_vect = NULL
)

Arguments

x_i

the observations. Must be a matrix with d column and n lines (d the dimension and n the sample size)

nh

the maximum number of PCO criterion evaluations during the golden section search. The default value is 40. The golden section search stop once this value is reached or if the tolerance is achieved, and return the middle of the interval.

K_name

name of the kernel. Can be 'gaussian', 'epanechnikov', or 'biweight'. The default value is 'gaussian'.

binning

default value is FALSE, that is the function computes the exact PCO criterion. If set to TRUE allows to use binning.

nb

is the number of bins to use when binning is TRUE. For multivariate x_i, nb corresponds to the number of bins per dimension. The default value is 32.

tol

is the maximum authorized length of the interval which contains the optimal h for univariate data. For multivariate data, it corresponds to the length of each hypercube axe. The golden section search stop once this value is achieved or when nh is reached and return the middle of the interval. Its default value is 10^(-6).

adapt_nb_bin

is a boolean used for univariate x_i. If set to TRUE, authorises the function to increase the number of bins if, with nb bins, the middle of the initial interval is not an admissible solution, that is if the criterion at the middle is greater than the mean of the criterion at the bounds of the initial interval of search.

nb_bin_vect

can be set to have a different number of bins on each dimension

Value

a scalar for univariate data or a matrix for multivariate data corresponding to the optimal bandwidth according to the PCO criterion

References

Varet, S., Lacour, C., Massart, P., Rivoirard, V., (2019). Numerical performance of Penalized Comparison to Overfitting for multivariate kernel density estimation. hal-02002275. https://hal.archives-ouvertes.fr/hal-02002275

See Also

[stats::nrd0()], [stats::nrd()], [stats::ucv()], [stats::bcv()] and [stats::SJ()] for other univariate bandwidth selection and [stats::density()] to compute the associated density estimation.

[ks::Hlscv()], [ks::Hbcv()], [ks::ns()] for other multivariate bandwidth selection.

Examples


# an example with simulated univariate data

# load univariate data
data("gauss_1D_sample")

# computes the optimal bandwith for the sample x_i with all parameters set to their default value 
bw.L2PCO(gauss_1D_sample)


# an example with simulated multivariate data

# load multivariate data
data("gauss_mD_sample")

# computes the optimal bandwith for the sample x_i with all parameters set to their default value 
# generates a warning since the tolerance value is not reached
bw.L2PCO(gauss_mD_sample)

# To avoid this warning, it is possible to increase the parameter nh
bw.L2PCO(gauss_mD_sample, nh = 80)




[Package PCObw version 0.0.1 Index]