Causal Effect Random Forest of Interaction Trees

Fits a Causal Effect Random Forest of Interaction Trees (CERFIT) which is a modification of the Random Forest algorithm where each split is chosen to maximize subgroup treatment heterogeneity. Doing this allows it to estimate the individualized treatment effect for each observation in either randomized controlled trial (RCT) or observational data. For more information see L. Li, R. A. Levine, and J. Fan (2022) .


CERFIT

The CERFIT R package is an implementation of Random Forest of Interaction Trees (RFIT) in R. Which is a modification of the random forest algorithm to estimate individualized treatment effect in randomized control trials and observational studies. It does this by modifying the split rule used in the tree growing process. It chooses a split by maximizing subgroup treatment heterogeneity. It can handle binary, multiple, ordered, and continuous treatment.

Installation

You can install the development version of CERFIT from GitHub with:

devtools::install_github("JustinThorp/CERFIT")

Example

Below is a small example showing how to fit a Random Forest of Interaction Trees, get predictions from the tree, and calculate variable importance. When growing the forest it will print our the response type, the treatment levels, the type of treatment variable, and an updating count of the number of trees.

library(CERFIT)
fit <- CERFIT(Y ~ SAT_MATH + HSGPA + AGE + GENDER + URM | A,
              method = "observation",
              PropForm = "CBPS",
              data = educational,
              ntrees = 30)
#> Continous Response 
#> Treatment Levels: 1 2 3 
#> Multiple Treatment 
#> Tree Number: 10
#> Tree Number: 20
#> Tree Number: 30
ite <- predict(fit)
#> [1] 1 2 3
importance <- MinDepth(fit)
library(tidyverse)
ite %>%
as.data.frame() %>%
pivot_longer(everything()) %>%
ggplot(aes(x = name, y = value)) +
geom_violin() +
scale_x_discrete(labels = c(0,1,2)) +
labs(y = "Predicted Y",x = "A") +
theme_bw()

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("CERFIT")

0.2.0 by Justin Thorp, 5 months ago


Browse source code at https://github.com/cran/CERFIT


Authors: Justin Thorp [aut, cre] , Joshua Moffat [aut] , Luo Li [aut] , Juanjuan Fan [aut]


Documentation:   PDF Manual  


GPL (>= 2) license


Imports partykit, CBPS, randomForest, twang, Rcpp, stats, glmnet, survival

Linking to Rcpp, RcppArmadillo


See at CRAN