momentchi2
A collection of methods for computing the cdf of a weighted sum of chi-squared random variables.
What it is and what it does
momentchi2 provides four statistical approximation methods for computing the cumulative distribution function (CDF) of a weighted sum of chi-squared random variables. This is a specialized numerical problem in statistics where exact computation is expensive; the package trades exact accuracy for speed using moment-matching techniques. The four methods—Hall-Buckley-Eagleson, Satterthwaite-Welch, Wood's F, and Lindsay-Pilla-Basak—each have different strengths: Hall-Buckley-Eagleson is recommended for larger coefficient sets (over 100), while Lindsay-Pilla-Basak works better for smaller sets (up to 10). The package wraps scipy and numpy to deliver these approximations.
You call one of the four functions with a coefficient vector and quantile value(s), and it returns the approximate CDF. Input can be a scalar, list, or numpy array; output format matches input format. The Lindsay-Pilla-Basak method accepts a tunable parameter p (default 4) to trade accuracy for speed. The package is a Python port of the R package momentchi2 and is intended for researchers and practitioners who need fast, reasonably accurate CDF approximations rather than exact solutions.
Use it for:
- Approximate CDF of weighted chi-squared sums in statistical hypothesis testing or variance component estimation.
- Fast numerical approximation in simulation studies where exact computation would be prohibitively slow.
- Selecting among four moment-matching methods based on the size of your coefficient vector and accuracy requirements.
- Batch evaluation of CDF at multiple quantile points using numpy arrays for vectorized performance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes the cumulative distribution function of a weighted sum of chi-squared random variables using four moment-matching approximation methods: Hall-Buckley-Eagleson, Satterthwaite-Welch, Wood's F, and Lindsay-Pilla-Basak.
Yes, if you need a fast approximate CDF for weighted chi-squared sums and can tolerate two to three decimal place accuracy. No, if you require exact results, active maintenance, or modern package support—the project is abandoned (last release 2021-08-27) and may have compatibility issues with current scipy/numpy versions. Suitable for research or one-off analysis, risky for production systems.
Install
momentchi2 on PyPI
pip
pip install momentchi2uv
uv add momentchi2poetry
poetry add momentchi2Installing momentchi2
Before you install
Low install friction with only numpy and scipy as dependencies. However, the package is abandoned—last release was 2021-08-27 with no updates since, so expect no maintenance or bug fixes.
License in practice
MIT license (permissive) means you can use, modify, and distribute the package freely with minimal restrictions, though you must include the license notice.
Quickstart
pip install momentchi2
from momentchi2 import hbe
import numpy as np
# Compute CDF for weighted chi-squared sum
result = hbe(np.array([1.5, 1.5, 0.5, 0.5]), np.array([0.627, 10.203]))
Requires Python 3.6 or later; numpy and scipy must be installed.
Verify before relying
- Whether the package's accuracy claims (two to three decimal places) hold for your specific use case and coefficient configuration.
- Current compatibility with modern scipy and numpy versions, given the package has not been updated since 2021.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — scipy, numpy |
| Maintenance | abandoned — 1,813 days since the last release |
| First released | |
| Downloads | 276,649/month — #8,161 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: momentchi2-0.1.8-py3-none-any.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
pytensor-distributionsPyTensor-distributions provides a collection of…
permissive · top 15,000 on PyPI
cody-specialProvides high-precision implementations of…
permissive · top 15,000 on PyPI
runstatsComputes summary statistics (mean, variance,…
permissive · top 15,000 on PyPI
forestciComputes confidence intervals and variance…
permissive · top 15,000 on PyPI
statisticsProvides basic mathematical statistics…
permissive · top 15,000 on PyPI
powershapPowershap performs feature selection by testing…
permissive · top 15,000 on PyPI
cemImplements Coarsened Exact Matching (CEM), a…
unclear · top 5,000 on PyPI
ipfnIterative proportional fitting algorithm that…
permissive · top 15,000 on PyPI