Learn R Programming

RDM (version 0.1.1)

computeBandwidth: Compute bandwidth via cross-validation

Description

An implementation of the cross-validation principle for the bandwidth selection as presented in Strothmann, Dette and Siburg (2022) <arXiv:2201.03329>.

Usage

computeBandwidth(X, sL, sU, method = c("cvsym", "cvasym"), reduce = TRUE)

Value

The chosen bandwidth depending on the data.frame X.

Arguments

X

A bivariate data.frame containing the observations. Each row contains one observation.

sL

Lower bound \(N^{sL}\) for the possible bandwidth parameters (where \(N\) is the number of observations).

sU

Upper bound \(N^{sU}\) for the possible bandwidth parameters (where \(N\) is the number of observations).

method

"cvsym" uses either a symmetric cross-validation principle (N_1 = N_2) and "cvasym" uses an asymmetric cross-validation principle (i.e. \(N_1\) and \(N_2\) may attain different values).

reduce

In case reduce is set to TRUE, the parameter is chosen from N, N+2, ... instead of N, N+1, N+2, ...

Details

This function computes the optimal bandwidth given the bivariate observations \(X\) of length \(N\). Currently, there are two different algorithms implemented:

  • "cvsym" - Computes the optimal bandwidth choice for a square checkerboard mass density according to the cross-validation principle. The bandwidth is a natural number between \(N^{sL}, ..., N^{sU}\)

  • "cvasym" - Computes the optimal bandwidth choice \((N_1, N_2)\) for a non-square checkerboard mass density according to the cross-validation principle. The bandwidths \(N_1, N_2\) are natural numbers between \(N^{sL}, ..., N^{sU}\) and may possibly attain different values.

Examples

Run this code
n <- 20
X <- cbind(runif(n), runif(n))
computeBandwidth(X, sL = 0.25, sU = 0.5, method="cvsym", reduce=TRUE)

Run the code above in your browser using DataLab