assumpcheck
assumpcheck is a small Python package for checking core assumptions for:
- ANOVA
- Linear regression
- Logistic regression
The package is designed to stay simple:
- concise terminal output by default
- plots only when they matter
- mitigation suggestions when something fails
- optional structured output for programmatic use
Installation
pip install assumpcheck
The package currently depends on:
numpypandasscipystatsmodelsmatplotlib
Public API
from assumpcheck import (
check_anova,
check_linear_regression,
check_logistic_regression,
)
ANOVA
report = check_anova(y=y, groups=groups)
Linear regression
report = check_linear_regression(model=fitted_ols_model)
Logistic regression
report = check_logistic_regression(model=fitted_logit_model)
Quickstart
import numpy as np
import pandas as pd
from assumpcheck import check_linear_regression
rng = np.random.default_rng(27)
X = pd.DataFrame(
{
"x1": rng.normal(size=35),
"x2": rng.normal(size=35),
}
)
y = 1.0 + 1.8 * X["x1"] - 0.6 * X["x2"] + rng.normal(scale=0.35, size=35)
report = check_linear_regression(
X=X,
y=y,
design_independent=True,
plots_on_fail=False,
)
Typical output looks like:
LINEAR REGRESSION ASSUMPTION CHECKS
[PASS] Linearity
[PASS] Independence
[PASS] Normality of residuals
[PASS] Homoscedasticity
[PASS] Multicollinearity
[WARN] Extreme influential points
Summary: 5 pass, 1 warn
Example output
ANOVA ASSUMPTION CHECKS
[INFO] Independence
[PASS] Normality of residuals
[PASS] Equal variance across groups
[FAIL] Extreme outliers
Summary: 2 pass, 1 fail, 1 info
Details:
- Extreme outliers [FAIL]
Metric: Max |standardized residual| = 3.420; flagged points > 3: 1
Threshold: Values above 2 deserve review and values above 3 are concerning.
Interpretation: At least one observation has a standardized residual above the common concern threshold.
Possible mitigation:
- Verify data entry for flagged cases.
- Check whether the observation is legitimate but unusual.
- Consider a transformation, robust method, or nonparametric alternative if outliers remain influential.
Options
All three public functions support these core options:
alpha=0.05show_all=Falseplots_on_fail=Trueverbose=Falsereturn_dict=Falsedesign_independent=None
Additional model-specific option:
check_linear_regression(..., ordered=False)
Output behavior
Default behavior:
- prints a concise summary
- shows plots for failed or warning-level checks if
plots_on_fail=True - returns an
AssumptionReportobject
Optional behavior:
verbose=Trueprints detail for every checkshow_all=Trueprints all details and shows all available plotsreturn_dict=Truereturns a serializable dictionary
Independence handling
By default, independence is treated as a design question:
design_independent=Nonegives anINFOresultdesign_independent=Truegives aPASSunless an ordered linear model also shows autocorrelation warningsdesign_independent=Falsegives aFAIL
Current checks
ANOVA
- Independence
- Normality of residuals
- Equal variance across groups
- Extreme outliers
Linear regression
- Linearity
- Independence
- Normality of residuals
- Homoscedasticity
- Multicollinearity
- Extreme influential points
Logistic regression
- Linearity in the log-odds
- Independence
- Multicollinearity
- Extreme influential points
- Adequate sample / no separation
- Model fit summary via ROC / AUC
Notes on the MVP
- The package prioritizes
statsmodelsmodels first. - Thresholds are intentionally presented as heuristics.
- Logistic ROC / AUC is treated as a fit diagnostic, not a strict assumption.
- Some diagnostics need access to original data or design metadata to be fully informative.
- The current influence heuristics are intentionally conservative, so clean linear or logistic examples may still emit a
WARN.
Examples
- Script:
examples/basic_usage.py - Notebook:
examples/assumpcheck_examples.ipynb
To rebuild the executed notebook and example plot assets:
python examples/build_workflow_artifacts.py
Tests
Run the test suite with:
python -m pytest -q
Release Process
For the first public release to TestPyPI and PyPI using GitHub Trusted Publishing,
see RELEASING.md.
Metadata
Release files for assumpcheck 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| assumpcheck-0.1.3.tar.gz | 20.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| assumpcheck-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.3 kB
Release files / assumpcheck-0.1.3.tar.gz
| Download URL | assumpcheck-0.1.3.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9965990c8744c91778fd92b17af2e89ab758f389ad32c5cf96e10282d0d94b9
|
|
BLAKE2b-256 checksum How to use checksums |
513b05d325d9e2008fec35f10bc1bee08f6e5c3e31a404214d252338148ad5c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.10
|
Release files / assumpcheck-0.1.3-py3-none-any.whl
| Download URL | assumpcheck-0.1.3-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1cdc1e565beabc16565a7efddb8a93517a18ee764da8fa672a40cb6d1100ada
|
|
BLAKE2b-256 checksum How to use checksums |
7e37cf6e9cc7e9651f9eba49872653b721aba7a4605911d95c90e54be88ef568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.10
|
Security for assumpcheck 0.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.