Hi!

I would to generate random number for truncated Laplace PDF. I saw from
a report that a truncated distribution function can be expressed as

              F_truncated(x)=F(x)-F(low)/ (F(upper)-F(low)) ; low <=x
<=upper

For Laplace distribution function, F(x) can have

                               F(x) = 1/2 * exp(-(a-x)/b)  for  x<a

                        and F(x)=1-(1/2)*exp(-(x-a)/b)  for x>=a

where a and 2b^2 are the mean and variance respectively.

So I generate random variates having distribution function F_truncated
is as follows,
(1) Generate U ~ U(0, 1).
(2) Set Y = F(low) + [F(upper) - F(lower)]U.
(3) Return x = inverse F(Y).

It turns out that I have the following  x

x=a + b * ln ( 2*(U*(F(upper)-F(low)) + F(low))); for x <a

x=a - b *  ln ( 2*(1-U*(F(upper)-F(low)) - F(low))); for x >= a


However, when generated the outputs do not seems correct at all. I don't
know where had gone wrong. Thanks in advance for any help.

Best Regards,
Su



.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================

Reply via email to