[R] separate mixture of gamma and normal (with mixtools or ??)

Thomas Petzoldt thpe at simecol.de
Mon Jan 23 23:32:47 CET 2017


Dear friends,

I am trying to separate bi- (and sometimes tri-) modal univariate 
mixtures of biological data, where the first component is left bounded 
(e.g. exponential or gamma) and the other(s) approximately Gaussian.

After checking several packages, I'm not really clear what to do. Here 
is an example with "mixtools" that already works quite good, however, 
the left component is not Gaussian (and not symmetric).

Any idea about a more adequate function or package for this problem?

Thanks a lot!

Thomas



library(mixtools)
set.seed(123)

lambda <- c(0.25, 0.75)
N      <- 200

## dist1 ~ gamma (or exponential as a special case)
#dist1 <- rexp(lambda[1]*N, 1)
dist1 <- rgamma(lambda[1]*N, 1, 1)

## dist2 ~ normal
dist2 <- rnorm(lambda[2]*N, 12, 2)

## mixture
x <- c(dist1, dist2)

mix <-  spEMsymloc(x, mu0=2, eps=1e-3, verbose=TRUE)
plot(mix, xlim=c(0, 25))
summary(mix)


--
Thomas Petzoldt
TU Dresden, Institute of Hydrobiology
http://www.tu-dresden.de/Members/thomas.petzoldt



More information about the R-help mailing list