← All packages

Numerics & statistics

star-stats 0.1.0

Summary statistics, correctly rounded

Public state: Released & Verified. The registry label is RELEASED. What the states mean →

Apache-2.0 Released & Verified single file

Summary

Mean, sample and population variance and standard deviation, root mean square and weighted mean computed exactly in rational arithmetic and rounded once, independent of the order of the values; on 500 datasets all seven statistics are identical to mpmath at 400 digits rounded once and to CPython's statistics module where it has them; reproduces the NIST NumAcc1 and NumAcc2 reference datasets.

Run in your browser

Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).

Runs in the browser: all 43 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026. Open it in the Workspace →

Use it on your computer

No account and no GitHub needed. Download, then install with one command:

python -m pip install star_stats-0.1.0-py3-none-any.whl

In Python: import star_stats

Get started →

Cite it, and its bill of materials

For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.

@software{cavazzini_star_stats_0_1_0,
  author  = {Cavazzini, Andrea},
  title   = {{star-stats}: Summary statistics, correctly rounded},
  version = {0.1.0},
  year    = {2026},
  url     = {https://andrea07072000.github.io/S.T.A.R.-/software/star_stats/},
  note    = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}

For developers

Install directly from the public repository:

python -m pip install "star-stats @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_stats"

README · tests · evidence (GitHub)

Technical sheet

Package
star-stats
Import name
star_stats
Version
0.1.0
Licence
Apache-2.0
Python
>=3.9
Dependencies
none (standard library only)
Capability
star.statistics.exact-summary
Maturity
Released & Verified (RELEASED)
Published commit
dc09f61d

Requirements

  • R1 mean, variance, stdev, rms and weighted_mean return the float nearest to the exact value of their formula applied to the numbers given (a float is an exact fraction). The result does not depend on the order of the values.
  • R2 variance and stdev are the sample statistics (divisor n - 1) by default and the population statistics with sample=False. Square roots are rounded correctly from the exact fraction, with no underflow or overflow of the squares.
  • R3 Measured on 500 datasets of 2 to 60 values (mixed magnitudes, large offsets, equal values, integers): all seven statistics are identical to mpmath at 400 digits rounded once, and to CPython's statistics module where it has them; NumPy and SciPy differ by at most 5e-16 of the natural scale, which is their own rounding.
  • R4 Every function returns a float or raises ValueError: data that are not a list or tuple of 1 to 100000 finite numbers within 1e150 (booleans refused), a sample statistic of a single value, a sample that is not a bool, weights that are negative, all zero, not finite or of another length.

Limits (what is not claimed)

"Exact" refers to the floats supplied: 0.1 is not one tenth, and the statistics of measurements carry the error of the measurements, which no arithmetic removes. On Python 3.12 the standard statistics module returns the same mean, variance and standard deviation: this package adds the root mean square, the exact weighted mean, the stated limits and refusals, and the independent check. Exact arithmetic is slower than floating point (about one second for 100000 values): it is for results that must not depend on rounding, not for large arrays. No medians, quantiles, covariance, regression or uncertainty of the estimates.

Release gate

Computed by the registry from the result files, with the same function that decides RELEASED.

Mutation score, latest measure of each module (needs at least 0.850)
  • star_stats.py 0.914 (2026-10-07)
Independent implementations written by others (needs 2)
CPython statistics module, numpy, scipy.stats
Also compared with, not counted
S.T.A.R.'s own re-derivations: mpmath at 400 digits
Result
Released & Verified

Evidence in the registry

CheckStatusRecordedWhat was observed
Clean install from the release tagVERIFIED2026-10-07pytest outside the tree: 43 passed in 0.54s
Unit testsVERIFIED2026-10-0743 passed in 0.76s
ReviewVERIFIED2026-10-07Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed
ReviewVERIFIED2026-10-07Re-running the cross-check gives a byte-identical evidence file
Reference valueVERIFIED2026-10-07mean = 1.2 and stdev = 0.09999999999999998 (the exact statistic of the floats 1.1, 1.2, 1.3); mean = 10000002.0 and stdev = 1.0 (suite: 43 passed in 0.76s)
Cross-check with independent librariesVERIFIED2026-10-07star_stats returns the mean, variance, standard deviation, RMS and weighted mean as the exact value of the formula rounded once to a float
BenchmarkVERIFIED2026-10-07results not identical to the 400-digit value: 0 of 3500

Fingerprints (SHA-256)

star_stats-0.1.0-py3-none-any.whld8c137e4b86d8a853989765e6081acbc90ac9ce42ed890d85fec532b465c3260
star_stats.pycbad713fea7ac0eccf083983e327a045b06c966b1867b4eb91730b00172176e6
star_stats-0.1.0-source.zip26841d1beebde37cb87767dfc8d4dd6e2a155cad57e30bc4f00ca36d326fa26b

results