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.
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)
The covariates used in the instrumental regression.
The outcome.
The treatment assignment (may be binary or real).
The instrument (may be binary or real).
Fraction of the data used to build each tree. Note: If honesty is used, these subsamples will further be cut in half.
Number of variables tried for each split.
Number of trees grown in the forest. Note: Getting accurate confidence intervals generally requires more trees than getting accurate predictions.
Number of threads used in training. If set to NULL, the software automatically selects an appropriate amount.
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.
Whether or not honest splitting (i.e., sub-sample splitting) should be used.
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.
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.
Whether splits should be regularized towards a naive splitting criterion that ignores the instrument (and instead emulates a causal forest).
A tuning parameter that controls the maximum imbalance of a split.
A tuning parameter that controls how harshly imbalanced splits are penalized.
Whether or not the instrument should be taken into account when determining the imbalance of a split (experimental).
The seed for the C++ random number generator.
Vector of integers or factors specifying which cluster each observation corresponds to.
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.
A trained instrumental forest object.