silverman | R Documentation |
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.
silverman(returns)
returns |
A numeric matrix of asset returns with |
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()
A numeric value representing the computed bandwidth parameter based on Silverman's rule.
# 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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.