--- id: diptest version: "0.11.0" license: GPLv2+ license_treatment: copyleft maintenance: active --- # diptest — Hartigan's diptest. License: copyleft · Maintenance: active · Downloads: 193.0K/mo ## What it is and what it does diptest is a Python/C++ implementation of Hartigan & Hartigan's statistical test for unimodality. It computes a dip statistic that measures the maximum vertical distance between an empirical cumulative distribution function and the best-fitting unimodal distribution, making no assumptions about the null distribution's form beyond unimodality. The package exposes two main functions: `dipstat` computes only the dip statistic, while `diptest` returns both the statistic and a p-value. P-values can be computed via interpolation of a critical value table (default, fast) or by bootstrapping the null hypothesis (slower but more accurate for non-standard cases). Bootstrapping supports optional OpenMP-based parallelization for speed. Use it for: - Test whether a univariate sample is unimodal or contains multiple modes, useful in exploratory data analysis. - Detect bimodality or multimodality in biological measurements, particle size distributions, or other empirical samples. - Validate assumptions in statistical modeling pipelines that require unimodal data. - Compare modality across groups or conditions by computing dip statistics for each sample. - Perform hypothesis testing on the null hypothesis of unimodality without assuming a specific parametric form. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Computes Hartigan's dip test statistic and p-value to detect multimodality in a sample, measuring how far an empirical distribution deviates from unimodality. Yes, if you need to test for unimodality in univariate samples. The package is actively maintained, has no known vulnerabilities, installs easily on modern Python versions via pre-built wheels, and implements a well-established statistical test. Copyleft licensing is a consideration only if you plan to redistribute modified code; using it as a library in a proprietary application is permissible. Medium install friction is negligible for most users thanks to wheel availability. ## Install pip install diptest uv add diptest poetry add diptest ## Installing diptest Before you install: Medium install friction due to compiled C++ extension with optional OpenMP parallelization. Pre-built wheels are available for Python 3.8–3.14 on Windows, Linux, and macOS (both x86_64 and ARM64), so most users will install without compilation. Building from source requires a compatible C/C++ compiler. License in practice: Licensed under GPLv2+, a copyleft license. Any derivative work or modification must be distributed under the same or compatible GPL terms; proprietary or closed-source projects incorporating this code must comply with GPL obligations. Quickstart: import numpy as np import diptest x = np.random.normal(0, 1, 1000) dip, pval = diptest.diptest(x) Requires numpy and psutil as runtime dependencies; Python >= 3.8. Verify before relying: - Whether the package's performance characteristics (compute and memory intensity for N > 1e5) are acceptable for your typical sample sizes. - Whether OpenMP bundling in pre-built wheels causes conflicts with other OpenMP-linked libraries in your environment. ## Package facts - License: GPLv2+ (copyleft) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 193.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dip test unimodality, multimodality detection, hartigan dip statistic, statistical distribution testing, bimodality hypothesis test, empirical distribution analysis, sample modality assessment, statistical-testing, distribution-analysis [View on SkillFed](https://skillfed.io/packages/diptest) · [View on PyPI](https://pypi.org/project/diptest/)