Generating dataset from Gaussian Mixture Model

5 vues (au cours des 30 derniers jours)
Josh
Josh le 22 Fév 2013
Hi all,
I'm attempting to generate a dataset from a Gaussian Mixture Model with very simple form and known parameters. My GMM is given by
a_1 * N(mu_1,sigma^2) + a_2 * N(mu_2,sigma^2)
So the two normal distributions have different means but the same standard deviation, a_1 and a_2 sum to one, and I can choose the values of all 5 parameters.
The only function I can find for this in matlab is the 'gmdistribution' command. This commands documentation repeatedly refers to a gaussian mixture distribution where each gaussian is multivariate, and I'm yet to find a way to use this method for the normal distributions I have above.
Any help would be greatly appreciated

Réponse acceptée

Tom Lane
Tom Lane le 22 Fév 2013
It's multivariate in the sense that it supports more than one dimension, but you can use it for a single dimension:
g = gmdistribution([1;10],2,[.6;.4])
hist(random(g,1000),40)
  2 commentaires
Josh
Josh le 24 Fév 2013
Thankyou! My glaringly obvious lack of stats background had me struggling with the input for sigma. Thanks again!
raymond raymond
raymond raymond le 1 Avr 2019
HI Tom:
i wonder how can i set different variance of each component for a single dimension with different probability ?
Thanks a lot!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by