bw_select: Bandwidth selection for local Gaussian correlation.

Description Usage Arguments Details Value References Examples

View source: R/bandwidth_selection.R

Description

Takes a matrix of data points and returns the bandwidths used for estimating the local Gaussian correlations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
bw_select(
  x,
  bw_method = "plugin",
  est_method = "1par",
  plugin_constant_marginal = 1.75,
  plugin_exponent_marginal = -1/5,
  plugin_constant_joint = 1.75,
  plugin_exponent_joint = -1/6,
  tol_marginal = 10^(-3),
  tol_joint = 10^(-3)
)

Arguments

x

A matrix or data frame with data, one column per variable, one row per observation.

bw_method

The method used for bandwidth selection. Must be either "cv" (cross-validation, slow, but accurate) or "plugin" (fast, but crude).

est_method

The estimation method, must be either "1par", "5par" or "5par_marginals_fixed", see lg_main.

plugin_constant_marginal

The constant c in cn^a used for finding the plugin bandwidth for locally Gaussian marginal density estimates, which we need if estimation method is "5par_marginals_fixed".

plugin_exponent_marginal

The constant a in cn^a used for finding the plugin bandwidth for locally Gaussian marginal density estimates, which we need if estimation method is "5par_marginals_fixed".

plugin_constant_joint

The constant c in cn^a used for finding the plugin bandwidth for estimating the pairwise local Gaussian correlation between two variables.

plugin_exponent_joint

The constant a in cn^a used for finding the plugin bandwidth for estimating the pairwise local Gaussian correlation between two variables.

tol_marginal

The absolute tolerance in the optimization for finding the marginal bandwidths when using cross validation.

tol_joint

The absolute tolerance in the optimization for finding the joint bandwidths when using cross-validation.

Details

This is the main bandwidth selection function within the framework of locally Gaussian distributions as described in Otneim and Tjøstheim (2017). This function takes in a data set of arbitrary dimension, and calculates the bandwidths needed to find the pairwise local Gaussian correlations, and is mainly used by the main lg_main wrapper function.

Value

A list with three elements, marginal contains the bandwidths used for the marginal locally Gaussian estimation, marginal_convergence contains the convergence flags for the marginal bandwidths, as returned by the optim function, and joint contains the pairwise bandwidths and convergence flags.

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

1
2
  x <- cbind(rnorm(100), rnorm(100), rnorm(100))
  bw <- bw_select(x)

hotneim/lg documentation built on May 9, 2020, 7:35 a.m.