Skip to contents

Wraps grf::causal_forest() with a column-name interface and returns a unified heteff_fit object.

Usage

fit_observational_forest(
  data,
  outcome,
  treatment,
  covariates,
  num.trees = 2000,
  seed = 1,
  ...
)

Arguments

data

A data frame containing all required columns.

outcome

Name of the numeric outcome column.

treatment

Name of the binary or continuous treatment column.

covariates

Character vector of baseline covariate column names.

num.trees

Number of trees passed to grf::causal_forest().

seed

Random seed passed to grf::causal_forest().

...

Additional arguments passed to grf::causal_forest().

Value

A heteff_fit object with effect_table, fitted forest, and variable importance.

Examples

if (FALSE) { # \dontrun{
set.seed(1)
n <- 300
df <- data.frame(
  y = rnorm(n),
  w = rbinom(n, 1, 0.5),
  x1 = rnorm(n),
  x2 = rnorm(n)
)
fit <- fit_observational_forest(df, "y", "w", c("x1", "x2"))
head(as.data.frame(fit))
} # }