nptgauss: Truncated Second-order Gaussian Kernels

View source: R/util.R

nptgaussR Documentation

Truncated Second-order Gaussian Kernels

Description

nptgauss provides an interface for setting the truncation radius of the truncated second-order Gaussian kernel used by np.

Usage

nptgauss(b)

Arguments

b

Truncation radius of the kernel.

Details

nptgauss allows one to set the truncation radius of the truncated Gaussian kernel used by np, which defaults to 3. It automatically computes the constants describing the truncated gaussian kernel for the user.

We define the truncated gaussion kernel on the interval [-b,b] as:

K = \frac{\alpha}{\sqrt{2\pi}}\left(e^{-z^2/2} - e^{-b^2/2}\right)

The constant \alpha is computed as:

\alpha = \left[\int_{-b}^{b} \frac{1}{\sqrt{2\pi}}\left(e^{-z^2/2} - e^{-b^2/2}\right)\right]^{-1}

Given these definitions, the derivative kernel is simply:

K' = (-z)\frac{\alpha}{\sqrt{2\pi}}e^{-z^2/2}

The CDF kernel is:

G = \frac{\alpha}{2}\mathrm{erf}(z/\sqrt{2}) + \frac{1}{2} - c_0z

The convolution kernel on [-2b,0] has the general form:

H_- = a_0\,\mathrm{erf}(z/2 + b) e^{-z^2/4} + a_1z + a_2\,\mathrm{erf}((z+b)/\sqrt{2}) - c_0

and on [0,2b] it is:

H_+ = -a_0\,\mathrm{erf}(z/2 - b) e^{-z^2/4} - a_1z - a_2\,\mathrm{erf}((z-b)/\sqrt{2}) - c_0

where a_0 is determined by the normalisation condition on H, a_2 is determined by considering the value of the kernel at z = 0 and a_1 is determined by the requirement that H = 0 at [-2b,2b].

Author(s)

Tristen Hayfield tristen.hayfield@gmail.com, Jeffrey S. Racine racinej@mcmaster.ca

Examples

## The default kernel, a gaussian truncated at +- 3
nptgauss(b = 3.0)


np documentation built on March 31, 2023, 9:41 p.m.