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 = alpha/sqrt(2*pi)*exp(-b^2/2)*(exp(-z^2/2) - exp(-b^2/2))
The constant α is computed as:
1/integrate(1/sqrt(2*pi)*exp(-b^2/2)*(exp(-z^2/2) - exp(-b^2/2)), -b, b)
Given these definitions, the derivative kernel is simply:
-z*alpha/(sqrt(2*pi))*exp(-z^2/2)
The CDF kernel is:
alpha/2*erf(z/sqrt(2))+0.5-c0*z
The convolution kernel on [-2b,0] has the general form:
a0*erf(z/2 + b)*exp(-0.25*z^2) + a1*z + a2*erf((z+b)/sqrt(2)) - c0
and on [0,2b] it is:
-a0*erf(z/2 - b)*exp(-0.25*z^2) - a1*z - a2*erf((z-b)/sqrt(2)) - c0
where a0 is determined by the normalisation condition on H, a2 is determined by considering the value of the kernel at z = 0 and a1 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.