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).
- Guardrails and diagnostics (e.g., SRM checks, balance checks).
- Typed data contracts (
CausalData) to fail fast on schema issues.
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
Classic RCT: randomized assignment (no pre-period metric).
CUPED: randomized assignment with pre-period metric for variance reduction.
Unconfoundedness: observational study adjusting for measured confounders (DML IRM).
See scenario notebooks: https://causalis.causalcraft.com/explore-scenarios
Responsible use / limitations
Causal estimates require identification assumptions (e.g., randomization or unconfoundedness + overlap). Causalis can help with diagnostics, but it cannot guarantee assumptions hold in your data.
Contributing
Contributions are welcome—bug reports, docs fixes, notebooks, and new estimators. Please read CONTRIBUTING.md and follow the Code of Conduct.
Getting help
Questions: GitHub Discussions
Bugs: GitHub Issues (include minimal repro + versions)
License
MIT (see LICENSE).
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-0.1.8.tar.gz.
File metadata
- Download URL: causalis-0.1.8.tar.gz
- Upload date:
- Size: 168.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e2029f64e0b6fc90169c9ab8d1738e4e96bcb8b4a3e58004a37bfb6d0e50dda
|
|
| MD5 |
f75b9898a26b9dd2bc791d914e022a0a
|
|
| BLAKE2b-256 |
a0191c126a2403d975ac96c0e6d0a3b667a0faa9751509d802a8066edd4efb0d
|
File details
Details for the file causalis-0.1.8-py3-none-any.whl.
File metadata
- Download URL: causalis-0.1.8-py3-none-any.whl
- Upload date:
- Size: 203.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ead400294871ab532a719f9c01d5a2da01392e15267ea7c9e156259234ae7f1c
|
|
| MD5 |
09c94f655ac29a9d7b55145c8df46455
|
|
| BLAKE2b-256 |
74b91a47164e138ab5a7581a8431916b37bee52b5db33888af1cc396c9648426
|