Vectorized evaluation of the convolution of the kernel function K with fn.
kfn_vectorized(u, K, xixj, h, sig)
Arguments
u: Numeric vector.
K: Kernel function with vectorized in- & output.
xixj: Numeric matrix.
h: Numeric scalar.
sig: Numeric scalar.
Returns
A vector of (K∗fn)(u) evaluated at the values in u.
Details
Vectorized (in u) evaluation of - a more explicit representation of - the integrand K(u)∗fn(…−h2/σ∗u) which is used in the computation of the bias estimator before eq. (2.3) in Srihera & Stute (2011). Also used for the analogous computation of the respective bias estimator in the paragraph after eq. (6) in Eichner & Stute (2013).
Note
An alternative implementation could be K(u) * sapply(h/sig * u, function(v) mean(K(xixj - v))) / h
Examples
require(stats)set.seed(2017); n <-100; Xdata <- rnorm(n)x0 <-1; sig <-1; h <- n^(-1/5)Ai <-(x0 - Xdata)/h
Bj <- mean(Xdata)- Xdata # in case of non-robust methodAiBj <- outer(Ai, Bj/sig,"+")ugrid <- seq(-10,10, by =1)kader:::kfn_vectorized(u = ugrid, K = dnorm, xixj = AiBj, h = h, sig = sig)