Algorithms to falsify unconfoundedness assumption when having access to multi-source observational data.
Project description
causal-falsify
causal-falsify: A Python library with algorithms for falsifying unconfoundedness assumption in a composite dataset from multiple sources.
This library implements algorithms proposed in our two papers:
- Detecting Hidden Confounding in Observational Data Using Multiple Environments – NeurIPS 2023 (pdf)
- Falsification of Unconfoundedness by Testing Independence of Causal Mechanisms – ICML 2025 (pdf)
📦 Installation
Install from PyPI:
pip install causal-falsify
Example usage
An example with the Mechanism INdependence Test (MINT) algorithm.
from causal_falsify.mint import MINT
from causal_falsify.utils.simulate_data import simulate_data
# Create a simulated pandas DataFrame containing where unmeasured confounding is present:
# - Observed pre-treatment covariates: ["X_0", "X_1"]
# - Source label: "S"
# - Treatment: "A"
# - Outcome: "Y"
confounded_data = simulate_data(
n_samples=250, conf_strength=1.0, n_envs=10, n_observed_confounders=2
)
# Run the MINT algorithm
mint_algorithm = MINT()
p_value = mint_algorithm.test(
confounded_data,
covariate_vars=["X_0", "X_1"],
treatment_var="A",
outcome_var="Y",
source_var="S",
)
# We are evaluating the joint null hypothesis of no unmeasured confounding
# and independent causal mechanisms across sources.
# Reject the null if p-value < significance level (e.g., 0.05).
print("p-value:", p_value)
print("reject null:", p_value < 0.05)
📄 Please cite our work if you use our package
The HGIC and MINT algorithms are based on two of our papers which you can cite as follows:
@article{karlsson2023detecting,
title={Detecting hidden confounding in observational data using multiple environments},
author={Karlsson, Rickard and Krijthe, Jesse H},
journal={Advances in Neural Information Processing Systems},
volume={36},
pages={44280--44309},
year={2023}
}
@inproceedings{karlsson2025falsification,
title={Falsification of Unconfoundedness by Testing Independence of Causal Mechanisms},
author={Karlsson, Rickard and Krijthe, Jesse H},
booktitle={International Conference on Machine Learning},
organization={PMLR}
year={2025},
}
🐛 Issues
If you encounter any bugs, unexpected behavior, or have questions about using the package, please don’t hesitate to open an issue.
📬 Contact
Created by Rickard Karlsson – feel free to reach out!
Project details
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 causal_falsify-0.1.1.tar.gz.
File metadata
- Download URL: causal_falsify-0.1.1.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
412680263eaa46c88a91c915909f062d053c525979cb716c6b4e67cc82bb0d8e
|
|
| MD5 |
a04e5574a5bb41daee44e22a48c15747
|
|
| BLAKE2b-256 |
36614dfb1424046ec49bc9ebbbe637d8899b01ccbb364da01f001ee457cc2aac
|
Provenance
The following attestation bundles were made for causal_falsify-0.1.1.tar.gz:
Publisher:
publish.yml on RickardKarl/causal-falsify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
causal_falsify-0.1.1.tar.gz -
Subject digest:
412680263eaa46c88a91c915909f062d053c525979cb716c6b4e67cc82bb0d8e - Sigstore transparency entry: 253126319
- Sigstore integration time:
-
Permalink:
RickardKarl/causal-falsify@4c90bbb3d60f7bfa85500a05d161513fb6cc2fb3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RickardKarl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4c90bbb3d60f7bfa85500a05d161513fb6cc2fb3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file causal_falsify-0.1.1-py3-none-any.whl.
File metadata
- Download URL: causal_falsify-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cae3c79d6a70dc3551afff384769d44b55e6832fcee8d08da4d4c3ffb2a67b32
|
|
| MD5 |
155c72a0237de8322a0b887eb0033673
|
|
| BLAKE2b-256 |
e7eea06d5b825a95b07e62897a6abefa3d22771974ea928af561ed7d80017b86
|
Provenance
The following attestation bundles were made for causal_falsify-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on RickardKarl/causal-falsify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
causal_falsify-0.1.1-py3-none-any.whl -
Subject digest:
cae3c79d6a70dc3551afff384769d44b55e6832fcee8d08da4d4c3ffb2a67b32 - Sigstore transparency entry: 253126326
- Sigstore integration time:
-
Permalink:
RickardKarl/causal-falsify@4c90bbb3d60f7bfa85500a05d161513fb6cc2fb3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RickardKarl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4c90bbb3d60f7bfa85500a05d161513fb6cc2fb3 -
Trigger Event:
push
-
Statement type: