Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I understand that once we plot the values as a chart, we can identify a bimodal distribution by observing the twin-peaks, but how does one find it programmatically? (I am looking for an algorithm.)

share|improve this question
3  
Intriguing question. I've know nothing about this so won't attempt an answer, but googling bimodality+test gives quite a few promising leads. google.co.uk/search?q=bimodality+test – onestop Jan 4 '11 at 13:29

5 Answers

up vote 16 down vote accepted

Identifying a mode for a continuous distribution requires smoothing or binning the data.

Binning is typically too procrustean: the results often depend on where you place the bin cutpoints.

Kernel smoothing (specifically, in the form of kernel density estimation) is a good choice. Although many kernel shapes are possible, typically the result does not depend much on the shape. It depends on the kernel bandwidth. Thus, people either use an adaptive kernel smooth or conduct a sequence of kernel smooths for varying fixed bandwidths in order to check the stability of the modes that are identified. Although using an adaptive or "optimal" smoother is attractive, be aware that most (all?) of these are designed to achieve a balance between precision and average accuracy: they are not designed to optimize estimation of the location of modes.

As far as implementation goes, kernel smoothers locally shift and scale a predetermined function to fit the data. Provided that this basic function is differentiable--Gaussians are a good choice because you can differentiate them as many times as you like--then all you have to do is replace it by its derivative to obtain the derivative of the smooth. Then it's simply a matter of applying a standard zero-finding procedure to detect and test the critical points. (Brent's method works well.) Of course you can do the same trick with the second derivative to get a quick test of whether any critical point is a local maximum--that is, a mode.

share|improve this answer
@venkasub, you might also look at Muller's method for root-finding. It's simpler than Brent's method and "almost" as efficient as Newton's method, but without needing to know the derivatives of the target function. – cardinal Feb 5 '11 at 20:24

There is a well-known paper by Silverman that deals with this issue. It employs kernel-density estimation. See

B. W. Silverman, Using kernel density estimates to investigate multimodality, J. Royal Stat. Soc. B, vol. 43, no. 1, 1981, pp. 97-99.

Note that there are some errors in the tables of the paper. This is just a starting point, but a pretty good one. It provides a well-defined algorithm to use, in the event that's what you're most looking for. You might look on Google Scholar at papers that cite it for more "modern" approaches.

share|improve this answer
2  
+1 This paper exploits information about how the number of apparent modes depends on the kernel width (for Gaussian kernels) to select an appropriate width and then continues as described in my reply. – whuber Jan 7 '12 at 15:52

Dear Jan, a programmatic code to test for multimodality is available at www.estima.com and is called MODES.SRC. You can easily convert it to Matlab, R or other softwares. Regards, guido.

share|improve this answer

The definition in wiki is slightly confusing to me. The probability of a continous data set having just one mode is zero. A simple way to program a bimodal distrubiton is with two seperate normal distributions centered differently. This creates two peaks or what wiki calls modes. You can actually use almost any two distributions, but one of the harder statistical opportunities is to find how the data set was formed after combining the two random data distributions.

share|improve this answer
How will you identify the centers of the two normal distributions? – venkasub Jan 4 '11 at 18:41
@venkasub, the center of normal distribution is its mean. If you know that bimodality comes from two normal distributions you can fit mixture model to estimate the means, which will be two modes. – mpiktas Jan 5 '11 at 9:00

You can't identify the number of modes (there's no limit to the number of tiny wiggles a distribution could have), but you can get a lower bound.

e.g. see the first article here:

http://www.google.com/search?q=lower+bound+number+of+modes+of+a+density+donoho

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.