View source: R/kernel_functions.R
epanechnikov_kernel | R Documentation |
This function computes the value of the Epanechnikov kernel for a given input u
.
The Epanechnikov kernel is a popular choice in kernel density estimation due to its optimal
properties in minimizing mean integrated squared error.
epanechnikov_kernel(u)
u |
A numeric vector of points at which the kernel is evaluated. |
The Epanechnikov kernel is defined as:
K(u) = \begin{cases}
\frac{3}{4}(1 - u^2) & \text{if } |u| \leq 1, \\
0 & \text{otherwise}.
\end{cases}
This function applies the above formula to each element of the input vector u
.
A numeric vector of kernel values corresponding to each input u
.
# Define a range of u values
u_values <- seq(-1.5, 1.5, by = 0.1)
# Compute Epanechnikov kernel values
kernel_values <- epanechnikov_kernel(u_values)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.