Skip to contents

heteff is a compact wrapper for three grf workflows:

  1. observational heterogeneous effects
  2. survival heterogeneous effects
  3. IV-based heterogeneous local effects

Minimal Data Shape

Use one row per sample and pass column names to each fitting function.

library(heteff)

set.seed(42)
n <- 500
df <- data.frame(
  outcome = rnorm(n),
  treatment = rbinom(n, 1, 0.5),
  instrument = rbinom(n, 1, 0.5),
  time = rexp(n, 0.25),
  status = rbinom(n, 1, 0.8),
  x1 = rnorm(n),
  x2 = rnorm(n),
  x3 = rnorm(n)
)

First Fit

fit_obs <- fit_observational_forest(
  data = df,
  outcome = "outcome",
  treatment = "treatment",
  covariates = c("x1", "x2", "x3")
)

print(fit_obs)
head(as.data.frame(fit_obs))
rank_effects(fit_obs, n = 10)
plot(fit_obs)

Next Steps

  • read Guides for the estimands and assumptions
  • read Tutorials for workflow templates
  • use Reference for API-level details