I need to bound a 1D gaussian/normal (or similar) probability density function in the domain interval $[-3\sigma, 3\sigma]$ in a way that still integrates to 1. I would need something like this:

$$ p(x) = \begin{cases} N(x;\mu, \sigma) &\text{if } -3\sigma \leq x \leq 3\sigma\\ 0 & \text{otherwise } \end{cases} $$

This is NOT a probability density function but how could I get a bounded distribution that is similar to the gaussian case?

Thanks in advance,


  • 5
    $\begingroup$ All you have to do is to divide $p(x)$ over by $\int_{-3 \sigma}^{3 \sigma} p(x) \mathrm{d} x$. $\endgroup$ – Sasha Sep 5 '11 at 13:51
  • $\begingroup$ Agree with Shasha. Unless you want to demand that your function should vanish smoothly, then you'll need something else... $\endgroup$ – valdo Sep 5 '11 at 13:59
  • $\begingroup$ Thanks Sasha and valdo. What I actually need is that it vanished smoothly; I haven't commented on it in the question... $\endgroup$ – Federico Sep 5 '11 at 14:09
  • $\begingroup$ Do you know about bump functions? $\endgroup$ – cardinal Sep 5 '11 at 14:44
  • $\begingroup$ If you just want something that looks similar, have you considered a scaled and centered beta distribution? $\endgroup$ – guy Nov 4 '11 at 23:09

It seems you are not clear about what you want. To truncate any variable to a given range, you just restrict its density to that range, and divide by its integral so that integrates to 1. But if you want to generate a random variable that just "looks like" a gaussian, but has support on an interval, and its density is smooth, you can sum three (or more) uniforms. For example, if you sum three uniforms in $[-1,1]$, the result is a random variable that has support in $[-3,3]$, and its variance is $1$; you can multiply the result by $\sigma$ to get a suport $[-3 \sigma,3 \sigma]$ and standard deviation $\sigma$. The density is piecewise quadratic, it's continuous and derivable (though not infinitely differentiable, of course).


I don't think bump functions will help, because the Gaussian does not have compact support. I am not quite sure what you really need. If it still integrates to one, why is it not a probability density? Why not make a simple transformation of coordinates? This will still integrate to one, should be sufficiently smooth: $f(x)=\exp\left(\frac{-\tan\left(\frac{\pi}{2}\frac{x}{3\sigma}\right)^2}{2}\right)\mathbb{1}_{(x<3\sigma)}(x)$

  • 1
    $\begingroup$ The point of my comment was to consider transforming the Gaussian into a bump function by using the appropriate mapping from $(-\infty, \infty)$ to $(-3\sigma, 3\sigma)$. $\endgroup$ – cardinal Sep 5 '11 at 18:32
  • 2
    $\begingroup$ @cardinal Another natural approach is to mollify the truncated distribution. This means define a "bump function" $\psi$ supported on $[-3\sigma, 3\sigma]$, equal to $1$ on $[-3\sigma+\varepsilon, 3\sigma-\varepsilon']$ for arbitrarily small positive $\varepsilon$, $\varepsilon'$. Normalizing the function $x \to \psi(x) \exp(-(x/\sigma)^2/2)$ does the trick. $\endgroup$ – whuber Sep 6 '11 at 16:39
  • $\begingroup$ @whuber, yes, I like that approach, too. $\endgroup$ – cardinal Sep 6 '11 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.