Interpretation of Gaussian Kernel

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 4K views
wil3
Messages
177
Reaction score
1
Hello. In a software application I am attempting to smooth a data set by convoluting it with a discrete Gaussian kernel. Based upon information garnered online, I've been using this Mathematica command to generate the kernel:

kern = Table[Exp[-k^2/100]/Sqrt[2. Pi], {k, -range, range}];

where range is a user-specified parameter. For non-Mathematica speakers, my kernel is:
[tex] \dfrac{e^{-k^2/100}}{\sqrt{2 \pi}}<br /> \qquad<br /> \forall \; k \; \in \{-\text{range}, \text{range}\}; k \in \mathbb{Z}[/tex]

What is the correct relation of the parameter "range" in this kernel to the standard deviation of a continuous Gaussian function? I'm aware that a large range correlates to a larger standard deviation Gaussian over which the data is sampled, but I would like to know the precise relation. I can't seem to figure it out because the Gaussian and the discrete kernel seem to have slightly different forms.

Application: I have spectroscopic data, and I have been finding that certain "range" values yield the best-fit smoothing. I am curious whether this is related to the standard deviations of the continuous Gaussian functions that comprise the spectra that I am smoothing.

Thanks very much.
 
Last edited:
Physics news on Phys.org
The truly correct value of range, to give perfect Gaussian smoothing, is infinite. In practice, of course, that's inconvenient, and you have to decide how much accuracy you're willing to sacrifice by lopping off the tails. I imagine that in practice 3 standard deviations would be reasonable. (But be careful about normalization.)
 
It seems to me that the value of range has a noticeable effect on the shape of a smoothed curve... are you certain about that? Because I think that oversmoothing definitely is possible.

But thanks for taking a crack at it. I guess I'm being a little particular
 
wil3 said:
It seems to me that the value of range has a noticeable effect on the shape of a smoothed curve... are you certain about that? Because I think that oversmoothing definitely is possible.

But thanks for taking a crack at it. I guess I'm being a little particular
Yes, of course the value of range has an effect. I must not have been clear, if you thought I said it didn't have an effect.

Oversmoothing is of course possible. The main way you control that is by controlling the width (i.e., SD) of the Gaussian. That, in your example, is [itex]\sqrt{100/2}[/itex]. When you change the width of the Gaussian, range should be changed in proportion.
 
Ahh, I understand now. I was thinking that the Standard deviation must be around 7, so that is good to hear. I had originally thought that [tex]\sqrt{50}[/tex] must be it, but I guess I got confused because Mathematica is giving me very different graphs as I increase "range" without bound, making me think that something else is affecting the convolution.

Anyway, sorry for the misunderstanding. Thanks very much for your help.