[R] EM algorithm in R

David Winsemius dwinsemius at comcast.net
Sat Mar 20 16:23:06 CET 2010


On Mar 20, 2010, at 3:53 AM, tj wrote:

>
> 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).

Homework problems generally require a lot more evidence of student  
effort before they get much (any?) response on r-help.

> -- 


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list