9
$\begingroup$

I wish to simulate from a normal density (say mean=1, sd=1) but only want positive values.

One way is to simulate from a normal and take the absolute value. I think of this as a folded normal.

I see in R there are functions for truncated random variable generation. If I simulate from a truncated normal (truncation at 0) is this equivalent to the folded approach?

$\endgroup$
10
$\begingroup$

Yes, the approaches give the same results for a zero-mean Normal distribution.

It suffices to check that probabilities agree on intervals, because these generate the sigma algebra of all (Lebesgue) measurable sets. Let $\Phi$ be the standard Normal density: $\Phi((a,b])$ gives the probability that a standard Normal variate lies in the interval $(a,b]$. Then, for $0 \le a \le b$, the truncated probability is

$$\Phi_{\text{truncated}}((a,b]) = \Phi((a,b]) / \Phi([0, \infty]) = 2\Phi((a,b])$$

(because $\Phi([0, \infty]) = 1/2$) and the folded probability is

$$\Phi_{\text{folded}}((a,b]) = \Phi((a,b]) + \Phi([-b,-a)) = 2\Phi((a,b])$$

due to the symmetry of $\Phi$ about $0$.

This analysis holds for any distribution that is symmetric about $0$ and has zero probability of being $0$. If the mean is nonzero, however, the distribution is not symmetric and the two approaches do not give the same result, as the same calculations show.

Three distributions

This graph shows the probability density functions for a Normal(1,1) distribution (yellow), a folded Normal(1,1) distribution (red), and a truncated Normal(1,1) distribution (blue). Note how the folded distribution does not share the characteristic bell-curve shape with the other two. The blue curve (truncated distribution) is the positive part of the yellow curve, scaled up to have unit area, whereas the red curve (folded distribution) is the sum of the positive part of the yellow curve and its negative tail (as reflected around the y-axis).

$\endgroup$
1
  • 1
    $\begingroup$ I like the picture. $\endgroup$ – Karl Sep 27 '11 at 4:37
5
$\begingroup$

Let $X \sim N(\mu = 1, SD=1)$. The distribution of $X|X > 0$ is definitely not the same as that of $|X|$.

A quick test in R:

x <- rnorm(10000, 1, 1)
par(mfrow=c(2,1))
hist(abs(x), breaks=100)
hist(x[x > 0], breaks=100)

This gives the following. simulation histograms

$\endgroup$

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.