Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Estimates heterogeneous treatment effects from observational data using EconML methods like Double ML, Causal Forest, and metalearners.
Use this skill ↓61% 83%+22 ptsof test cases passed
Passed 19 of 23 test cases with the skill, and 14 of 23 without it.
When fitting an EconML CausalForest model on covariates matrix X, treatment array T, and response vector Y, what positional argument order does the fit method take?
Passes positional arguments to fit in the exact order X, T, Y.
3 of 3 safety checks passed
EconML is a Microsoft library for causal inference and heterogeneous treatment effect estimation using machine learning. Implements Double ML, Causal Forest, DML, IV methods, and orthogonal statistical learning. Designed for observational data where treatment effects vary across individuals.
uv pip install econml
from econml.dml import LinearDML
import numpy as np
X = np.random.randn(500, 5) # features
T = np.random.randn(500) # treatment
Y = T * (0.5 + X[:, 0]) + np.random.randn(500) # outcome
est = LinearDML(model_y="auto", model_t="auto", discrete_treatment=False)
est.fit(Y, T, X=X)
print(f"ATE: {est.ate():.3f} ± {est.ate_inference().stderr:.3f}")
from econml.grf import CausalForest
cf = CausalForest(n_estimators=100, min_samples_leaf=10)
cf.fit(X, T, Y)
treatment_effects = cf.effect(X)
print(f"Heterogeneous effects range: {treatment_effects.min():.3f} to {treatment_effects.max():.3f}")
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.