Causalmodels is a Python library for defining, analyzing, and inferring causal relationships from data, drawing inspiration from Judea Pearl's do-calculus. It provides tools for building Bayesian causal models, performing matching, and conducting regression-based causal inference. The current version is 0.4.0, with an irregular release cadence.
pip install causalmodelsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `Regression` module to estimate the Average Treatment Effect (ATE) of a treatment variable 'X' on an outcome 'Y', while controlling for a confounder 'Z'. It simulates data reflecting a causal relationship and then applies the regression model.
Carefully define your causal graph, identify all potential confounders, and consider domain knowledge before applying methods. Validate assumptions where possible through sensitivity analysis or alternative approaches.
Ensure your DataFrame is clean, handles missing values (e.g., imputation or removal) appropriately, and all columns used in causal models are of the expected numerical type before passing the data.