Skip to main content
QUICK REVIEW

[Paper Review] hyppo: A Multivariate Hypothesis Testing Python Package

Sambit Panda, Satish Palaniappan|arXiv (Cornell University)|Jul 3, 2019
Metabolomics and Mass Spectrometry StudiesBiochemistry, Genetics and Molecular Biology69 references8 citations
TL;DR

hyppo is a unified, high-performance Python library for multivariate hypothesis testing, offering state-of-the-art independence, two-sample, and k-sample tests with consistent, scikit-learn-inspired APIs. It enables efficient, accurate testing on high-dimensional and nonlinear data, with benchmarked performance matching or exceeding R implementations and support for fast, parallelized permutation tests via Numba and joblib.

ABSTRACT

We introduce hyppo, a unified library for performing multivariate hypothesis testing, including independence, two-sample, and k-sample testing. While many multivariate independence tests have R packages available, the interfaces are inconsistent and most are not available in Python. hyppo includes many state of the art multivariate testing procedures. The package is easy-to-use and is flexible enough to enable future extensions. The documentation and all releases are available at https://hyppo.neurodata.io.

Motivation & Objective

  • To address the lack of consistent, accessible, and efficient multivariate hypothesis testing tools in Python, especially for nonlinear and high-dimensional data.
  • To unify and implement state-of-the-art nonparametric multivariate tests—such as distance correlation, Mgc, Hsic, and energy-based methods—into a single, extensible Python package.
  • To provide a library with consistent, scikit-learn-like interfaces that are easy to use and extend, supporting both standard and novel statistical tests.
  • To benchmark the performance and accuracy of hyppo’s implementations against established R packages, ensuring statistical equivalence and computational efficiency.
  • To enable reproducible, scalable, and parallelized hypothesis testing through integration with joblib and Numba for JIT compilation and caching.

Proposed method

  • Design a modular library architecture with distinct modules: independence, ksample, discrim, time_series, and tools, each housing specific test types.
  • Implement core test statistics—including Dcorr, Hsic, Mgc, Hhg, Mmd, Energy, Disco, and MaxMargin—using both biased and unbiased estimators, with support for fast approximations.
  • Use Numba’s JIT compilation to accelerate test statistic computation and cache results for repeated use, significantly improving performance.
  • Enable parallelized permutation testing via joblib to efficiently compute p-values across multiple cores.
  • Formulate k-sample tests by reducing them to independence testing problems, leveraging recent theoretical advances (e.g., Shen et al. [28]).
  • Integrate and wrap existing high-performance implementations (e.g., Mgc from scipy.stats) while maintaining API consistency and extensibility.

Experimental results

Research questions

  • RQ1Can a unified, user-friendly Python library be built to support a broad range of multivariate hypothesis tests with consistent interfaces?
  • RQ2How do the computational performance and statistical accuracy of hyppo’s implementations compare to established R packages like energy, kernlab, and HHG?
  • RQ3To what extent can fast approximations (e.g., Fast Dcorr) and JIT compilation with Numba improve runtime efficiency without sacrificing accuracy?
  • RQ4Can k-sample tests be effectively unified under the independence testing framework using modern statistical reductions?
  • RQ5How well do hyppo’s novel implementations (e.g., Kmerf, MaxMargin, time-series Mgc) perform in terms of statistical power and speed across diverse data models?

Key findings

  • hyppo’s implementations of Dcorr, Mmd, and Hhg produce test statistics that are nearly identical to their R counterparts, confirming numerical equivalence across 20 repetitions on a spiral simulation.
  • Fast Dcorr in hyppo is the fastest implementation across all tested sample sizes, outperforming both R’s energy and kernlab packages even with highly optimized C++ backends.
  • For sample sizes above a few hundred, all algorithms scale approximately quadratically, with Mgc and Dcorr requiring tens of minutes to process 10,000 samples.
  • The Hhg test is the slowest due to its computational complexity, but remains competitive at low sample sizes.
  • hyppo’s use of Numba JIT compilation and joblib parallelization enables significant speedups, especially for permutation-based p-value estimation.
  • The library successfully wraps and extends high-impact methods like Mgc (now in scipy.stats), ensuring compatibility and performance across diverse scientific workloads.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.