Learn R Programming

IVDML (version 1.0.1)

bandwidth_normal: Compute Bandwidth Using the Normal Reference Rule

Description

This function calculates the bandwidth for kernel smoothing using the Normal Reference Rule. The rule is based on Silverman's rule of thumb, which selects the bandwidth as a function of the standard deviation and interquartile range (IQR) of the data. The bandwidth is computed as: \(h = 1.06 \times \min(\mathrm{sd}(A), \mathrm{IQR}(A) / 1.34) / N^{0.2}\), where \(\mathrm{sd}(A)\) is the standard deviation of A, \(\mathrm{IQR}(A)\) is the interquartile range and N is the length of A.

Usage

bandwidth_normal(A)

Value

A numeric value representing the computed bandwidth.

Arguments

A

Numeric vector. The data for which the bandwidth is to be computed.

References

Silverman, B. W. (1986). Density Estimation for Statistics and Data Analysis. Chapman & Hall/CRC monographs on statistics and applied probability. Chapman & Hall.

Examples

Run this code
set.seed(1)
A <- rnorm(100)
bandwidth_normal(A)

Run the code above in your browser using DataLab