Skip to main content

stat-guard

stat-guard is a production-grade statistical assumption validation library for experiments such as A/B tests and controlled studies.

It acts as a guardrail, validating data integrity and statistical assumptions before any analysis is performed.

If stat-guard fails, the experiment must not be analyzed.


🚦 Why stat-guard exists

Most statistical failures do not come from incorrect formulas.
They come from broken data and violated assumptions:

  • Duplicate users counted multiple times
  • Users appearing in both control and treatment
  • Samples too small to be meaningful
  • Imbalanced or biased groups
  • Metrics with zero variance
  • Silent assumption violations in production pipelines

These issues often surface after results are shipped.

stat-guard prevents that.


🧠 What stat-guard does

  • Validates unit integrity (missing IDs, duplicates, leakage)
  • Checks minimum sample size
  • Detects group imbalance
  • Measures covariate balance (SMD)
  • Flags zero-variance metrics
  • Diagnoses distribution issues (skewness, normality)
  • Separates errors (blocking) from warnings (diagnostic)
  • Produces deterministic, machine-readable reports

Designed for:

  • CI/CD pipelines
  • Experiment gating systems
  • Production data workflows

🚫 What stat-guard does NOT do

stat-guard is not a statistics engine.

It deliberately does not:

  • ❌ Run hypothesis tests
  • ❌ Modify or auto-fix data
  • ❌ Apply transformations
  • ❌ Guess intent or apply heuristics

This keeps behavior explicit, transparent, and reproducible.


🧱 Core Philosophy

  • Explicit over implicit
  • No automatic corrections
  • Errors invalidate experiments; warnings do not
  • Deterministic, reproducible behavior
  • Production-first, not notebook-first
  • Simple, readable, maintainable code

📦 Installation

From GitHub (current)

stat-guard is currently distributed via GitHub:

pip install git+https://github.com/aaryansolankii/stat-guard.git

## 🚀 Quick example

```python
import pandas as pd
from stat_guard import validate

data = pd.DataFrame({
    "metric": [10, 12, 11, 13, 15, 14],
    "group": ["control", "control", "control", "treatment", "treatment", "treatment"]
})

report = validate(
    data,
    target_col="metric",
    group_col="group"
)

if not report.is_valid:
    raise RuntimeError(report)

Metadata

Release files for stat-guard 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stat-guard 0.2.0
File Size Uploaded Provenance Actions
stat_guard-0.2.0.tar.gz 10.8 kB Without provenance Details for stat_guard-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stat-guard 0.2.0
File Interpreter ABI Platform Actions
stat_guard-0.2.0-py3-none-any.whl Python 3 none any Details for stat_guard-0.2.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / stat_guard-0.2.0.tar.gz

Download URL stat_guard-0.2.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95e33b6ca2569e745ccbd989acb0802f1eaf1270568c52847bb0e2a5028f9ee7
BLAKE2b-256 checksum
How to use checksums
286e2eab1e91a8bc4915b49fc37cd7f6a1a9b9277f58d3a5796e6ceece30d3c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / stat_guard-0.2.0-py3-none-any.whl

Download URL stat_guard-0.2.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c8eb5f617bb9da6dc35950dc814a5c5486e0c4692dde6c470991bab4dba4772
BLAKE2b-256 checksum
How to use checksums
0792dfd7be52f66619fac3985ad71b606ed8477bda21c3f80fc801f873265e7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for stat-guard 0.2.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page