Description Usage Arguments Details Value References Examples
View source: R/bandwidth_selection.R
Uses cross-validation to find the optimal bandwidth for a trivariate locally Gaussian fit
1 | bw_select_cv_trivariate(x, tol = 10^(-3))
|
x |
The matrix of data points. |
tol |
The absolute tolerance in the optimization, used by the
|
This function provides an implementation for the Cross Validation algorithm for bandwidth selection described in Otneim & Tjøstheim (2017), Section 4, but for trivariate distributions. Let \hat{f}_h(x) be the trivariate locally Gaussian density estimate obtained using the bandwidth h, then this function returns the bandwidth that maximizes
CV(h) = n^{-1} ∑_{i=1}^n \log \hat{f}_h^{(-i)}(x_i),
where \hat{f}_h^{(-i)} is the density estimate calculated without observation x_i.
The recommended use of this function is through the lg_main
wrapper
function.
The function returns a list with two elements: bw
is the
selected bandwidths, and convergence
is the convergence flag returned
by the optim
-function.
Otneim, Håkon, and Dag Tjøstheim. "The locally gaussian density estimator for multivariate data." Statistics and Computing 27, no. 6 (2017): 1595-1616.
1 2 3 4 5 | ## Not run:
x <- cbind(rnorm(100), rnorm(100), rnorm(100))
bw <- bw_select_cv_trivariate(x)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.