kade {kader} | R Documentation |
Kernel Adaptive Density Estimator
Description
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).
Usage
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 |
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 |
h |
Numeric scalar for bandwidth |
theta |
Numeric scalar for value of location parameter |
ranktrafo |
Function used for the rank transformation. Defaults to
|
ticker |
Logical; determines if a 'ticker' documents the iteration
progress through |
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
|
parlist |
A list of graphical parameters that is passed to
|
... |
Further arguments possibly passed down. Currently ignored. |
Value
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.
References
Srihera & Stute (2011), Eichner & Stute (2013), and Eichner
(2017): see kader
.
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)