statsjunk
A collection of statistical odds and ends.
Framework-free Python functions for common statistical tasks — correlation, regression,
spatial autocorrelation, electoral fragmentation indices, and (soon) sample size
calculations. Every function takes plain arrays and returns a typed Pydantic
result model; invalid input raises ValueError rather than failing silently.
Installing
pip install statsjunk
Usage
from statsjunk import compute_pearson_correlation
result = compute_pearson_correlation([1, 2, 3, 4], [2, 4, 6, 8])
print(result.r, result.pvalue)
What's here
One folder per statistical domain, one module per technique inside it. Everything is also
re-exported from the top-level statsjunk package, so from statsjunk import compute_pearson_correlation
always works regardless of where a function actually lives.
correlation—pearson: Pearson correlation, with confidence intervals, and a summary-statistics variant (r,n) for when the raw arrays aren't available.spearman: rank correlation, for monotonic-but-not-linear relationships or data with outliers.fisher: the Fisher z-transformation used internally by both, also usable standalone.regression—simple: simple linear regression with slope diagnostics.multiple: ordinary least squares multiple linear regression, with standardized coefficients and variance inflation factors.spatial—morans_i: global Moran's I spatial autocorrelation.elections—laakso_taagepera: effective number of parties/candidates.samplesize— a Python port ofpmsampsize(binary,continuous,survival), for minimum sample size calculations when developing a prediction model (Riley et al. 2019, 2020).
Developing
uv sync --dev
uv run pytest
uv run ruff check .
uv run ruff format .
Metadata
Release files for statsjunk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| statsjunk-0.1.0.tar.gz | 93.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| statsjunk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.5 kB
Release files / statsjunk-0.1.0.tar.gz
| Download URL | statsjunk-0.1.0.tar.gz |
|---|---|
| Size | 93.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d920e0dade54256d7cbaf09c3271bce4a72e25009f8bc43017661ce232d5926
|
|
BLAKE2b-256 checksum How to use checksums |
d62a2661e36c002d6011058bf91601ebbae40c17c1b27b22b61c559a090e160f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / statsjunk-0.1.0-py3-none-any.whl
| Download URL | statsjunk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35b21eb303d4179f45729780a08679c490d9167a493eaecb464f1423e9d80533
|
|
BLAKE2b-256 checksum How to use checksums |
9436270d4fe33186bfd09a26e96b9e00d2555ea7f265a49c682f94f829ccf5f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log