| nptgauss | R Documentation |
nptgauss provides an interface for setting the truncation
radius of the truncated second-order Gaussian kernel used
by np.
nptgauss(b)
b |
Truncation radius of the kernel. |
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].
Tristen Hayfield tristen.hayfield@gmail.com, Jeffrey S. Racine racinej@mcmaster.ca
## The default kernel, a gaussian truncated at +- 3
nptgauss(b = 3.0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.