Hello I am trying to find an automated way of fitting a mixture of normal and log-normal distributions to data which is clearly bimodal. Here's a simulated example: x.1<-rnorm(6000, 2.4, 0.6) x.2<-rlnorm(10000, 1.3,0.1) X<-c(x.1, x.2) hist(X,100,freq=FALSE, ylim=c(0,1.5))lines(density(x.1), lty=2, lwd=2) lines(density(x.2), lty=2, lwd=2) lines(density(X), lty=4)
Currently i am using mixtools and just run: library(mixtools) mixmdl = normalmixEM(X, k=2, epsilon = 1e-08, maxit = 1000, maxrestarts=20, verb = TRUE, fast=FALSE, ECM = FALSE, arbmean = TRUE, arbvar = TRUE) plot(mixmdl,which=2)lines(density(X), lty=2, lwd=2) This is obviously not the best way of doing this. The estimates it gives are: mu 3.6595737(x.2 log()=1.29) 2.3113135(x.1) These are not too far off but I was wondering if someone knows of a better R package/way of doing this or has any hints that would help me coding it from scratch (EM+writing down the formulae for ML? but... would this really be better than using a "more-advanced-already-available-package-made-by-pros"?). The objective is to estimate threshold values at specific FDRs. (some help with that would also be most helpful.) Thanks to all in advance! To' ______________________________________________ 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.