cv_bandwidth | R Documentation |
Cross-Validation function for bandwidth parameter selection of discrete kernel
cv_bandwidth(
kernel = c("optimal", "triang", "epanech", "binomial"),
v,
h,
k = NULL
)
kernel |
the type of kernel. Currently supported kernels are limited to: "optimal", "triang", "epanech" and "binomial" |
v |
the vector of observations |
h |
the list of bandwidth parameters to test in cross validation |
k |
Optional: the integer (positive) parameter that defined the support of the kernel function (corresponds to parameter 'a' for triangular kernel). It is only used for optimal and triangular kernel |
the optimal bandwidth value
n <- 250
mu <- 2 # Mean
y <- sort(rpois(n, mu))
# kernel support parameter
k <- 1
H <- seq((max(y) - min(y)) / 200, (max(y) - min(y)) / 2, length.out = 50)
hcv <- cv_bandwidth(kernel = "optimal", y, h = H, k = k)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.