# Interpretation of Gaussian Kernel

1. Jul 6, 2011

### wil3

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:
$$\dfrac{e^{-k^2/100}}{\sqrt{2 \pi}} \qquad \forall \; k \; \in \{-\text{range}, \text{range}\}; k \in \mathbb{Z}$$

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: Jul 6, 2011
2. Jul 6, 2011

### pmsrw3

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.)

3. Jul 6, 2011

### wil3

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

4. Jul 6, 2011

### pmsrw3

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 $\sqrt{100/2}$. When you change the width of the Gaussian, range should be changed in proportion.

5. Jul 6, 2011

### wil3

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 $$\sqrt{50}$$ 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.