Learn R Programming

rbbnp (version 0.3.0)

silverman_bandwidth: Silverman's Rule of Thumb for Bandwidth Selection

Description

Implements Silverman's rule of thumb for selecting an optimal bandwidth in kernel density estimation.

Usage

silverman_bandwidth(X, kernel_type = "normal")

Value

A scalar representing the optimal bandwidth.

Arguments

X

A numerical vector of sample data.

kernel_type

A string identifying the kernel type.

Examples

Run this code
# Generate sample data
X <- rnorm(100)
# Get optimal bandwidth using Silverman's rule
h_opt <- silverman_bandwidth(X, kernel_type = "normal")

Run the code above in your browser using DataLab