help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Truncated normal distribution using gsl_rng_gaussian


From: Martin Jansche
Subject: Re: [Help-gsl] Truncated normal distribution using gsl_rng_gaussian
Date: Mon, 22 Dec 2008 17:21:13 -0500

On Mon, Dec 22, 2008 at 13:45, chadia kanaan <address@hidden> wrote:
> Hello,
>
> Could someone, please,  guide me how to generate truncated Gaussian 
> probability distribution  numbers between [min,  max]  using the already 
> existing gsl_gaussian generators . lets say between 0 and infinity for 
> example.

If the region of interest has a reasonably high probability (e.g. if
the mean in your example is >= 0), you can sample z ~
gsl_ran_gaussian_ziggurat() and reject if z is outside your region.
If the region includes the upper or lower tail (e.g. if the mean in
your example is < 0), you can simply use gsl_ran_ugaussian_tail()
instead.  If you need to truncate on two sides, you can combine either
method with rejection.

-- mj

>
> In earlier gsl archive, this point was discussed and  refered to other method 
> like rejection. I have used this method before, but gsl_gaussian generator is 
> at least 10 times faster and reliable than generators based on 
> rejection/acceptance method.
> so I need a solution based on gsl_generator , maybe through simple 
> transformation ..
>
> Many thanks for your help,
> regards,
> C. K
>
>
>
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]