I wonder if there is any statistical test to "test" the significance of a bimodal distribution. I mean, How much my data meets the bimodal distribution or not? If so, is there any test in the R program?
-
6$\begingroup$ Did you not find an answer by searching our site? If not, what is lacking? $\endgroup$– whuber ♦Commented Feb 28, 2013 at 18:43
-
7$\begingroup$ There are tests for bimodality or multimodality, but they tend to be one-sided. That is, you can conclude stuff like "there's more than one mode", but you can't say "there's fewer than three modes" - you can get lower bounds on the number of modes but you can't really get upper bounds because a multimodal distribution with any number of modes can be found that is arbitrarily close to a distribution with any smaller number of modes. I will see if I can dig up some explicit tests or references. $\endgroup$– Glen_bCommented Feb 28, 2013 at 22:25
-
4$\begingroup$ The wikipedia page on bimodal distribution lists eight tests for multimodality against unimodality and supplies references for seven of them. I am not sure if any are in R. I will look. $\endgroup$– Glen_bCommented Feb 28, 2013 at 22:31
3 Answers
Another possible approach to this issue is to think about what might be going on behind the scenes that is generating the data you see. That is, you can think in terms of a mixture model, for example, a Gaussian mixture model. For instance, you might believe that your data are drawn from either a single normal population, or from a mixture of two normal distributions (in some proportion), with differing means and variances. Of course, you don't have to believe that there are only one or two, nor do you have to believe that the populations from which the data are drawn need to be normal.
There are (at least) two R packages that allow you to estimate mixture models. One package is flexmix, and another is mclust. Having estimated two candidate models, I believe it may be possible to conduct a likelihood ratio test. Alternatively, you could use the parametric bootstrap cross-fitting method (pdf).
-
$\begingroup$ Hi @gung, for the parametric bootstrap cross-fitting method, how would you define the optimal criterion with respect to bimodal distribution? There may be a case where two competing distributions cross each other at two points. What should be done in such a case? $\endgroup$ Commented Nov 5, 2015 at 8:26
As mentioned in comments, the Wikipedia page on 'Bimodal distribution' lists eight tests for multimodality against unimodality and supplies references for seven of them.
There are at least some in R. For example:
The package
diptest
implements Hartigan's dip test.The
stamp
data in thebootstrap
package was used in Efron and Tibshirani's Introduction to the Bootstrap (the book on which the package is based) to do an example relating to bootstrapping on the number of modes; if you have access to the book you might be able to use that approach.Efron, B. and Tibshirani, R. (1993) An Introduction to the Bootstrap.
Chapman and Hall, New York, London.
--
There's a question on CV that talks about identifying (i.e., estimating rather than testing) the number of modes which @whuber's search turns up. It's worth reading the answers there. One of the responses there (mine, as it happens) has a link to a Google search which turns up this paper[1] by David Donoho on constructing one-sided CIs for the number of modes, which can of course be used as a test (e.g., if the one-sided interval doesn't include the unimodal case, you can reject unimodality). To the best of my knowledge that isn't one of the tests that Wikipedia mentions. I don't think there's an R implementation of that interval, but (in spite of the fact that Donoho tends to use fairly sophisticated tools in his discussion of it) it's actually a pretty simple idea to implement. That idea is directly related to the notion of using kernel density estimation.
[1]: David L. Donoho, (1988)
"One-Sided Inference about Functionals of a Density,"
Ann. Statist. 16(4): 1390-1420 (December)
-
-
$\begingroup$ link to Donoho's paper seems to be broken? Thanks! $\endgroup$– MatifouCommented Jul 31, 2022 at 10:06
-
$\begingroup$ Thanks. I believe it's this one: projecteuclid.org/journals/annals-of-statistics/volume-16/… $\endgroup$– Glen_bCommented Jul 31, 2022 at 22:31
You should look at the multimode package, which has also a Journal of Statistical Software companion paper: multimode: An R Package for Mode Assessment
The function modetest
provides many tests with the argument method=...
- Bandwidth test: original test from Silverman (1981)
method=SI
and improved p-values by Hall and York (2001),HY
- Dip test: test by Hartigan and Hartigan (1985),
HH
- Excess Mass test: improved p-values of Cheng and Hall (1998)
CH
, and improved test by the authors of the package, Ameijeiras-Alonso et al. (2019)ACR
- Cramer-von Mises test: Fisher and Marron (2001),
FM
References:
- Silverman BW (1981). “Using Kernel Density Estimates to Investigate Multimodality.” Journal of the Royal Statistical Society B, 43(1), 97–99. doi:10.1111/j.2517-6161.1981.tb01155.x.
- Hartigan JA, Hartigan PM (1985). “The Dip Test of Unimodality.” The Annals of Statistics, 13(1), 70–84. doi:10.1214/aos/1176346577.
- Hall P, York M (2001). “On the Calibration of Silverman’s Test for Multimodality.” Statistica Sinica, 11(1), 515–536.
- Fisher NI, Marron JS (2001). “Mode Testing via the Excess Mass Estimate.” Biometrika, 88(2), 419–517. doi:10.1093/biomet/88.2.499.
- Cheng MY, Hall P (1998). “Calibrating the Excess Mass and Dip Tests of Modality.” Journal of the Royal Statistical Society B, 60(3), 579–589. doi:10.1111/1467-9868.00141.
- Ameijeiras-Alonso J, Crujeiras RM, Rodríguez-Casal A (2019). “Mode Testing, Critical Bandwidth and Excess Mass.” Test, 28(3), 900–919. doi:10.1007/s11749-018-0611-5.