Econml Causal Guide logo

Econml Causal Guide

Community
wentorai
econml-causal-guide

Apply EconML for causal inference combining machine learning and econometrics

Overview

Publisherwentorai
Repositoryresearch-plugins
Skill nameeconml-causal-guide
Stars
294
Forks
42
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by wentorai on GitHub. Read the source before you install it.

Installation

Install the Econml Causal Guide AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wentorai/research-plugins.git /tmp/research-plugins
mkdir -p .claude/skills
cp -r /tmp/research-plugins/skills/analysis/econometrics/econml-causal-guide .claude/skills/econml-causal-guide
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Econml Causal Guide in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Econml Causal Guide on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Econml Causal Guide is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

bash
pip install econml

For the full feature set including optional dependencies:

bash
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:

python
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:

python
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:

python
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:

python
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:

python
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:

python
# 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

Frequently asked questions

What does the Econml Causal Guide AI skill do?

Apply EconML for causal inference combining machine learning and econometrics

Why use Econml Causal Guide on TypingMind?

Because you install it once and use it with any model. Econml Causal Guide is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Econml Causal Guide in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wentorai/research-plugins/tree/main/skills/analysis/econometrics/econml-causal-guide. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Econml Causal Guide?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Econml Causal Guide?

As many as you like. As long as a model supports skills, you can use Econml Causal Guide with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Econml Causal Guide AI skill free?

Yes. It is published on GitHub by wentorai under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇