Skip to contents

Wraps grf::instrumental_forest() with a column-name interface.

Usage

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

Arguments

data

A data frame containing all required columns.

outcome

Name of outcome column.

treatment

Name of exposure or treatment column.

instrument

Name of instrument column.

covariates

Character vector of baseline covariate column names.

num.trees

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

seed

Random seed passed to grf::instrumental_forest().

...

Additional arguments passed to grf::instrumental_forest().

Value

A heteff_fit object.

Examples

if (FALSE) { # \dontrun{
set.seed(3)
n <- 400
z <- rbinom(n, 1, 0.5)
x1 <- rnorm(n)
x2 <- rnorm(n)
w <- 0.6 * z + 0.4 * x1 + rnorm(n)
y <- 1.2 * w + 0.5 * x2 + rnorm(n)
df <- data.frame(y = y, w = w, z = z, x1 = x1, x2 = x2)

fit <- fit_instrumental_forest(
  data = df,
  outcome = "y",
  treatment = "w",
  instrument = "z",
  covariates = c("x1", "x2")
)
head(as.data.frame(fit))
} # }