Hi, Is there any package that I can use to simulate the Gaussian Mixture Model , which is a mixture modeling method that is widely used in statistical learning theory. I know there is a mclust, however, I think it is a little bit different from my problem. Thanks very much.. regards. -------------------------- Peng Jiang ?? Ph.D. Candidate Antai College of Economics & Management ???????? Department of Mathematics ??? Shanghai Jiaotong University (Minhang Campus) 800 Dongchuan Road 200240 Shanghai P. R. China
Take a look at mixtools. Tatiana On Jun 22, 2008, at 9:23 PM, Peng Jiang wrote:> > > Hi, > Is there any package that I can use to simulate the Gaussian > Mixture Model , which is a mixture modeling method that is widely > used in statistical learning theory. > I know there is a mclust, however, I think it is a little bit > different from my problem. > Thanks very much.. > > regards. > > > > > > > > > -------------------------- > Peng Jiang > ?? > Ph.D. Candidate > > Antai College of Economics & Management > ???????? > Department of Mathematics > ??? > Shanghai Jiaotong University (Minhang Campus) > 800 Dongchuan Road > 200240 Shanghai > P. R. China > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi, Peng,
I had a piece of SAS code for 2-class gaussian mixture from my blog.
You might convert it to R code.
2-Class Gaussian Mixture Model in SAS
data d1;
do i = 1 to 100;
x = ranuni(1);
e = rannor(1);
y = 5 * x + e;
output;
end;
run;
data d2;
do i = 1 to 100;
x = ranuni(2);
e = rannor(2);
y = 15 + 10 * x - 5 * x ** 2 + e;
output;
end;
run;
data data;
set d1 d2;
run;
proc nlmixed data = data tech = quanew maxiter = 1000;
parms b10 = 0 b11 = 5 b12 = 0 b20 = 15 b21 = 10 b22 = -5
prior = 0.1 to 0.9 by 0.01 sigma = 1;
mu1 = b10 + b11 * x + b12 * x * x;
mu2 = b20 + b21 * x + b22 * x * x;
pi = constant('pi');
P1 = 1 / (((2 * pi) ** 0.5) * sigma) * exp(-0.5 * ((y - mu1) / sigma) ** 2);
P2 = 1 / (((2 * pi) ** 0.5) * sigma) * exp(-0.5 * ((y - mu2) / sigma) ** 2);
LH = P1 * prior + P2 * (1 - prior);
LL = log(LH);
model y ~ general(LL);
run;
/*
Parameter Estimates
Standard
Parameter Estimate Error DF t Value Pr > |t| Alpha
b10 -0.1744 0.3450 200 -0.51 0.6137 0.05
b11 5.3426 1.5040 200 3.55 0.0005 0.05
b12 -0.06454 1.4334 200 -0.05 0.9641 0.05
b20 15.3652 0.3099 200 49.57 <.0001 0.05
b21 9.6297 1.4970 200 6.43 <.0001 0.05
b22 -5.4795 1.4776 200 -3.71 0.0003 0.05
prior 0.5000 0.03536 200 14.14 <.0001 0.05
sigma 1.0049 0.05025 200 20.00 <.0001 0.05
*/
On 6/22/08, Peng Jiang <jp021 at sjtu.edu.cn>
wrote:>
>
> Hi,
> Is there any package that I can use to simulate the Gaussian Mixture
Model
> , which is a mixture modeling method that is widely used in statistical
> learning theory.
> I know there is a mclust, however, I think it is a little bit different
> from my problem.
> Thanks very much..
>
> regards.
>
>
>
>
>
>
>
>
> --------------------------
> Peng Jiang
> ??
> Ph.D. Candidate
>
> Antai College of Economics & Management
> ????????
> Department of Mathematics
> ???
> Shanghai Jiaotong University (Minhang Campus)
> 800 Dongchuan Road
> 200240 Shanghai
> P. R. China
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
==============================WenSui Liu
Acquisition Risk, Chase
Email : wensui.x.liu at chase.com
Blog : statcompute.spaces.live.com
===============================
First, simulate a uniform r.v on [0,1] and then cast it to binary label according to your underlying mixing probability; Second, simulate a Gaussian r.v. in above selected component. Of course, you can vecterize the two steps to simply your code. X Peng Jiang ??:> > > Hi, > Is there any package that I can use to simulate the Gaussian Mixture > Model , which is a mixture modeling method that is widely used in > statistical learning theory. > I know there is a mclust, however, I think it is a little bit > different from my problem. > Thanks very much.. > > regards. > > > > > > > > > -------------------------- > Peng Jiang > ?? > Ph.D. Candidate > > Antai College of Economics & Management > ???????? > Department of Mathematics > ??? > Shanghai Jiaotong University (Minhang Campus) > 800 Dongchuan Road > 200240 Shanghai > P. R. China > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.