[R] Simulate Mixture Model data

Goeland goeland at gmail.com
Tue Mar 21 06:21:12 CET 2006


Dear R Users£¬

I woould like to generate mixture model data.

I try two type method as followings two method, can anyone tell me which is right? or  better?

1. generate two vectors data y1 and y2 from f1 and f2 seperately, and calculate y=alpha1*y1+alpha2*y2,
2. generate prob=unif(1), if prob <alpha1 y=y1, else y=y2. 

Can anyone give me some idea?

Thanks so much!	

Goeland
goeland at gmail.com
2006-03-21




More information about the R-help mailing list