[R] how to use normalmixEM to get correct result?
Tatiana Benaglia
tab321 at stat.psu.edu
Mon Oct 15 05:22:26 CEST 2007
Hi,
you're having problems with the initial values for the EM. If you
don't give initial values for lambda, mu, and sigma, the function
tries to generate them, which is causing the errors. I'd try to input
initial values based on your data. Do the histogram of log.x (you
don't need to sort the data) and choose values for mu and sigma. Then
use:
outx = normalmixEM(log.x, lambda=c(.4, .6), mu=c(mu1, mu2), sigma=c
(sigma1, sigma2))
Hope that helps,
Tatiana
On Oct 14, 2007, at 11:00 PM, bgchen wrote:
> Dear R-Users,
> I have a large number of data(54000) and the field of data is
> 50 to 2.0e9. I want to use normalmixEM (package:mixtools) to fit
> them in finite mixture narmal distributions,but get some mistakes.I
> don't know which steps make the error.
> I have used the following functions before
> >x<-read.table("data")
> >log.x<-log10(x$V1)
>> log.x<-sort(log.x)
>> outx = normalmixEM(log.x,arbmean = TRUE, arbvar = TRUE,
>> k=2,epsilon = 1e-03,maxit = 10000, verb = FALSE)
> The output is given as:
> Need new starting values due to singularity...
> Need new starting values due to singularity...
> Need new starting values due to singularity...
> error in normalmixEM(log.x, arbmean = TRUE, arbvar = TRUE, k =
> 2, epsilon = 0.001, :
> Too many tries!
>
>
> Thanks for the help
>
>
>
> bob
> bgchen at scut.edu.cn
> 2007-10-15
> ______________________________________________
> 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