[R] EM algorithm in R

tj girlme80 at yahoo.com
Sat Mar 20 08:53:00 CET 2010


Please help me in writing the R code for this problem. I've been solving this
for 4 days. It was hard for me to solve it. It's a simulation problem in R.


The problem is

My true model is a normal mixture which is given as
0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components.

I will get a random sample of size 100 from this model. I will do this 300
times.
That means, I will have 300 samples of size 100 each sample. From each of
the 300 samples generated, I need to fit a 1 component model, 2
components......up to 5 components model. Then for each sample, I will
estimate the parameters of this model using EM algorithm.

After that, I will try to evaluate AIC and BIC and determine how many times
AIC had its minimum value at 2components. Then I will also determine how
many times BIC had its minimum at 2components. For example, AIC has the
correct choice if its minimum value occurred when we model two components
(Because the true model has two components). 

Thank you!


-- 
View this message in context: http://n4.nabble.com/EM-algorithm-in-R-tp1663020p1663020.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list