Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have a data set which displays a bimodal distribution. This was determined by plotting a histogram of the frequency vs number.
I now need to separate the two original populations and therefore find an intersection point of sorts. From the plot it looks like the point might be approx. -1.0 to -0.8.
Is there a straight forward calculation or function that I can use to locate this point more accurately?
$\begingroup$Have you ever heard of finite mixture modeling? You may think of the observed distribution as a mixture of two distributions, and you can make inference about where the "split" occurs within this framework.$\endgroup$
$\begingroup$Hi Macro. Thanks for the idea. It sounds like something that would work but in looking it up it seems pretty complex. I'm no stats wizz so really after something simple here, even if it's an approximation.$\endgroup$
$\begingroup$Well, you could move the threshold for the "split", and optimize the resulting likelihood. The likelihood may be non-differentiable in the threshold, but it's just a one-dimensional line search so you should be able to use derivative-free methods for the optimization.$\endgroup$
$\begingroup$Thanks for the help Marco. I ended up finding a programatic solution (running under Linux) which works quite well, especially for this type of data (i.e. astronomy related). Would it be accepted if I post the details of that as an answer? What's the etiquette?$\endgroup$
Actually that algorithm sounds like it is using precisely the methodology that Macro was suggesting. The idea is that you have a distribution $$F(x)=pF_{1}(x)+(1-p)F_{2}(x)$$ where $F_1$ and $F_2$ are specified up to a few parameters that are estimated from the data. In your case $F_1$ and $F_2$ are both Gaussian and there would be 5 parameters to estimate from the data, $p, σ_1, σ_2, μ_1$, and $μ_2$ the mixture proportion and the standard deviations and means respectively for the distributions $F_1$ and $F_2$. There is actually no unique separation point since the distributions overlap. But the algorithm probably picks the crossing point for the densities. Since these are Gaussian distributions there will only be one unless one has a very large variance compared to the other. Without knowing the algorithm, I wouldn't know how many of these parameters are estimated. For example both standard deviations could be estimated or they could be assumed equal and only a pooled standard deviation would be estimated. 5 parameters estimated in the first case and 4 in the second. After the parameters of $F_1$ and $F_2$ are estimated you use the distributions specified by the estimates to calculate the crossing point.
$\begingroup$Can you clarify what you mean by "Since these are [Gaussian] distributions there will only be one unless one has a very large variance compared to the other"? Are you speaking of the densities? If you have any two continuous strictly positive densities $f_1$ and $f_2$ with unbounded support, how can you not have at least one intersection point?$\endgroup$
$\begingroup$@cardinal Usually the densities will only cross in one place (where the right hand tail of one meets the left hand tail of the other). But say the one on the right has a very large variance so that the density is very spread out then it can cross at both the right hand tail (dropping below as you move left and then the lefthand tail crossing above. I didn't say that they couldn't intersect. I just meant that the intersection point need not necessarily be the point you want to define as the separation point.$\endgroup$
$\begingroup$@Scot - updated with a new link. It's not in a published journal though but I've provided the author, year, and title incase it goes missing again$\endgroup$
You can use the Otsu's method, you can think at your histogram as the histogram of the grey values of pixels in an image.
Then, in computer vision and image processing, Otsu's method, named after Nobuyuki Otsu (大津展之 Ōtsu Nobuyuki)1, is used to automatically perform clustering-based image thresholding, or, and that is your case, the reduction of a graylevel image to a binary image.
The algorithm assumes that the image contains two classes of pixels following bi-modal histogram (foreground pixels and background pixels), it then calculates the optimum threshold separating the two classes so that their combined spread (intra-class variance) is minimal, or equivalently (because the sum of pairwise squared distances is constant), so that their inter-class variance is maximal.
1Otsu, Nobuyuki. "A threshold selection method from gray-level histograms." IEEE transactions on systems, man, and cybernetics 9.1 (1979): 62-66.
You can use the check to "normality" (there are many packages): The algorithm is simple: split var into bins. count the number of observations and the expected, take the difference, standardize by expected. The bin in which we have the min of standardized res - will contain the desired optimal threshold for dichotomisation! (2 bins with max stdRes= modes of yours 2 distributions ;-). Don't fogot play with (try) differrent bin numbers! Next you try to clarify within this interval via model selection (KLIC/CAIC/BIC/etc).