statsjunk¶
A collection of statistical odds and ends.
Framework-free Python functions for common statistical tasks — correlation, regression,
spatial autocorrelation, electoral fragmentation indices, and prediction-model sample size
calculations. Every function takes plain arrays and returns a typed
Pydantic result model; invalid input raises ValueError rather
than failing silently or returning NaN.
Where to go next¶
- Installation — one
pip install, no optional extras - Quick Start — run a correlation and a sample-size calculation in a few lines
- API Reference — every public function and class, with the paper it implements
Modules¶
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.
| Module | Description |
|---|---|
correlation |
Pearson and Spearman correlation with confidence intervals, plus the shared Fisher z-transformation |
regression |
Simple and multiple linear regression, with standardized coefficients and VIFs |
spatial |
Global Moran's I spatial autocorrelation |
elections |
Laakso-Taagepera effective number of parties/candidates |
samplesize |
Minimum sample size for continuous, binary, and survival prediction models (a Python port of R's pmsampsize) |