IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2605.18686.html

critband: A Python Package for Critical Bandwidth Analysis of Multimodal Distributions

Author

Listed:
  • Ruiyu Zhang
  • Qihao Wang

Abstract

Multimodal density estimation is a fundamental problem in scientific computing. Determining the number of modes in a distribution is a core numerical challenge with applications across ecology, economics, genomics, and astronomy. While the R ecosystem provides mature tools through the multimode package, the Python ecosystem has lacked an equivalent cohesive implementation. We present critband, a Python package for critical bandwidth bimodality detection based on Silverman's kernel density approach. The package implements critical bandwidth search with a robust bracketed mode-count solver and FFT-accelerated KDE, and provides additional features including k-mode detection, component decomposition, bimodality strength quantification, and excess mass estimation. Validation against twelve benchmark cases spanning separation regimes, unequal variances, unequal weights, and small sample sizes shows stable estimates for clearly separated cases and expected instability for boundary cases. Performance benchmarks show critband is typically 3-10 times faster per case than R's modetest() in the tested setup.

Suggested Citation

  • Ruiyu Zhang & Qihao Wang, 2026. "critband: A Python Package for Critical Bandwidth Analysis of Multimodal Distributions," Papers 2605.18686, arXiv.org, revised May 2026.
  • Handle: RePEc:arx:papers:2605.18686
    as

    Download full text from publisher

    File URL: https://arxiv.org/pdf/2605.18686
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Esteban, Joan & Ray, Debraj, 1994. "On the Measurement of Polarization," Econometrica, Econometric Society, vol. 62(4), pages 819-851, July.
    2. Charles R. Harris & K. Jarrod Millman & Stéfan J. Walt & Ralf Gommers & Pauli Virtanen & David Cournapeau & Eric Wieser & Julian Taylor & Sebastian Berg & Nathaniel J. Smith & Robert Kern & Matti Picu, 2020. "Array programming with NumPy," Nature, Nature, vol. 585(7825), pages 357-362, September.
    3. P. M. Hartigan, 1985. "Computation of the Dip Statistic to Test for Unimodality," Journal of the Royal Statistical Society Series C, Royal Statistical Society, vol. 34(3), pages 320-325, November.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Gordon Anderson & Teng Wah Leo & Oliver Linton, 2010. "Making Inferences About Rich Country - Poor Country Convergence: The Polarization Trapezoid and Overlap measures," Working Papers tecipa-387, University of Toronto, Department of Economics.
    2. Jaume Ojer & David Cárcamo & Romualdo Pastor-Satorras & Michele Starnini, 2025. "Charting multidimensional ideological polarization across demographic groups in the USA," Nature Human Behaviour, Nature, vol. 9(10), pages 2027-2037, October.
    3. Leopoldo Fergusson & Carlos Molina, 2020. "Facebook Causes Protests," HiCN Working Papers 323, Households in Conflict Network.
    4. Tan Wang & L. Jeff Hong, 2023. "Large-Scale Inventory Optimization: A Recurrent Neural Networks–Inspired Simulation Approach," INFORMS Journal on Computing, INFORMS, vol. 35(1), pages 196-215, January.
    5. Scott Rozelle & Yiran Xia & Dimitris Friesen & Bronson Vanderjack & Nourya Cohen, 2020. "Correction to: Moving Beyond Lewis: Employment and Wage Trends in China’s High- and Low-Skilled Industries and the Emergence of an Era of Polarization," Comparative Economic Studies, Palgrave Macmillan;Association for Comparative Economic Studies, vol. 62(4), pages 774-775, December.
    6. Klaus Desmet & Ignacio Ortuño-Ortín & Romain Wacziarg, 2009. "The political economy of ethnolinguistic cleavages," Working Papers 2009-17, Instituto Madrileño de Estudios Avanzados (IMDEA) Ciencias Sociales.
    7. Geeraert, Joke & Rocha, Luis E.C. & Vandeviver, Christophe, 2024. "The impact of violent behavior on co-offender selection: Evidence of behavioral homophily," Journal of Criminal Justice, Elsevier, vol. 94(C).
    8. Léon Faure & Bastien Mollet & Wolfram Liebermeister & Jean-Loup Faulon, 2023. "A neural-mechanistic hybrid approach improving the predictive power of genome-scale metabolic models," Nature Communications, Nature, vol. 14(1), pages 1-14, December.
    9. Claudia Quinteros-Cartaya & Guillermo Solorio-Magaña & Francisco Javier Núñez-Cornú & Felipe de Jesús Escalona-Alcázar & Diana Núñez, 2023. "Microearthquakes in the Guadalajara Metropolitan Zone, Mexico: evidence from buried active faults in Tesistán Valley, Zapopan," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 116(3), pages 2797-2818, April.
    10. Dev, Pritha, 2014. "Identity and fragmentation in networks," Mathematical Social Sciences, Elsevier, vol. 71(C), pages 86-100.
    11. repec:plo:pone00:0179604 is not listed on IDEAS
    12. Furqan Dar & Samuel R. Cohen & Diana M. Mitrea & Aaron H. Phillips & Gergely Nagy & Wellington C. Leite & Christopher B. Stanley & Jeong-Mo Choi & Richard W. Kriwacki & Rohit V. Pappu, 2024. "Biomolecular condensates form spatially inhomogeneous network fluids," Nature Communications, Nature, vol. 15(1), pages 1-17, December.
    13. Chacón, José E. & Fernández Serrano, Javier, 2024. "Bayesian taut splines for estimating the number of modes," Computational Statistics & Data Analysis, Elsevier, vol. 196(C).
    14. Matija Kovacic & Claudio Zoli, 2021. "Ethnic distribution, effective power and conflict," Social Choice and Welfare, Springer;The Society for Social Choice and Welfare, vol. 57(2), pages 257-299, August.
    15. Philipp Fey & Daniel Ludwig Weber & Jannik Stebani & Philipp Mörchel & Peter Jakob & Jan Hansmann & Karl-Heinz Hiller & Daniel Haddad, 2023. "Non-destructive classification of unlabeled cells: Combining an automated benchtop magnetic resonance scanner and artificial intelligence," PLOS Computational Biology, Public Library of Science, vol. 19(2), pages 1-31, February.
    16. Nina Tiel & Fabian Fopp & Philipp Brun & Johan Hoogen & Dirk Nikolaus Karger & Cecilia M. Casadei & Lisha Lyu & Devis Tuia & Niklaus E. Zimmermann & Thomas W. Crowther & Loïc Pellissier, 2024. "Regional uniqueness of tree species composition and response to forest loss and climate change," Nature Communications, Nature, vol. 15(1), pages 1-12, December.
    17. Janus, Thorsten & Riera-Crichton, Daniel, 2015. "Economic shocks, civil war and ethnicity," Journal of Development Economics, Elsevier, vol. 115(C), pages 32-44.
    18. Teixidó-Figueras, J. & Duro, J.A., 2014. "Spatial Polarization of the Ecological Footprint Distribution," Ecological Economics, Elsevier, vol. 104(C), pages 93-106.
    19. Liu, Shen & Maharaj, Elizabeth Ann & Inder, Brett, 2014. "Polarization of forecast densities: A new approach to time series classification," Computational Statistics & Data Analysis, Elsevier, vol. 70(C), pages 345-361.
    20. James Mitchell & Aubrey Poon & Dan Zhu, 2024. "Constructing density forecasts from quantile regressions: Multimodality in macrofinancial dynamics," Journal of Applied Econometrics, John Wiley & Sons, Ltd., vol. 39(5), pages 790-812, August.
    21. López Pérez, Mario & Mansilla Corona, Ricardo, 2022. "Ordinal synchronization and typical states in high-frequency digital markets," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 598(C).

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:arx:papers:2605.18686. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: arXiv administrators (email available below). General contact details of provider: https://arxiv.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.