Several ways to generate numbers from Gausian Mixture Model: elder and children as customers, numbers of orders in different seasons
Henry T.H. Tu
Specialised in operational data analytics, cloud big data analytics, customer analytics, geospatial data analytics, and natural language processing with computing/statistical background in EY Singapore TD team
In business simulation, we have to generate numbers from different latent (unobserved variables). For example, the number of orders in restaurant can change in week days and weekend. But they are different numbers around two centers. You can have insurance customers of very young and very old ages. But they are also distribution around two centers.
Pick a center, then pick a number that normal/gaussian center
If you know the structure of the model (distribution), you can sample from one layer to another layer. In this case, we have to select center (mu, sigma) and then we use the normal sampling method to generate numbers.
https://raw.githubusercontent.com/tutrunghieu/sharing/master/bsgmm/gmm1-inner.R
Rejection method
We consider the range of the (minMu - 5*maxSigma, maxMu + 5*maxSigma) to draw uniform random variable U1 and accept the variable if U2 < eval(U1, GMM) or we accept only pairs (U1, U2) under the curve where U1 is drawn from (minMu - 5*maxSigma, maxMu + 5*maxSigma)
https://raw.githubusercontent.com/tutrunghieu/sharing/master/bsgmm/gmm2-rejection.R
Histogram method
We can also use the histogram method to draw samples from the gaussian mixture model. However, it will be costly to store all the bins when we have many centers in the model.
https://raw.githubusercontent.com/tutrunghieu/sharing/master/bsgmm/gmm3-hist.R
Conclusion
Gaussian mixture model (GMM) is the extended distribution of normal distribution by introducing many centers to get closer to the real-world distributions. This leads to the two-step process to generate one single variable. If you have know clue about the structure of the GMM, then we can use generic methods (rejection, histogram) to generate samples from GMM.