Re: [R] Rmix package and different distributions

From: Ben Bolker <bolker_at_zoo.ufl.edu>
Date: Sun 29 Oct 2006 - 19:44:08 GMT

nelson - <nelson1977 <at> gmail.com> writes:

>
> hi all!
> i want to mix a dataset that is build up from 2 distribution: an
> exponential and a normal. I can' figure out how can i use Rmix package
> to do the fitting of my data. Pheraps it si the wrong package? any
> suggestion?
>
> thanks,
> nelson
>
  

  Perhaps use optim() or mle() [from the stats4 package] and a custom-defined negative log-likelihood function ...

e.g.

nllfun <- function(p,a,mu,sigma) {

   -sum(log(p*dexp(x,a)+(1-p)*dnorm(x,mu,sigma))) }

mle(minuslogl=nllfun,...)

[you'll need to provide starting values for the parameters]

  Please note that this is completely untested! See Venables and Ripley's mixture-modeling example in MASS for more details of this kind of custom fitting (their example is a mixture of two normals, but it should still be helpful)

  Ben Bolker



R-help@stat.math.ethz.ch 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. Received on Mon Oct 30 08:24:23 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 29 Oct 2006 - 22:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.