Title: | Selecting Bandwidth for Kernel Density Estimator with Minimum Distance Method |
---|---|
Description: | Selects bandwidth for the kernel density estimator with minimum distance method as proposed by Devroye and Lugosi (1996). The minimum distance method directly selects the optimal kernel density estimator from countably infinite kernel density estimators and indirectly selects the optimal bandwidth. This package selects the optimal bandwidth from finite kernel density estimators. |
Authors: | Genzo Kaga |
Maintainer: | Genzo Kaga <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 1.0.4 |
Built: | 2024-12-16 06:48:57 UTC |
Source: | CRAN |
Get 0-1 vector which is used for calculating empirical measure
counter(e2, box2)
counter(e2, box2)
e2 |
integer |
box2 |
matrix which has 0-1 elements related to Scheffe set |
0-1 vector
Calculating delta
deltaboxm(ij, box, box2, mu_box2, grid)
deltaboxm(ij, box, box2, mu_box2, grid)
ij |
number order vector |
box |
matrix which has estimated values of all kernel density estimators |
box2 |
matrix which has 0-1 elements related to Scheffe set |
mu_box2 |
matrix which has values of all empirical measures |
grid |
length of grid in domain |
delta value
Get number order matrix which is used in md
dmm(i, prod2)
dmm(i, prod2)
i |
integer |
prod2 |
integer which is defined in md |
matrix related to number order
Calculating estimated density value on some x with bandwidth h
fhat(x, h, data)
fhat(x, h, data)
x |
scalar |
h |
bandwidth |
data |
data sample |
estimated density value
fhat(0,0.2,rnorm(100))
fhat(0,0.2,rnorm(100))
Get estimated values of kernel density estimator on domain
fhatboxm(ij, data_for_d, h, x)
fhatboxm(ij, data_for_d, h, x)
ij |
number order vector |
data_for_d |
data sample which is split to be used for kernel density estimator |
h |
bandwidth |
x |
scalar |
estimated values of kernel density estimator on domain
md selects bandwidth for kernel density estimator with minimum distance method. Minimum distance method directly selects optimal kernel density estimator in countably infinite kernel density estimators and indirectly selects optimal bandwidth. md selects optimal bandwidth in countably finite kernel density estimators.
md(data,hnumber,ds)
md(data,hnumber,ds)
data |
data sample |
hnumber |
the number of bandwidth which md can select. 60 is enough. Of course, you can take it more. |
ds |
rate of data split. Minimum distance method has to split data for constructing kernel density estimators and empirical measures. |
bandwidth
# select bandwidth md(runif(100),20,0.6) # select bandwidth and plot data <- rnorm(100) bandwidth <- md(data,20,0.6) x <- seq(min(data),max(data),length=100) plot(x,sapply(x,fhat,bandwidth,data),type="l",ylab="density")
# select bandwidth md(runif(100),20,0.6) # select bandwidth and plot data <- rnorm(100) bandwidth <- md(data,20,0.6) x <- seq(min(data),max(data),length=100) plot(x,sapply(x,fhat,bandwidth,data),type="l",ylab="density")
Get number order matrix which is used in md
nom(i, length)
nom(i, length)
i |
integer |
length |
the number of grids in domain |
matrix related to number order
Calculating Scheffe sets
scheffe(ij, box)
scheffe(ij, box)
ij |
number order vector |
box |
estimated values of all kernel density estimators |
0-1 vector
Auxiliary function which is used in md
subcounter(l, data, x)
subcounter(l, data, x)
l |
integer |
data |
data sample |
x |
scalar |
integer
Get number order vector which is used in md
xmm(j)
xmm(j)
j |
integer |
vector related to number order
Get number order matrix which is used in md
xym(i, length)
xym(i, length)
i |
integer |
length |
the number of grids in domain |
matrix related to number order