[R] separate mixture of gamma and normal (with mixtools or ??)
thpe at simecol.de
Mon Jan 23 23:32:47 CET 2017
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!
lambda <- c(0.25, 0.75)
N <- 200
## dist1 ~ gamma (or exponential as a special case)
#dist1 <- rexp(lambda*N, 1)
dist1 <- rgamma(lambda*N, 1, 1)
## dist2 ~ normal
dist2 <- rnorm(lambda*N, 12, 2)
x <- c(dist1, dist2)
mix <- spEMsymloc(x, mu0=2, eps=1e-3, verbose=TRUE)
plot(mix, xlim=c(0, 25))
TU Dresden, Institute of Hydrobiology
More information about the R-help