Skip to content

mzshaik/causali

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

causali

Causal Inference, Unified — A DoWhy-Inspired Framework for R

causali provides a four-step causal inference workflow for R:

  1. Model — Define your causal problem (outcome, treatment, confounders)
  2. Estimate — Estimate the causal effect using your method of choice
  3. Assumptions — Check critical assumptions (balance, parallel trends, etc.)
  4. 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.

Installation

# From CRAN (coming soon)
# install.packages("causali")

# From GitHub
remotes::install_github("mzshaik/causali")

Quick Start

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)

Features

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

Why causali?

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 reportinggt tables and ggplot2 visualisations
  • Pipeline-friendly — pipe from model through estimation to refutation

License

MIT

About

Causal Inference, Unified — A DoWhy-inspired framework for R with 4-step workflow (model, estimate, assumptions, refute), supporting matching, weighting, DiD, IV, RDD, and fixed effects.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages