Learn R Programming

TVMVP (version 1.0.5)

epanechnikov_kernel: Epanechnikov Kernel Function

Description

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.

Usage

epanechnikov_kernel(u)

Value

A numeric vector of kernel values corresponding to each input u.

Arguments

u

A numeric vector of points at which the kernel is evaluated.

Details

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.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab