The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
evalHTE provides statistical methods for evaluating heterogeneous treatment effects (HTE) in randomized experiments. The package implements the methodology developed in Imai and Li (2025) for:
install.packages("evalHTE")# install.packages("devtools")
devtools::install_github("MichaelLLi/evalHTE")| Feature | Description |
|---|---|
| GATE Estimation | Estimate grouped average treatment effects sorted by ML-predicted treatment effects |
| Uniform Confidence Bands | Construct valid confidence intervals that account for multiple testing |
| Exceptional Responders | Identify subgroups with the largest treatment effects using URATE |
| Hypothesis Testing | Test for heterogeneity and consistency of treatment effects across groups |
| Cross-Validation Support | Proper inference under cross-fitting to avoid overfitting |
| Flexible ML Integration | Works with various ML algorithms via caret or
user-defined models |
library(evalHTE)
# Prepare your data with outcome (y), treatment (z), and covariates
data <- data.frame(
y = outcome_variable,
z = treatment_indicator,
x1 = covariate_1,
x2 = covariate_2
)
# Step 1: Estimate heterogeneous treatment effects
fit <- estimate_hte(
treatment = "z",
form = y ~ z * (x1 + x2),
data = data,
algorithms = c("causal_forest"),
n_folds = 5,
ngates = 5
)
# Step 2: Evaluate the estimated HTE
est <- evaluate_hte(fit)
# Step 3: View summary results
summary(est)
# Step 4: Conduct hypothesis tests
test_results <- test_itr(est)
summary(test_results)
# Step 5: Visualize results
plot(est) # Plot GATE estimates
plot_CI(est, alpha = 0.05) # Plot uniform confidence intervals| Function | Description |
|---|---|
estimate_hte() |
Estimate heterogeneous treatment effects using ML algorithms |
evaluate_hte() |
Evaluate and summarize HTE estimates |
test_itr() |
Conduct hypothesis tests for heterogeneity and consistency |
| Function | Description |
|---|---|
GATE() |
Estimate Grouped Average Treatment Effects (sample splitting) |
GATEcv() |
Estimate GATEs under cross-validation |
| Function | Description |
|---|---|
het.test() |
Test for heterogeneous treatment effects across groups |
hetcv.test() |
Heterogeneity test under cross-validation |
consist.test() |
Test for consistency of treatment effect ranking |
consistcv.test() |
Consistency test under cross-validation |
| Function | Description |
|---|---|
URATE() |
Estimate the Uplift RATE curve for identifying exceptional responders |
| Function | Description |
|---|---|
plot.hte() |
Plot GATE estimates with confidence intervals |
plot_CI() |
Plot uniform and pointwise confidence bands |
library(evalHTE)
library(grf)
# Simulate data
set.seed(123)
n <- 1000
X <- matrix(rnorm(n * 5), n, 5)
colnames(X) <- paste0("x", 1:5)
tau <- X[, 1] + 0.5 * X[, 2] # True treatment effect heterogeneity
W <- rbinom(n, 1, 0.5) # Random treatment assignment
Y <- tau * W + rnorm(n) # Observed outcome
# Create data frame
df <- data.frame(X, y = Y, z = W)
# Estimate HTE using causal forest
fit <- estimate_hte(
treatment = "z",
form = y ~ z * (x1 + x2 + x3 + x4 + x5),
data = df,
algorithms = c("causal_forest"),
n_folds = 5,
ngates = 5
)
# Evaluate results
est <- evaluate_hte(fit)
summary(est)
# Visualize GATE estimates
plot(est)The package supports various machine learning algorithms for estimating treatment effects:
causal_forest) via the
grf packagecaretIf you use this package in your research, please cite:
@article{imai2025statistical,
title={Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments},
author={Imai, Kosuke and Li, Michael Lingzhi},
journal={Journal of Business \& Economic Statistics},
volume={43},
number={1},
pages={256--268},
year={2025},
doi={10.1080/07350015.2024.2358909}
}Or in R:
citation("evalHTE")Contributor: - Jialu Li - Harvard University
MIT License
Imai, K. and Li, M. L. (2025). “Statistical Inference for Heterogeneous Treatment Effects Discovered by Generic Machine Learning in Randomized Experiments.” Journal of Business & Economic Statistics, Vol. 43, No. 1, pp. 256-268. https://doi.org/10.1080/07350015.2024.2358909
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.