View source: R/helpers-causal-forests.R
causal_forest_handler | R Documentation |
Runs estimates estimation function from interference package and returns tidy data frame output
causal_forest_handler(data, covariate_names, share_train = 0.5, ...)
data |
A data.frame |
covariate_names |
Names of covariates |
share_train |
Share of units to be used for training |
... |
Options to causal_forest |
https://draft.declaredesign.org/complex-designs.html#discovery-using-causal-forests
See ?causal_forest for further details
a data.frame of estimates
library(DeclareDesign) library(ggplot2) dat <- fabricate( N = 1000, A = rnorm(N), B = rnorm(N), Z = complete_rs(N), Y = A*Z + rnorm(N)) # note: remove num.threads = 1 to use more processors estimates <- causal_forest_handler(data = dat, covariate_names = c("A", "B"), num.threads = 1) ggplot(data = estimates, aes(A, pred)) + geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.