Causal Inference, Unified — A DoWhy-Inspired Framework for R
causali provides a four-step causal inference workflow for R:
- Model — Define your causal problem (outcome, treatment, confounders)
- Estimate — Estimate the causal effect using your method of choice
- Assumptions — Check critical assumptions (balance, parallel trends, etc.)
- Refute — Stress-test your result with refutation tests
It wraps battle-tested R packages (MatchIt, WeightIt, did, fixest, ivreg, rdrobust, and others) under a single, clean API.
# From CRAN (coming soon)
# install.packages("causali")
# From GitHub
remotes::install_github("mzshaik/causali")library(causali)
# Load sample data
data("lalonde", package = "causali")
# Step 1: Define the causal model
model <- causal_model(
data = lalonde,
outcome = re78,
treatment = treat,
confounders = c(age, educ, race, married, nodegree, re74, re75),
label = "Effect of job training on 1978 earnings"
)
# Step 2: Estimate the effect
result <- estimate(model, method = "matching")
# Step 3: Check assumptions
assumptions(result)
# Step 4: Refute
refute(result)
# Summary + Report
summary(result)
report(result, file = "causal_report.html")
plot(result)| Method | Description | Wraps |
|---|---|---|
matching |
Propensity score matching | MatchIt |
weighting |
Inverse probability weighting | WeightIt |
did |
Difference-in-Differences | did (Callaway & Sant'Anna) |
iv |
Instrumental variables | ivreg |
rdd |
Regression discontinuity | rdrobust |
fixest |
Fixed effects regression | fixest |
| Check | Description |
|---|---|
assumptions() |
Balance assessment, parallel trends, overlap check |
refute() |
Placebo test, random common cause, subset refutation, bootstrap |
R has over 100 packages for causal inference but no unified API. causali gives you:
- One consistent interface — same
causal_model()→estimate()→assumptions()→refute()regardless of method - Automatic assumption checking — no more forgetting to verify balance or parallel trends
- Publication-ready reporting —
gttables andggplot2visualisations - Pipeline-friendly — pipe from model through estimation to refutation
MIT