A Python toolkit for causal inference and experimentation
Project description
Causalis
Robust causal inference for experiments and observational studies in Python, organized around scenarios (e.g., Classic RCT, CUPED, Unconfoundedness) with a consistent fit() → estimate() workflow.
- 📚 Documentation & notebooks: https://causalis.causalcraft.com/
- 🔎 API reference: https://causalis.causalcraft.com/api-reference
Why Causalis?
Causalis focuses on:
- Scenario-first workflows (you pick the study design; Causalis provides best-practice defaults).
- Extensive robustness tests that reveal issues in the study design or model specification
- Pydantic data contracts
- An advanced DGP (Data Generating Process) with heterogeneous treatment effects, latent variables, and correlated confounders
- A website with notebooks based on real-world cases
Installation
Recommended
pip install causalis
Quickstart: Classic RCT (difference in means + inference)
from causalis.dgp import generate_classic_rct_26
from causalis.scenarios.classic_rct import DiffInMeans, check_srm
# Synthetic RCT data as a validated CausalData object
data = generate_classic_rct_26(seed=42, return_causal_data=True)
# Optional: Sample Ratio Mismatch check
srm = check_srm(data, target_allocation={0: 0.5, 1: 0.5}, alpha=1e-3)
print("SRM detected?", srm.is_srm, "p=", srm.p_value, "chi2=", srm.chi2)
# Estimate treatment effect with t-test inference (or bootstrap / conversion_ztest)
result = DiffInMeans().fit(data).estimate(method="ttest", alpha=0.05)
result.summary()
Quickstart: Observational study (Unconfoundedness / DML IRM)
from causalis.scenarios.unconfoundedness.dgp import generate_obs_hte_26
from causalis.scenarios.unconfoundedness import IRM
from causalis.data_contracts import CausalData
causaldata = generate_obs_hte_26(return_causal_data=True, include_oracle=False)
from causalis.scenarios.unconfoundedness import IRM
model = IRM().fit(causaldata)
result = model.estimate(score='ATTE')
result.summary()
Pick your scenario
| Scenario | Estimator | Assumptions |
|---|---|---|
| Classic RCT | Difference in means (ttest, ztest, welch_permutation_t_test) | Random assignment, no sample ratio mismatch, SUTVA |
| CUPED | CUPED-adjusted difference in means with Lin specification | Random assignment, no sample ratio mismatch, SUTVA, valid pre-period metrics |
| Unconfoundedness | DML IRM | Unconfoundedness, Overlap, SUTVA, No leakage, Score stability |
| GATE | DML IRM (GATE and GATET) | Same assumptions as unconfoundedness, plus meaningful pre-specified or validated subgroup definitions. |
| Multi Unconfoundedness | Multi DML IRM | Unconfoundedness, Multi class Overlap, SUTVA, No leakage, Score stability |
| Synthetic Control | ASCM | No interference / spillovers, No anticipation, The treated unit’s untreated outcome path is well approximated by the donor pool |
| Difference in Difference | CallawaySantAnnaDID | Parallel trends, no anticipation, stable group composition, no spillovers between treated and control groups. |
| IV | DML IV | First-stage strength, Reduced form, Instrument balance by Z, Instrument propensity / predictability |
| Uplift / CATE scoring | DML IRM (CATE) | Identified treatment effects from randomized or unconfounded data, overlap, calibrated individual-level predictions. |
Introduction to Causal Inference: guide
See scenario notebooks: https://causalis.causalcraft.com/explore-scenarios
Contributing guidelines
Maintainers
References
https://github.com/DoubleML/doubleml-for-py
Search terms / supported methods
Causalis covers methods often searched as:
- causal inference Python
- causal machine learning Python
- treatment effect estimation
- A/B testing Python
- randomized controlled trial analysis
- CUPED Python
- Double Machine Learning Python
- DML / IRM
- CATE estimation
- uplift modeling
- propensity score diagnostics
- synthetic control Python
- difference-in-differences Python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file causalis-1.0.3.tar.gz.
File metadata
- Download URL: causalis-1.0.3.tar.gz
- Upload date:
- Size: 12.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
126377d092c3ca34c7bcdc67e45ae0152e83cffc86403d6effd465b44ab73daa
|
|
| MD5 |
a36966bcbbb1102adbb66319ad1f2e7e
|
|
| BLAKE2b-256 |
adb2b6748fd8524cd6dfec3eeed05fc1bd2d25267503c76eb78f4e00ae2f6e3c
|
Provenance
The following attestation bundles were made for causalis-1.0.3.tar.gz:
Publisher:
release.yml on causalis-causalcraft/Causalis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
causalis-1.0.3.tar.gz -
Subject digest:
126377d092c3ca34c7bcdc67e45ae0152e83cffc86403d6effd465b44ab73daa - Sigstore transparency entry: 2082147974
- Sigstore integration time:
-
Permalink:
causalis-causalcraft/Causalis@2145b51e61c160a27f8064451d6b72ccf7160feb -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/causalis-causalcraft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2145b51e61c160a27f8064451d6b72ccf7160feb -
Trigger Event:
push
-
Statement type:
File details
Details for the file causalis-1.0.3-py3-none-any.whl.
File metadata
- Download URL: causalis-1.0.3-py3-none-any.whl
- Upload date:
- Size: 444.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fc6ec39207dd7ea38b67090371935d4ec9e2e2f36febd7c610e55df9927e54f
|
|
| MD5 |
ec494e3e476260c45a024664f7b47c57
|
|
| BLAKE2b-256 |
a251cd7f82b31643212a391b46dc46a42a81b8a5ec07f358676eaa97682ea8bf
|
Provenance
The following attestation bundles were made for causalis-1.0.3-py3-none-any.whl:
Publisher:
release.yml on causalis-causalcraft/Causalis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
causalis-1.0.3-py3-none-any.whl -
Subject digest:
5fc6ec39207dd7ea38b67090371935d4ec9e2e2f36febd7c610e55df9927e54f - Sigstore transparency entry: 2082147984
- Sigstore integration time:
-
Permalink:
causalis-causalcraft/Causalis@2145b51e61c160a27f8064451d6b72ccf7160feb -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/causalis-causalcraft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2145b51e61c160a27f8064451d6b72ccf7160feb -
Trigger Event:
push
-
Statement type: