[R] sampling from a mixture distribution
Giovanni Petris
GPetris at uark.edu
Wed Mar 23 15:17:35 CET 2005
For each variate, generate it from f1() with probability p1, and from
f2() with probability p2. In other words, flip a p1-biased coin to
decide which distribution, f1 or f2, to generate from.
HTH,
Giovanni
> Date: Wed, 23 Mar 2005 13:53:10 +0000
> From: Vumani Dlamini <dvumani at hotmail.com>
> Sender: r-help-bounces at stat.math.ethz.ch
> Precedence: list
>
> Dear R users,
> I would like to sample from a mixture distribution p1*f(x1)+p2*f(x2). I
> usually sample variates from both distributions and weight them with their
> respective probabilities, but someone told me that was wrong. What is the
> correct way?
> Vumani
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
--
__________________________________________________
[ ]
[ Giovanni Petris GPetris at uark.edu ]
[ Department of Mathematical Sciences ]
[ University of Arkansas - Fayetteville, AR 72701 ]
[ Ph: (479) 575-6324, 575-8630 (fax) ]
[ http://definetti.uark.edu/~gpetris/ ]
[__________________________________________________]
More information about the R-help
mailing list