/causalpy:causalpy-inferencefrom causalpy
Performs Bayesian quasi-experimental causal inference with CausalPy. Supports Difference-in-Differences, Synthetic Control, Interrupted Time Series, Regression Discontinuity, Instrumental Variables, and Pre-Post designs with PyMC or scikit-learn backends.
Ships in causalpy. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Estimate causal treatment effects from observational and quasi-experimental
designs using causalpy (import causalpy as cp), pairing explicit
identification assumptions with full Bayesian uncertainty quantification.
Inspect installed causalpy, pymc, and arviz versions and experiment class
signatures (import causalpy as cp; dir(cp)) before writing code. Do not
mutate the consuming environment without user confirmation.
| Assignment Mechanism / Data Structure | CausalPy Class | Key Identification Requirement |
|---|---|---|
| Treated & control groups observed pre- and post-intervention | cp.DifferenceInDifferences | Parallel trends in absence of treatment; no anticipation or spillover (SUTVA). |
| Single (or few) treated unit(s) + weighted donor pool of untreated units | cp.SyntheticControl | Weighted simplex combination of donors reproduces pre-treatment trajectory without overfitting; donors unaffected by treatment. |
| Single time series before & after an intervention (with optional controls/seasonality) | cp.InterruptedTimeSeries | No concurrent confounding shocks at treatment time; pre-period trend/seasonality extrapolates cleanly. |
| Treatment assigned by threshold on continuous running variable | cp.RegressionDiscontinuity / cp.RegressionKink | Continuity of potential outcomes at cutoff; no manipulation/sorting across threshold; bandwidth sensitivity checked. |
| Endogenous treatment with valid external instrument | cp.InstrumentalVariable | Instrument relevance (strong first stage), exclusion restriction, monotonicity (LATE). |
| Non-equivalent group pre-post comparison | cp.PrePostNEGD | Functional form and baseline covariate adjustment capture selection bias. |
cp.pymc_models.LinearRegression, cp.pymc_models.WeightedSumFitter,
cp.pymc_models.InstrumentalVariableRegression, etc.) when full posterior
credible intervals and priors are desired; use scikit-learn OLS/Ridge
backends only for rapid prototyping or explicit frequentist benchmarks.result.idata["sample_stats"] / result.idata["posterior"], using
arviz-diagnostics when pymc-core is installed), and inspect pre-treatment residual plots and Bayesian
R^2 (bad pre-period fit invalidates the counterfactual!).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub pymc-labs/pymc-modeling --plugin causalpyOther plugins' skills for the same job