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).
x: Vector of location(s) at which the density estimate is to be computed.
data: Vector (X1,…,Xn) 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 σ. 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 h. Defaults to NULL and is then internally set to n−1/5.
theta: Numeric scalar for value of location parameter θ. Defaults to NULL and is then internally set to the arithmetic mean of x1,…,xn.
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:
x
x_0 .
y
Estimate of f(x_0).
sigma.adap
The found minimizer of the MSE-estimator, i.e., the adaptive smoothing parameter value.
msehat.min
The found minimum of the MSE-estimator.
discr.min.smaller
TRUE iff the numerically found minimum was smaller than the discrete one.
sig.range.adj
Number 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)-dataset.seed(2017); n <-80; d <- rnorm(n)# Estimating f(x0) for one sigma-valuex0 <-1(fit <- kade(x = x0, data = d, method ="nonrobust", Sigma =1))# Estimating f(x0) for sigma-gridx0 <-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-datax0 <-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.