Re: [R] Fitting a distribution to peaks in histogram

From: hadley wickham <>
Date: Thu 20 Jul 2006 - 02:20:32 EST

> I would like to fit a distribution to each of the peaks in a histogram, such
> as this:

As a first shot, I'd try fitting a mixture of gamma distributions (say 3), plus a constant term for the highest bin. You could do this using ML. If the number of peaks is truly unknown, this will be a little trickier but still possible and you could use the LRT to chose between them.

> Integrate the area between each two peaks, using the means and widths of the
> distributions fitted to the two peaks. I will be using the integrate
> function

Why do you want to do this?

> The histogram is based on approximately 15000 events, which makes Mclust and
> pam (which both delivers the information I need) less useful.

If you have unbinned data, it would be better (more precise/powerful) to use that.


Hadley mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu Jul 20 02:26:19 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 Thu 20 Jul 2006 - 04:17:42 EST.

Mailing list information is available at Please read the posting guide before posting to the list.