Learn R Programming

grf (version 0.9.6)

instrumental_forest: Intrumental forest

Description

Trains an instrumental forest that can be used to estimate conditional local average treatment effects tau(X) identified using instruments. Formally, the forest estimates tau(X) = Cov[Y, Z | X = x] / Cov[W, Z | X = x]. Note that when the instrument Z and treatment assignment W coincide, an instrumental forest is equivalent to a causal forest.

Usage

instrumental_forest(X, Y, W, Z, sample.fraction = 0.5, mtry = NULL,
  num.trees = 2000, num.threads = NULL, min.node.size = NULL,
  honesty = TRUE, ci.group.size = 2, precompute.nuisance = TRUE,
  reduced.form.weight = 0, alpha = 0.05, imbalance.penalty = 0,
  stabilize.splits = TRUE, seed = NULL, clusters = NULL,
  samples_per_cluster = NULL)

Arguments

X

The covariates used in the instrumental regression.

Y

The outcome.

W

The treatment assignment (may be binary or real).

Z

The instrument (may be binary or real).

sample.fraction

Fraction of the data used to build each tree. Note: If honesty is used, these subsamples will further be cut in half.

mtry

Number of variables tried for each split.

num.trees

Number of trees grown in the forest. Note: Getting accurate confidence intervals generally requires more trees than getting accurate predictions.

num.threads

Number of threads used in training. If set to NULL, the software automatically selects an appropriate amount.

min.node.size

A target for the minimum number of observations in each tree leaf. Note that nodes with size smaller than min.node.size can occur, as in the original randomForest package.

honesty

Whether or not honest splitting (i.e., sub-sample splitting) should be used.

ci.group.size

The forst will grow ci.group.size trees on each subsample. In order to provide confidence intervals, ci.group.size must be at least 2.

precompute.nuisance

Should we first run regression forests to estimate y(x) = E[Y|X=x], w(x) = E[W|X=x] and z(x) = E[Z|X=x], and then run an instrumental forest on the residuals? This approach is recommended, computational resources permitting.

reduced.form.weight

Whether splits should be regularized towards a naive splitting criterion that ignores the instrument (and instead emulates a causal forest).

alpha

A tuning parameter that controls the maximum imbalance of a split.

imbalance.penalty

A tuning parameter that controls how harshly imbalanced splits are penalized.

stabilize.splits

Whether or not the instrument should be taken into account when determining the imbalance of a split (experimental).

seed

The seed for the C++ random number generator.

clusters

Vector of integers or factors specifying which cluster each observation corresponds to.

samples_per_cluster

If sampling by cluster, the number of observations to be sampled from each cluster. Must be less than the size of the smallest cluster. If set to NULL software will set this value to the size of the smallest cluster.

Value

A trained instrumental forest object.