# How to sample from a rectified Gaussian distribution?

Is the rectified Gaussian distribution in the following case the same as the truncated Gaussian distribution within the interval $[0,\infty)$?

Here is the link to the paper. In this paper, they call the product of the normal and the exponential a rectified distribution. The problem is, that I don’t understand how they sample from this distribution within a Gibbs sampling procedure. So far I found out, that they used the following algebraic identity to simplify the product as follows

\begin{align} \mathcal{R}(x|\mu,\sigma,\alpha) &\propto K\exp\left(-\frac{\left(x-\mu\right)^2}{2\sigma^2}\right)\exp\left(-\alpha x\right) \qquad \text{with}\qquad x\geq0 \\ -\left[\frac{\left(x-\mu\right)^2}{2\sigma^2}+\alpha x\right] &= -\left[\frac{\left(x-\left(\mu-\sigma^2\alpha\right)\right)^2}{2\sigma^2}-\frac{1}{2}\sigma^2\alpha^2+\mu\alpha\right] \end{align}

the last two terms are dropped out since they can be regarded as a proportionality constant. The result is a normal distribution truncated on the interval $[0,\infty]$

$$\mathcal{R}(x|\mu,\sigma,\alpha)\propto K\exp\left(-\frac{\left(x-\left(\mu-\sigma^2\alpha\right)\right)^2}{2\sigma^2}\right)$$

I think that this is not equivalent to the truncated distribution since the normalization is missing. But this is not a proper distribution any more since it does not integrate to one. How do I sample from this distribution and why can it be used in the Gibbs sampler if it is not a proper density?

• Im trying to understand a paper where they call the product of an gaussian with the exponential distribution a rectified distribution. And I need to find a way to sample from this rectified distribution. – S.Ke Nov 1 '15 at 4:25
• Looking at the Wikipedia entry, the definition is clearly different from (a) a truncated normal (because of the Dirac mass at zero) and (b) from the product of a Gaussian rv by an Exponential rv. – Xi'an Nov 1 '15 at 8:25
• @Xi'an That means I can interpret the rectified Gaussian in the last formula as a truncated Gaussian? Did I understand you correctly? – S.Ke Nov 2 '15 at 11:21

This is a truncated Gaussian density: $$\mathcal{R}(x|\mu,\sigma,\alpha)\propto K\exp\left(-\frac{\left(x-\left(\mu-\sigma^2\alpha\right)\right)^2}{2\sigma^2}\right)\mathbb{I}_{x>0}$$ means that the posterior distribution is proportional to a truncated Gaussian density but the proportionality factor $$K$$ is defined by the fact that it is a density! Hence it is the very same truncated Gaussian density.