I am working with a truncated normal as posterior distribution in a Bayesian estimation problem. Precisely, it is a normal distribution truncated at 0 from below.

When calculating the parameters of the posterior distribution, I sometimes end up with a negative mean parameter $\mu = -8.0 $ and a variance of $\sigma^2 = 0.2$.

However, I try to sample from a truncated normal with these parameters. Is it even possible to obtain a sample within $[0,\infty)$ using these parameters? According to my understanding that would require at least $18\sigma$ to compensate the negative mean of $-8.0$.

I assume something is wrong in the calculation of the mean of the posterior distribution here, since - for me - it doesn't seem reasonable to have a negative (theoretical) mean for a distribution which is truncated at 0 from below. Am I right here or is it possible to overcome the negativity caused by the mean?

  • $\begingroup$ I'm rather trying to sample from $x \sim N(-8.0;0.2)1_{x\geq0}$. But I guess your reasoning still holds? $\endgroup$
    – mscnvrsy
    Aug 1, 2016 at 12:21
  • $\begingroup$ related: stats.stackexchange.com/a/317438/5536 $\endgroup$
    – becko
    Feb 14, 2018 at 13:08

1 Answer 1


$\mu$ parameter from truncated normal distribution describes it's mean before the truncation. The mean of the truncated normal distribution is

$$ \operatorname{E}(X \mid a<X<b) = \mu + \sigma\frac{\phi(\frac{a-\mu}{\sigma})-\phi(\frac{b-\mu}{\sigma})}{\Phi(\frac{b-\mu}{\sigma})-\Phi(\frac{a-\mu}{\sigma})} $$

where $a$ and $b$ are lower and upper truncation points. This mean is always between $a$ and $b$.

You are right that sampling from truncated normal distribution with parameters $\mu=-8$, $\sigma=0.2$, $a=0$, $b=\infty$ using non-specialized algorithm would be very inefficient (possibly you'd have problems with numbers falling below numerical precision), however since non-truncated normal distribution ranges from $-\infty$ to $\infty$, you can pick any truncation points such that $a < b$. Hopefully we have specialized algorithms that deal with such cases as the one described by Christian Robert (mentioned in a comment below).

  • 2
    $\begingroup$ To complement Tim's (+1) answer, there exist very efficient ways to simulate a truncated Normal. One is by cdf inversion, the most standard approach to simulation, and another one by accept-reject. I wrote a paper on this method for truncated Normals a while ago. $\endgroup$
    – Xi'an
    Aug 1, 2016 at 17:44
  • $\begingroup$ @Xi'an but, from this example, it seems that for cases like this it is more efficient to used inverse CDF rather than the accept-reject algorithm. $\endgroup$
    – Tim
    Aug 1, 2016 at 18:50

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.