random numbers from custom mixture distribution
Show older comments
I would like to generate random numbers from a mixture distribution defined as,
pdf_mix = p*gampdf(x,a,b) + (1-p)*lognpdf(x,mu,sigma);
I am able to obtain the best fit model using mle, but I also want random numbers generated from this mixture distribution. Is this possible? Can I get some help on this?
R Venkatessh
Accepted Answer
More Answers (1)
Image Analyst
on 6 Oct 2013
0 votes
Calculate the CDF and then get a random number from the uniform distribution and plug it in. See the method described here: http://en.wikipedia.org/wiki/Inverse_transform_sampling I've also attached my program for doing it with a rayleigh distribution. Click on the filename below (not the picture, but the filename).

Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!