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. ______________________________________________ R-help@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.