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

Bert Gunter bgunter.4567 at gmail.com
Tue Jan 24 00:34:33 CET 2017

```Fitting multicomponent mixtures distributions -- and 3 is already a
lot of components -- is inherently ill-conditioned. You may need to
reassess your strategy. You might wish to post on stackexchange
instead to discuss such statistical issues.

Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Mon, Jan 23, 2017 at 2:32 PM, Thomas Petzoldt <thpe at simecol.de> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help