Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

walterwzhang/causalTree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

causalTree Introduction

The causalTree function builds a regression model and returns an rpart object, which is the object derived from rpart package, implementing many ideas in the CART (Classification and Regression Trees), written by Breiman, Friedman, Olshen and Stone. Like rpart, causalTree builds a binary regression tree model in two stages, but focuses on estimating heterogeneous causal effect.

This repository was forked from Professor Athey's Github. This fork of the repository is used for didactic purposes and will generally not be up to date with the latest version.

To install this package in R, run the following commands:

install.packages("devtools")
library(devtools) 
install_github("walterwzhang/causalTree")

Example usage:

library(causalTree)
set.seed(1234)
CF_fit <- causalForest(y~ x1 + x2 + x3 + x4, data = simulation.1, treatment = simulation.1$treatment,
                   num.trees = 100, verbose = FALSE)
                  
CF_predictions   <-   predict(CF_fit, simulation.2)

summary(CF_predictions)
  • Remember to set the seed before each causalForest run to attain replicable results.
  • For console output for each tree built set the parameter verbose to TRUE in casualForest.
  • For more details, please check out briefintro.pdf.

Installation FAQ

If the installation of the package with install_github() fails.

  • Make sure a prior version of causalTree is not installed.
  • Quit the R/RStudio Session
  • Check to see if the causalTree library is still there and delete the folder if it is. (e.g. delete the folder C:\Users\user_name\Documents\R\win-library\3.3\causalTree on a windows computer)
  • Open R/RStudio, load devtools, and try re-installing this package with install_github()

References

Susan Athey, Guido Imbens. Recursive Partitioning for Heterogeneous Causal Effects. [link]

About

Working repository for Causal Tree and extensions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 74.6%
  • R 25.4%