causal_forest_handler: Tidy helper function for causal_forest function

View source: R/helpers-causal-forests.R

causal_forest_handlerR Documentation

Tidy helper function for causal_forest function

Description

Runs estimates estimation function from interference package and returns tidy data frame output

Usage

causal_forest_handler(data, covariate_names, share_train = 0.5, ...)

Arguments

data

A data.frame

covariate_names

Names of covariates

share_train

Share of units to be used for training

...

Options to causal_forest

Details

https://draft.declaredesign.org/complex-designs.html#discovery-using-causal-forests

See ?causal_forest for further details

Value

a data.frame of estimates

Examples


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()


rdddr documentation built on July 3, 2022, 5:06 p.m.