kade function

Kernel Adaptive Density Estimator

Kernel Adaptive Density Estimator

Wrapper function which does some preparatory calculations and then calls the actual ``workhorse'' functions which do the main computations for kernel adaptive density estimation of Srihera & Stute (2011) or Eichner & Stute (2013). Finally, it structures and returns the obtained results. Summarizing information and technical details can be found in Eichner (2017).

kade(x, data, kernel = c("gaussian", "epanechnikov", "rectangular"), method = c("both", "ranktrafo", "nonrobust"), Sigma = seq(0.01, 10, length = 51), h = NULL, theta = NULL, ranktrafo = J2, ticker = FALSE, plot = FALSE, parlist = NULL, ...)

Arguments

  • x: Vector of location(s) at which the density estimate is to be computed.
  • data: Vector (X1,,Xn)(X_1, \ldots, X_n) of the data from which the estimate is to be computed. NAs or infinite values are removed (and a warning is issued).
  • kernel: A character string naming the kernel to be used for the adaptive estimator. This must partially match one of "gaussian", "rectangular" or "epanechnikov", with default "gaussian", and may be abbreviated to a unique prefix. (Currently, this kernel is also used for the initial, non-adaptive Parzen-Rosenblatt estimator which enters into the estimators of bias and variance as described in the references.)
  • method: A character string naming the method to be used for the adaptive estimator. This must partially match one of "both", "ranktrafo" or "nonrobust", with default "both", and may be abbreviated to a unique prefix.
  • Sigma: Vector of value(s) of the scale parameter σ\sigma. If of length 1 no adaptation is performed. Otherwise considered as the initial grid over which the optimization of the adaptive method will be performed. Defaults to seq(0.01, 10, length = 51).
  • h: Numeric scalar for bandwidth hh. Defaults to NULL and is then internally set to n1/5n^{-1/5}.
  • theta: Numeric scalar for value of location parameter θ\theta. Defaults to NULL and is then internally set to the arithmetic mean of x1,,xnx_1, \ldots, x_n.
  • ranktrafo: Function used for the rank transformation. Defaults to J2 (with its default cc = sqrt(5)).
  • ticker: Logical; determines if a 'ticker' documents the iteration progress through Sigma. Defaults to FALSE.
  • plot: Logical or character or numeric and indicates if graphical output should be produced. Defaults to FALSE (i.e., no graphical output is produced) and is passed to adaptive_fnhat() which does the actual work. For details on how it is processed see there.
  • parlist: A list of graphical parameters that is passed to adaptive_fnhat(); see there. Default: NULL.
  • ``: Further arguments possibly passed down. Currently ignored.

Returns

In the case of only one method a data frame whose components have the following names and meanings:

xx_0 .
yEstimate of f(x_0).
sigma.adapThe found minimizer of the MSE-estimator, i.e., the adaptive smoothing parameter value.
msehat.minThe found minimum of the MSE-estimator.
discr.min.smallerTRUE iff the numerically found minimum was smaller than the discrete one.
sig.range.adjNumber of adjustments of sigma-range.

In the case of both methods a list of two data frames of the just described structure.

Examples

require(stats) # Generating N(0,1)-data set.seed(2017); n <- 80; d <- rnorm(n) # Estimating f(x0) for one sigma-value x0 <- 1 (fit <- kade(x = x0, data = d, method = "nonrobust", Sigma = 1)) # Estimating f(x0) for sigma-grid x0 <- 1 (fit <- kade(x = x0, data = d, method = "nonrobust", Sigma = seq(0.01, 10, length = 10), ticker = TRUE)) ## Not run: # Estimating f(x0) for sigma-grid and Old-Faithful-eruptions-data x0 <- 2 (fit <- kade(x = x0, data = faithful$eruptions, method = "nonrobust", Sigma = seq(0.01, 10, length = 51), ticker = TRUE, plot = TRUE)) ## End(Not run)

References

Srihera & Stute (2011), Eichner & Stute (2013), and Eichner (2017): see kader.

  • Maintainer: Gerrit Eichner
  • License: GPL-3
  • Last published: 2017-10-04