Skip to main content

StatClaim

Check that a statistical guarantee applies to your study.

StatClaim helps researchers make study assumptions explicit, catch incompatible analyses, and obtain machine-checked evidence for supported statistical claims.

Check Open in GitHub Codespaces

Why StatClaim?

A correctly computed p-value does not, by itself, establish that a method answers your intended question or that its error guarantee applies to your study design. Those connections still need justification.

For example, a study might test ten outcomes and declare a finding if any has p < 0.05. Every test can be calculated correctly, yet testing each outcome at the 5% level does not by itself establish a 5% false-positive bound for the study as a whole.

A test's 5% false-positive guarantee may also assume a fixed sample size and a single planned analysis. If a researcher repeatedly checks the data and stops when a result becomes significant, that guarantee does not automatically apply to the whole procedure. The calculations can be correct while the study's error-control claim still needs justification.

StatClaim connects the study, hypothesis, analysis and claim so it can:

  • Explain supported incompatibilities while you edit, before running an analysis.
  • Show, on request, why a declaration passed its checks and what it still assumes.
  • Check applicable mathematical guarantees using Lean's proof checker.
  • Reuse checked guarantees, with required assumptions and replayable evidence attached.

Alongside R and Python

Keep using R or Python for data preparation, modelling and visualization. StatClaim adds an explicit specification of the study and the guarantee you want to establish. Its small .stat notation gives the checker precise objects to reason about: models, hypotheses, analyses, claims and evidence.

Today, you write that specification separately. The preview does not inspect or certify existing R or Python scripts. The aim is to make statistical justification easier to inspect and reuse within a research workflow.

A small example

Declare a fixed-sample study, choose the equality null, and request a Type I error guarantee at a significance level of 1/20:

use models.two_arm_binomial
use sampling
use tests.fisher

let study = two_arm_binomial(n_control=100, n_treatment=100)
let plan = fixed(model=study)
let null = equal_proportions(model=study)
let analysis = fisher(design=plan, null=null, alpha=1/20)
let claim = typeI(analysis)
let verification = verify(claim)
let status = verification.status
let evidence = verification.evidence

Change the null to proportion_difference(model=study, value=1/10) and the editor explains why the current Fisher contract cannot support it. The guidance preserves your statistical question: changing the null to satisfy a method would change what you are asking.

While editing, StatClaim checks types, hypothesis compatibility and proof requirements. Verify Current File explicitly runs the requested operations and Lean checks. verification.evidence is present only after successful verification; a valid specification alone is not a proof.

What is supported

You want to Use Checked by Lean
Compare two proportions tests.fisher Type I error, exact p-value and decision; two-sided or one-sided
Show non-inferiority tests.difference Type I error over the whole null, power and decision
Test one proportion tests.binomial Type I error, exact p-value and decision
Estimate one proportion tests.binomial Coverage of the exact confidence interval
Estimate a difference estimation Coverage of a conservative interval
Test several endpoints multiplicity.bonferroni Familywise error, 2 to 20 endpoints
Choose a sample size planning Power, and the smallest size in a range
Stop early for futility designs.two_stage Type I error and power of the whole design, and the decision for observed data
Find a two-stage design designs.two_stage The selected optimal or minimax design

Some common tests are supported with a cited guarantee instead: StatClaim checks that your null and sampling plan fit the test, then lists the published guarantee and its assumptions. These are never reported as verified. Each result is verified, conditional or cited, and a file reports its weakest status.

You want to Use Guarantee
Compare two means tests.t Cited: pooled t-test (exact under normality) or Welch (large-sample)
Compare two survival curves tests.survival Cited: log-rank test (large-sample)
Combine proved and cited tests multiplicity.bonferroni Conditional: Lean checks the combination, the members are assumed
Plan interim looks designs.group_sequential Conditional: Lean checks the split of the error level across looks

See cited methods and evidence grades.

This is a 0.1 developer preview; the language and APIs may change. A checked claim holds under its stated assumptions. Whether a real study meets those assumptions is a scientific judgment. See scope and trust.

Plan a study

State the rates you expect and the power you need, then search for a sample size:

let alternative = binomial_rates(p_control=1/10, p_treatment=2/5)
let target = power_target(at=alternative, minimum=4/5, maximum_typeI=1/20)
let candidates = equal_arm_sizes(analysis=analysis, min_per_arm=2, max_per_arm=40)
let sizing = verify(smallest_sample_size(candidates=candidates, target=target))

The answer is 36 per arm. Lean recomputes the power of that design and checks that no smaller size in the range reaches the target. Two-stage designs with count or Bayesian posterior stopping rules are planned the same way. See planning a study.

Where we are going

Assurance and precision targets, more tests and designs, and richer Bayesian and adaptive designs. See the roadmap.

Try it

Open Codespaces above, wait for setup, then open playground/welcome.stat. The other files in playground/ show planning, single-arm and two-stage studies. Use StatClaim: Show Claims and StatClaim: Verify Current File in the command palette. Your GitHub account controls Codespaces quota and billing.

Locally, install uv, elan and Node.js 22 or newer:

make setup
uv run --locked statclaim compile examples/fisher.stat
uv run --locked statclaim check examples/fisher.stat
uv run --locked statclaim catalogue

See quickstart for VS Code and result inspection.

Then work through the tutorial: fourteen lessons, from a first checked claim to planning and analysing a study. Open the file in a browser; the lesson files are in examples/tutorial/.

Explore and contribute

Questions and proposals belong in Discussions; bugs and concrete tasks belong in Issues. MIT license.

Metadata

Release files for statclaim 0.1.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 statclaim 0.1.0
File Size Uploaded Provenance Actions
statclaim-0.1.0.tar.gz 289.9 kB With provenance Details for statclaim-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for statclaim 0.1.0
File Interpreter ABI Platform Actions
statclaim-0.1.0-py3-none-any.whl Python 3 none any Details for statclaim-0.1.0-py3-none-any.whl

Total release size: 427.0 kB

Release files / statclaim-0.1.0.tar.gz

Download URL statclaim-0.1.0.tar.gz
Size 289.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d86eaaf132702722b6234a7583c30c74fb03baa086e8cd050c1602f3a676b5b4
BLAKE2b-256 checksum
How to use checksums
f85a6bd401d23378bd3ed48801b054f4cea75996040cf3b4fe5aae4245ee1687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Release files / statclaim-0.1.0-py3-none-any.whl

Download URL statclaim-0.1.0-py3-none-any.whl
Size 137.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b64435ddde9f175a127faa500e553debf480d8227a625d0e736e7a095af13ce5
BLAKE2b-256 checksum
How to use checksums
c4e035f22a597c297ddc0fb8e32fa2534f89ea09b98c5d6f52a2d9f371fd5e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Security for statclaim 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for statclaim-0.1.0.tar.gz

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 Nov 16, 2026.

Transparency log

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.1.0 This release

2 release files Full 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