star-quantile 0.1.0
Median, quantiles, IQR and MAD, correctly rounded
Public state: Released & Verified. The registry label is RELEASED. What the states mean →
Apache-2.0 Released & Verified single file
Summary
Median, Hyndman-Fan type 7 quantile, interquartile range and median absolute deviation computed exactly in rational arithmetic and rounded once; on 500 datasets (2000 values) every value is identical to the exact rational value from SymPy, and NumPy, SciPy and CPython statistics agree within 7e-16 of the largest value.
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 52 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:
- Install file · star_quantile-0.1.0-py3-none-any.whl 3 kB
- Single file — copy it alongside your code · star_quantile.py 3 kB
- Source code (.zip) 19 kB
python -m pip install star_quantile-0.1.0-py3-none-any.whlIn Python: import star_quantile
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_quantile_0_1_0,
author = {Cavazzini, Andrea},
title = {{star-quantile}: Median, quantiles, IQR and MAD, correctly rounded},
version = {0.1.0},
year = {2026},
url = {https://andrea07072000.github.io/S.T.A.R.-/software/star_quantile/},
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-quantile @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_quantile"
Technical sheet
Requirements
- R1
quantile(values, q)is definition 7 of Hyndman and Fan (linear interpolation between order statistics at position (n - 1) q), the default of R and NumPy;medianis the 0.5 quantile;iqris the 0.75 quantile minus the 0.25 quantile;madis the median of the absolute deviations from the median, not scaled. - R2 Each result is the float nearest to the exact value of its definition on the numbers given (q included, as the exact value of its float); the order of the values does not matter.
- R3 Measured on 500 datasets of 1 to 60 values (2000 values): every value identical to the exact rational value (SymPy) rounded once; NumPy, SciPy and CPython's
statisticswithin 7e-16 of the largest |value|. - 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), q outside [0, 1] or not a finite number.
Limits (what is not claimed)
One quantile definition out of the nine in use: results differ from packages that default to another one, and the module does not offer the others. The MAD is returned unscaled (multiply by 1.4826 to estimate a Gaussian standard deviation: that factor is an assumption about the data, not applied here). No weighted quantiles, no confidence intervals, no streaming estimate. "Exact" refers to the floats supplied.
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_quantile.py 0.974 (2026-10-07)
- Independent implementations written by others (needs 2)
- CPython statistics, numpy.median / numpy.quantile, scipy.stats (iqr, median_abs_deviation, scoreatpercentile)
- Also compared with, not counted
- S.T.A.R.'s own re-derivations: SymPy exact rationals
- Result
- Released & Verified
Evidence in the registry
| Check | Status | Recorded | What was observed |
|---|---|---|---|
| Unit tests | VERIFIED | 2026-10-07 | 52 passed in 0.79s |
| Review | VERIFIED | 2026-10-07 | Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed |
| Review | VERIFIED | 2026-10-07 | Re-running the cross-check gives a byte-identical evidence file |
| Reference value | VERIFIED | 2026-10-07 | median = 2.0, mad = 1.0; quantile([1, 2, 3, 4, 5], 0.25) = 2.0, quantile(..., 0.75) = 4.0 (suite: 52 passed in 0.79s) |
| Cross-check with independent libraries | VERIFIED | 2026-10-07 | star_quantile returns the median, the type 7 quantile, the interquartile range and the median absolute deviation as the exact value of the definition rounded once |
| Benchmark | VERIFIED | 2026-10-07 | values not identical to the exact one: 0 of 2000 |
| Clean install from the release tag | VERIFIED | 2026-10-07 | pytest outside the tree: 52 passed in 0.54s |
Fingerprints (SHA-256)
| star_quantile-0.1.0-py3-none-any.whl | bc33d37868f778300a601ede31e847e09d75096e2c7a5e566efbeafe48da7375 |
| star_quantile.py | 641b34712e9e935080c7bfa12e6618dacd740a18ad2bad9c080b830da6c0ea13 |
| star_quantile-0.1.0-source.zip | a68cef4a17cd4b1ed8a52283e90e88bebc1caa3f520a61c3374c0c22f683db30 |
