PreviousIndexLast

[help-gsl] Re: Re: sampling mixture distribution (2008-10-02)

From: "Martin Jansche" <mjansche@.........>
Subject: Re: Re: sampling mixture distribution
Date: Thu, 2 Oct 2008 17:43:34 -0400
To: "Rodney Sparapani" <rsparapa@.......>
Cc: help-gsl@gnu.org

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 <rsparapa@.......> 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
> Help-gsl@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gsl
>