Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Gaussian Mixture
Date: Wed, 25 Mar 2009 15:04:01 +0000 (UTC)
Organization: Xoran Technologies
Lines: 28
Message-ID: <gqdh51$qju$1@fred.mathworks.com>
References: <gqc6nk$h5n$1@fred.mathworks.com> <gqdc34$go5$1@fred.mathworks.com> <gqdddi$mfe$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1237993441 27262 172.30.248.35 (25 Mar 2009 15:04:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 25 Mar 2009 15:04:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:527629


"Jose Valerio" <lapenda@gmail.com> wrote in message <gqdddi$mfe$1@fred.mathworks.com>...
> Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <gqdc34$go5$1@fred.mathworks.com>...
> > Jose Valerio wrote:
> > 
> > > I have to generate 1000 samples distributed according to Gaussian Mixture distribution. And it has to consist of the sum of two distribution N(-2,1) and (2,1). weights of 0.4 and 0.6
> > > 
> > > I know that there is a method to generate the random numbers based on the inverse function of the cdf of that distribution and that's what I need to use, but I just can't figure it out.
> > 
> > You _can_ do that if that's what the homework assignment asks for, but there's a more obvious way.  Consider what a mixture model is:  a random value chosen from one of two probability distributions with (in your case) probabilities .4 and .6.  If that sounds like a constructive definition useful for generating a random value from the mixture, it is.
> > 
> > Hope this helps.
> 
> Ok, this is the whole asignment, but I can't find anything on my lectures that can help much with it. I've tried different ways and I still don't get it, maybe if it was worded a different way I would have a better chance of completing it.
> 
> A method to generate random numbers from any distribution is based on the inverse function of
> the cdf of that distribution (see the below figure to understand the principle of the method).
> Use the method to generate 1000 samples distributed according to a Gaussian Mixture -
> distribution (GM), which consist of the weighted sum of two normal distributions N(-2,1) and
> N(2,1), with the corresponding weights of 0.4 and 0.6.
> Application For Data Analysis - 2 -
> Final Project Winter 2009
> &#8226; Generate the two normal pdfs with function normpdf, just as previously. Plot the pdfs into
> a single figure.
> &#8226; Calculate the weighted sum of these two pdfs, which is the GM-pdf. Plot the GM-pdf with
> the function plot &#8211; does it look like the weighted sum of two normal distributions?


A hint. You can do this with a combination of erf() and interp1()