bw_select_cv_bivariate {lg}R Documentation

Cross-validation for bivariate distributions

Description

Uses cross-validation to find the optimal bandwidth for a bivariate locally Gaussian fit

Usage

bw_select_cv_bivariate(x, tol = 10^(-3), est_method = "1par",
  bw_marginal = NULL)

Arguments

x

The matrix of data points.

tol

The absolute tolerance in the optimization, used by the optim-function.

est_method

The estimation method for the bivariate fit. If estimation method is 5par_marginals_fixed, the marginal bandwidths must be supplied as well through the argument bw_marginal. This is automatically handled by the lg_main wrapper function.

bw_marginal

The bandwidths for estimation of the marginals if method 5par_fixed_marginals is used.

Details

This function provides an implementation for the Cross Validation algorithm for bandwidth selection described in Otneim & Tjøstheim (2017), Section 4. Let \hat{f}_h(x) be the bivariate locally Gaussian density estimate obtained using the bandwidth h, then this function returns the bandwidth that maximizes

CV(h) = n^{-1} \sum_{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.

Value

The function returns a list with two elements: bw is the selected bandwidths, and convergence is the convergence flag returned by the optim-function.

References

Otneim, Håkon, and Dag Tjøstheim. "The locally gaussian density estimator for multivariate data." Statistics and Computing 27, no. 6 (2017): 1595-1616.

Examples

  ## Not run: 
    x <- cbind(rnorm(100), rnorm(100))
    bw <- bw_select_cv_univariate(x)
  
## End(Not run)


[Package lg version 0.4.1 Index]