help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Re: sampling mixture distribution


From: Martin Jansche
Subject: Re: [Help-gsl] Re: sampling mixture distribution
Date: Thu, 2 Oct 2008 17:43:34 -0400

In general, you sample the mixture component indicator z from the
mixing distribution and then sample from the z-th component of the
mixture.

For discrete mixtures, that's 2 calls to GSL: Sample z from
gsl_ran_discrete(...) (or even simpler for two-component mixtures),
then sample from the z-th component distribution, e.g. x = mu[z] +
gsl_ran_gaussian(rng, sigma[z]).

-- mj

On Thu, Oct 2, 2008 at 09:52, Rodney Sparapani <address@hidden> wrote:
> Jun Yang wrote:
>>
>> Hi,
>>
>> How to use GSL to sample from mixture distribution such as a Gaussian
>> mixture? Thanks.
>>
>>
>> Best Regards,
>>
>> Jun Yang
>
> I don't think there is a GSL routine for this.  But, that's probably just as
> well.  Normally, the way you do this is you have 3 PRNG streams:  a
> Bernoulli and 2 different Gaussians.  If the Bernoulli is zero, then you
> sample from one Gaussian, otherwise, the other.
>
> Rodney
>
>
>
> _______________________________________________
> 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]