Skip to main content

Testing Statistical Hypotheses in a Tree-Like Hierarchy

Hypothesis Hierarchy

This library controls the familywise error rate (FWER) over a family of statistical hypotheses arranged in a tree. It accompanies

Bob Wilson (2026). Interpretable and Validatable Uplift Modeling. arXiv:2610.37966.

The paper's motivating problem is uplift modeling. We summarize an uplift model with a shallow decision tree fit on a training split, then use an independent evaluation split to certify claims about the tree's subgroups: that the treatment helps one subgroup, harms another, and that the difference between them is real. Each claim is a hypothesis test, and the tree tells us how to spend the error budget across them.

The paper's main procedure, trickle down, gives each node a weight and a stake. A node is tested at its stake times its available level. A rejection passes the whole available level to the node's children; a retention still passes on the part it did not wager. Unlike a fixed hierarchy, testing continues below a retention, so a null effect at the root does not hide opposite effects in its subgroups. The paper proves the procedure controls the FWER strongly, and shows it is a special case of the graphical approach of Bretz et al. (2009).

The library implements:

  • the trickle down procedure (Hierarchy), over any tree of tests: Welch t-tests, linear contrasts, ANOVA, or p-values computed elsewhere;
  • the paper's interweaved hierarchy of effect and heterogeneity hypotheses over a fitted uplift tree (interweaved_hierarchy), with test directions chosen on the training split;
  • confidence bounds for retained hypotheses, valid simultaneously with the procedure's rejections;
  • the Bonferroni, Hierarchical Bonferroni and Fixed Hierarchy comparators, and a reference implementation of the graphical approach for checking the equivalence.

Installation

Install the trickle-down distribution and import trickle_down.

pip install trickle-down

Until the first release reaches PyPI, install from GitHub:

pip install git+https://github.com/rwilson4/trickle-down

Example

from trickle_down import ArmSummary, UpliftNode, interweaved_hierarchy

men = UpliftNode(
    name="men",
    treated=ArmSummary(mean=0.42, variance=0.24, size=5_000),
    control=ArmSummary(mean=0.35, variance=0.23, size=5_000),
    tau_train=0.065,
)
women = UpliftNode(
    name="women",
    treated=ArmSummary(mean=0.29, variance=0.21, size=5_000),
    control=ArmSummary(mean=0.33, variance=0.22, size=5_000),
    tau_train=-0.038,
)
everyone = UpliftNode(
    name="everyone",
    treated=ArmSummary(mean=0.355, variance=0.229, size=10_000),
    control=ArmSummary(mean=0.340, variance=0.224, size=10_000),
    tau_train=0.014,
    children=[women, men],
)

claims = interweaved_hierarchy(everyone, alpha=0.05).test()
print(claims)

The arm summaries come from the evaluation split; tau_train, from the training split, only picks the direction of each one-sided test. At FWER 0.05 this certifies that the effect is positive overall, positive for men, negative for women, and larger for men than for women.

trickle_down.usage() returns the full usage guide, with recipes for building hierarchies by hand, reporting confidence bounds, and comparing against the other procedures.

Development

uv sync --extra dev
uv run pytest
uv run ruff check trickle_down tests
uv run mypy

Citation

@misc{wilson2026uplift,
  author        = {Wilson, Bob},
  title         = {Interpretable and Validatable Uplift Modeling},
  year          = {2026},
  eprint        = {2610.37966},
  archivePrefix = {arXiv},
  primaryClass  = {stat.ME},
}

License

Apache License 2.0. See LICENSE.txt.

Metadata

Release files for trickle-down 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 trickle-down 0.1.0
File Size Uploaded Provenance Actions
trickle_down-0.1.0.tar.gz 50.6 kB With provenance Details for trickle_down-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 89.2 kB

Release files / trickle_down-0.1.0.tar.gz

Download URL trickle_down-0.1.0.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
eb770c1a41fe83577fb8226160f391778ed21b1e4a789ad62b00d56e103b641f
BLAKE2b-256 checksum
How to use checksums
d5c89c81448b83344b82f2d698f21195f9af5eece52d5fd9e03253994dd3b17e
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 2, 2026.

Transparency log

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

Download URL trickle_down-0.1.0-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ba91f74719c667c5d579b8e260019a35abae08185c7c2326fe26b216b982935
BLAKE2b-256 checksum
How to use checksums
c0fc4dd1fac1a8929979939c247acecc06d19966ada3aceccd234290d366f0bb
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 2, 2026.

Transparency log

Security for trickle-down 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 trickle_down-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 2, 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