AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Econml Causal Guide

skill-wentorai-research-plugins-econml-causal-guide · by wentorai

Apply EconML for causal inference combining machine learning and econometrics

No reviews yet
0 installs
37 views
0.0% view→install

Install

$ agentstack add skill-wentorai-research-plugins-econml-causal-guide

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-wentorai-research-plugins-econml-causal-guide)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Econml Causal Guide? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

EconML Causal Inference Guide

Overview

EconML is a Python package developed by Microsoft Research as part of the ALICE (Automated Learning and Intelligence for Causation and Economics) project. It provides a comprehensive suite of methods for estimating heterogeneous treatment effects from observational data, bridging the gap between modern machine learning and classical econometric techniques for causal inference.

Traditional econometric approaches to causal inference often rely on strong parametric assumptions and struggle with high-dimensional data. Pure machine learning methods excel at prediction but do not inherently distinguish correlation from causation. EconML combines the strengths of both paradigms, offering methods that leverage the flexibility of ML for nuisance parameter estimation while maintaining the rigorous causal identification guarantees of econometric theory.

The library implements cutting-edge methods from the academic literature including Double Machine Learning (DML), Causal Forests, Doubly Robust Learners, Orthogonal Random Forests, and Instrumental Variable methods with ML first stages. These tools are essential for researchers across economics, public health, education policy, and any field where understanding causal mechanisms from non-experimental data is critical.

Installation and Setup

Install EconML via pip:

pip install econml

For the full feature set including optional dependencies:

pip install econml[all]

EconML builds on top of scikit-learn and integrates with the broader Python data science ecosystem. Core dependencies include numpy, scipy, pandas, scikit-learn, and statsmodels. Optional dependencies for specific estimators include LightGBM and PyTorch.

Verify installation:

import econml
print(econml.__version__)

from econml.dml import LinearDML
from econml.orf import DMLOrthoForest
print("EconML loaded successfully")

Core Estimators and Methods

Double Machine Learning (DML): The workhorse method for estimating average and heterogeneous treatment effects while controlling for high-dimensional confounders. DML uses cross-fitting and orthogonalization to eliminate regularization bias:

from econml.dml import LinearDML, CausalForestDML
from sklearn.ensemble import GradientBoostingRegressor

# Linear DML for parametric treatment effect estimation
est = LinearDML(
    model_y=GradientBoostingRegressor(),
    model_t=GradientBoostingRegressor(),
    cv=5,
    random_state=42
)
est.fit(Y, T, X=X, W=W)

# Get treatment effect estimates with confidence intervals
effect = est.effect(X_test)
ci = est.effect_interval(X_test, alpha=0.05)
print(f"ATE: {est.ate():.4f}")
print(f"ATE 95% CI: {est.ate_interval(alpha=0.05)}")

Here Y is the outcome, T is the treatment, X contains effect modifiers (features for heterogeneity), and W contains additional confounders.

Causal Forest DML: Combines DML orthogonalization with Causal Forest estimation for flexible, nonparametric heterogeneous treatment effects:

from econml.dml import CausalForestDML

cf_est = CausalForestDML(
    model_y=GradientBoostingRegressor(),
    model_t=GradientBoostingRegressor(),
    n_estimators=200,
    min_samples_leaf=10,
    cv=5,
    random_state=42
)
cf_est.fit(Y, T, X=X, W=W)

# Heterogeneous treatment effects
hte = cf_est.effect(X_test)
# Feature importance for treatment effect heterogeneity
importances = cf_est.feature_importances_

Doubly Robust Learner: Provides consistent treatment effect estimates when either the outcome model or the propensity score model is correctly specified:

from econml.dr import DRLearner
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor

dr_est = DRLearner(
    model_propensity=RandomForestClassifier(),
    model_regression=RandomForestRegressor(),
    model_final=RandomForestRegressor(),
    cv=5
)
dr_est.fit(Y, T, X=X, W=W)

Instrumental Variable Methods: For settings where unobserved confounding is present but valid instruments are available:

from econml.iv.dml import DMLIV

iv_est = DMLIV(
    model_y_xw=GradientBoostingRegressor(),
    model_t_xw=GradientBoostingRegressor(),
    model_t_xwz=GradientBoostingRegressor(),
    cv=5
)
iv_est.fit(Y, T, Z=Z, X=X, W=W)

Research Workflow Integration

Experiment Analysis: When randomized experiments suffer from non-compliance or attrition, use IV methods in EconML to recover local average treatment effects. The ML-based first stages handle complex relationships between instruments and treatment uptake.

Policy Evaluation: Estimate heterogeneous treatment effects to identify which subpopulations benefit most from an intervention. The CATE (Conditional Average Treatment Effect) estimates can directly inform targeted policy design:

# Identify subgroups with largest treatment effects
import pandas as pd

effects_df = pd.DataFrame({
    "effect": cf_est.effect(X_test).flatten(),
    "ci_lower": cf_est.effect_interval(X_test, alpha=0.05)[0].flatten(),
    "ci_upper": cf_est.effect_interval(X_test, alpha=0.05)[1].flatten()
}, index=X_test.index)

# Top beneficiaries
top_group = effects_df.nlargest(100, "effect")

Sensitivity Analysis: Combine EconML estimates with sensitivity analysis frameworks to assess robustness to potential unobserved confounders. Report how much unmeasured confounding would be required to explain away your findings.

Publication-Ready Results: EconML provides confidence intervals and hypothesis tests based on asymptotic theory, producing results suitable for peer-reviewed publications. Use the summary methods to generate formatted regression-style output.

Best Practices for Academic Research

  1. Always validate assumptions: DML requires conditional ignorability (selection on observables). Document your identification strategy clearly.
  2. Cross-fitting is essential: Never skip the cross-fitting step, as it prevents overfitting bias in the nuisance estimates.
  3. Report multiple estimators: Present results from DML, DR Learner, and Causal Forest side by side to assess robustness.
  4. Check overlap: Verify sufficient overlap in covariate distributions between treated and control groups before estimation.
  5. Use honest estimation: EconML Causal Forests use sample splitting for honesty by default, ensuring valid inference.

References

  • EconML repository: https://github.com/py-why/EconML
  • EconML documentation: https://econml.azurewebsites.net/
  • Chernozhukov et al. (2018), Double/Debiased Machine Learning for Treatment and Structural Parameters
  • Athey and Imbens (2019), Machine Learning Methods That Economists Should Know About

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.