kfn_vectorized {kader}R Documentation

Convolution of Kernel Function K with fn

Description

Vectorized evaluation of the convolution of the kernel function K with fn.

Usage

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.

Details

Vectorized (in u) evaluation of - a more explicit representation of - the integrand K(u) * f_n(\ldots - h^2/\sigma * 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).

Value

A vector of (K * f_n)(u) evaluated at the values in u.

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 method
AiBj <- outer(Ai, Bj/sig, "+")

ugrid <- seq(-10, 10, by = 1)
kader:::kfn_vectorized(u = ugrid, K = dnorm, xixj = AiBj, h = h, sig = sig)


[Package kader version 0.0.8 Index]