performing-causal-analysis

pymc-labs's avatarfrom pymc-labs

Fits causal models, estimates impacts, and plots results using CausalPy. Use when performing analysis with DiD, ITS, SC, or RD.

⭐1.1kstars🔀89forks📁View on GitHub🕐Updated Jan 10, 2026

When & Why to Use This Skill

This Claude skill facilitates advanced causal inference and impact estimation by leveraging the CausalPy library. It automates the process of fitting causal models, calculating treatment effects, and generating visual reports for complex statistical methods such as Difference-in-Differences (DiD), Interrupted Time Series (ITS), Synthetic Control (SC), and Regression Discontinuity (RD).

Use Cases

  • Policy Impact Evaluation: Use Difference-in-Differences (DiD) to measure the effectiveness of a new government policy or corporate initiative by comparing treatment and control groups over time.
  • Event Analysis: Apply Interrupted Time Series (ITS) to determine if a specific intervention or external event caused a significant shift in a business metric's trend.
  • Comparative Case Studies: Utilize Synthetic Control (SC) to estimate the impact of an intervention on a single unit (like a city or company) by constructing a weighted combination of unaffected control units.
  • Threshold-Based Research: Implement Regression Discontinuity (RD) designs to estimate causal effects for interventions that are assigned based on a specific score or cutoff point.
nameperforming-causal-analysis
descriptionFits causal models, estimates impacts, and plots results using CausalPy. Use when performing analysis with DiD, ITS, SC, or RD.

Performing Causal Analysis

Executes causal analysis using CausalPy experiment classes.

Workflow

  1. Load Data: Ensure data is in a Pandas DataFrame.
  2. Initialize Experiment: Use the appropriate class (see References).
  3. Fit & Model: Models are fitted automatically upon initialization if arguments are provided.
  4. Analyze Results: Use summary(), print_coefficients(), and plot().

Core Methods

  • experiment.summary(): Prints model summary and main results.
  • experiment.plot(): Visualizes observed vs. counterfactual.
  • experiment.print_coefficients(): Shows model coefficients.

References

Detailed usage for specific methods: