r - Mixture of Gaussian and Gamma distribution -
i'm looking script/package in r (python too) find out component distribution parameters mixture of gaussian , gamma distributions. i've far used r package "mixtools" model data mixture of gaussians, think can better modeled gamma plus gaussian. thanks here's 1 possibility: define utility functions: rnormgammamix <- function(n,shape,rate,mean,sd,prob) { ifelse(runif(n)<prob, rgamma(n,shape,rate), rnorm(n,mean,sd)) } (this made little bit more efficient ...) dnormgammamix <- function(x,shape,rate,mean,sd,prob,log=false) { r <- prob*dgamma(x,shape,rate)+(1-prob)*dnorm(x,mean,sd) if (log) log(r) else r } generate fake data: set.seed(101) r <- rnormgammamix(1000,1.5,2,3,2,0.5) d <- data.frame(r) approach #1: bbmle package. fit shape, rate, standard deviation on log scale, prob on logit scale. library("bbmle") m1 <- mle2(r~dnormgammamix(exp(logshape),exp(lograte),mean,exp(l...