Overview
statsx covers intervals, Bayesian updates, tests, sequential tests, experiment design, model
comparison and forecasting of count series. Each method has a methods page with the model, the
formulas and what it assumes. Part of the numerical code is a Rust extension inside the wheel,
and NumPy is the only dependency.
Status: beta.
Install
pip install statsx
Requires Python 3.12 or newer. NumPy is the only run-time dependency.
Quickstart
An interval for a proportion, 7 successes in 40 trials:
from statsx.proportion import proportion_interval
result = proportion_interval(7, 40, method="wilson")
print(result.estimate)
print(result.interval)
print(result.n)
print(result.assumption)
0.175
Interval(lower=0.0874541374603592, upper=0.3194999033178771, level=0.95)
40
independent trials with one success probability; Wilson score interval
A function that returns an Estimate, such as this one, gives the estimate, the interval, the
sample size and an assumption field. Fitted models (fit_trend, fit_bradley_terry) and
functions that return a bare Interval do not have that field: their methods pages state what
they assume.
What it does
Not sure where to start? Read
Which method do I use?.
Each method follows a published paper, and its module docstring lists the references. The
methods pages state the model,
the formulas and the guarantee.
Of the 31 method modules, 19 import the Rust extension statsx._accel, 6 import it through
another statsx module, and 6 are Python and NumPy only (allocation, alwaysvalid,
groupsequential, identify, multiple, rating).
- Forecasting: trend with forecast and anomalies, causal impact, rolling-origin backtest.
- Duration models: estimated time to finish, from past durations and from progress.
- Intervals: proportions, bootstrap (percentile, basic, BCa), effect sizes, credible intervals.
- Bayes: conjugate updates, lognormal prior from an expert interval, P(A > B).
- Tests: multiple testing, equivalence (TOST), paired tests, agreement (kappa, alpha).
- Decisions: Monte Carlo cost, expected value of information, break-even.
- Calibration: reliability, Brier decomposition, Platt scaling, isotonic regression.
- Design: power, sample size, minimum detectable effect, group sequential bounds.
- Sequential: confidence sequences, e-values, Thompson sampling, best-arm identification.
- Distributions: fits from sufficient statistics, goodness of fit at an effective sample size.
- Model comparison: Rasch abilities of models on shared tasks, token ratios, cost per pass.
- Ranking: Bradley-Terry with ties, a fit per judge, Elo, Glicko-2.
- Drift: Kolmogorov-Smirnov, MMD, classifier two-sample test, PSI.
- MCMC checks: convergence, effective sample size, Monte Carlo standard error, simulation-based
calibration.
Links
Contributing
Developer setup, the dev loop and the release process are in
CONTRIBUTING.md.
In short: uv sync && make install-hooks, then make check runs lint, format check, typecheck
and tests.
License
MIT © 2026 Jorge Cardona (see LICENSE).