# NOT RUN {
# Train a multi causal forest.
n <- 250
p <- 10
d <- 3
X <- matrix(rnorm(n * p), n, p)
W <- sample(c("A", "B", "C"), n, replace = TRUE)
Y <- X[, 1] + X[, 2] * (W == "B") + X[, 3] * (W == "C") + runif(n)
multi.forest <- multi_causal_forest(X = X, Y = Y, W = W)
# Predict using the forest.
multi.forest.pred <- predict(multi.forest)
head(multi.forest.pred$predictions)
# }
Run the code above in your browser using DataLab