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

To install the development version 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.

The documentation, at https://convexanalytics.com/trickle-down/, includes the usage guide and a reproduction of the paper's calculations. trickle_down.usage() returns the 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.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 trickle-down 0.2.0
File Size Uploaded Provenance Actions
trickle_down-0.2.0.tar.gz 85.2 kB With provenance Details for trickle_down-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 124.0 kB

Release files / trickle_down-0.2.0.tar.gz

Download URL trickle_down-0.2.0.tar.gz
Size 85.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cd6d96f1085058de29d7875d437087e980a72153e1994769204272169b3a71d7
BLAKE2b-256 checksum
How to use checksums
91dc1e2b8ee98903ddcc4543ebe5c571d68f0bb5f17544dff475deed7fa7e25f
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.2.0-py3-none-any.whl

Download URL trickle_down-0.2.0-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01006b136e1080b3e0ebdbe0d040a6e03bf1fd515caa13b9578022443b1c8a69
BLAKE2b-256 checksum
How to use checksums
ad07f6913d2770d710fb535337d52be30a543b0f3f2842cbe9f785b4e95b11e0
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.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.

Full provenance

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

Select from 2 files

Attestation for trickle_down-0.2.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.2.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