silverman: Compute Bandwidth Parameter Using Silverman's Rule of Thumb

View source: R/bandwidth.R

silvermanR Documentation

Compute Bandwidth Parameter Using Silverman's Rule of Thumb

Description

This function calculates the bandwidth parameter for kernel functions using Silverman's rule of thumb, which is commonly used in kernel density estimation to determine an appropriate bandwidth. The procedure is available either as a stand-alone function or as a method in the 'TVMVP' R6 class.

Usage

silverman(returns)

Arguments

returns

A numeric matrix of asset returns with T rows (time periods) and p columns (assets).

Details

Silverman's rule of thumb for bandwidth selection is given by:

bandwidth = \frac{2.35}{\sqrt{12}} \times T^{-0.2} \times p^{-0.1}

where T is the number of time periods and p is the number of assets.

Two usage styles:

# Function interface
bw <- silverman(returns)

# R6 method interface
tv <- TVMVP$new()
tv$set_data(returns)
tv$silverman()

Value

A numeric value representing the computed bandwidth parameter based on Silverman's rule.

Examples

# Simulate data for 50 assets over 200 time periods
set.seed(123)
T <- 200
p <- 50
returns <- matrix(rnorm(T * p, mean = 0.001, sd = 0.02), ncol = p)

# Compute bandwidth using Silverman's rule of thumb
bw <- silverman(returns)
print(bw)

tv <- TVMVP$new()
tv$set_data(returns)
tv$silverman()


TVMVP documentation built on June 28, 2025, 1:08 a.m.