[R] Fitting Mixture distributions

Simon Zehnder szehnder at uni-bonn.de
Tue Jul 16 23:53:09 CEST 2013

Hi Tjun Kiat Teo,

you try to fit a Normal mixture to some data. The Normal mixture is very delicate when it comes to parameter search: If the variance gets closer and closer to zero, the log Likelihood becomes larger and larger for any values of the remaining parameters. Furthermore for the EM algorithm it is known, that it takes sometimes very long until convergence is reached. 

Try the following: 

Use as starting values for the component parameters:

start.par <- mean(your.data, na.rm = TRUE) + sd(your.data, na.rm = TRUE) * runif(K)

For the weights just use either 1/K or the R cluster function with K clusters

Here K is the number of components. Further enlarge the maximum number of iterations. What you could also try is to randomize start parameters and run an SEM (Stochastic EM). In my opinion the better method is in this case a Bayesian method: MCMC.



On Jul 16, 2013, at 10:59 PM, Tjun Kiat Teo <teotjunk at gmail.com> wrote:

> I was trying to use the normixEM in mixtools and I got this error message.
> And I got this error message
> One of the variances is going to zero;  trying new starting values.
> Error in normalmixEM(as.matrix(temp[[gc]][, -(f + 1)])) : Too many tries!
> Are there any other packages for fitting mixture distributions  ?
> Tjun Kiat Teo
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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.

More information about the R-help mailing list