rcate.rf: Robust estimation of treatment effect using random forests.

Description Usage Arguments Value Examples

View source: R/rcate.rf.R

Description

rcate.rf return robust estimation of treatment effect using random forests.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
rcate.rf(
  x,
  y,
  d,
  method = "MCMEA",
  n.trees.rf = 50,
  feature.frac = 0.8,
  minnodes = 5,
  n.trees.p = 40000,
  shrinkage.p = 0.005,
  n.minobsinnode.p = 10,
  interaction.depth.p = 1,
  cv.p = 5,
  n.trees.mu = c(1:50) * 50,
  shrinkage.mu = 0.01,
  n.minobsinnode.mu = 5,
  interaction.depth.mu = 5,
  cv.mu = 5
)

Arguments

x

matrix or a data frame of predictors.

y

vector of response values.

d

vector of binary treatment assignment (0 or 1).

method

character string of CATE estimation method: "MCMEA" - modified co-variate method with efficiency augmentation, "RL" - R-learning, or "DR" - doubly robust method.

n.trees.rf

tuning parameter the number of trees used in GBM for estimating treatment effect function if algorithm="GBM". The default is 1000.

feature.frac

tuning parameter the number of interactions for estimating treatment effect function if algorithm="GBM". The default value is 2.

minnodes

vector of the dropout rate of each hidden layer if algorithm='NN'. The default is no dropout.

n.trees.p

tuning parameter the number of trees used for estimating propensity score with GBM. the default value is 40000.

shrinkage.p

tuning parameter the shrinkage level for estimating propensity score with GBM. the default value is 0.005.

n.minobsinnode.p

tuning parameter the minimum node size for estimating propensity score with GBM. the default value is 10.

interaction.depth.p

tuning parameter the number of interactions for estimating propensity score with GBM. the default value is 1.

cv.p

tuning parameter the number of folds in cross-validation for estimating propensity score with GBM. the default value is 2.

n.trees.mu

scalar or vector of the number of trees for estimating mean function with GBM. The default is (1:50)*50.

shrinkage.mu

tuning parameter the shrinkage level for estimating mean function with GBM. the default value is 0.01.

n.minobsinnode.mu

tuning parameter the minimum node size for estimating mean function with GBM. the default value is 10.

interaction.depth.mu

tuning parameter the number of interactions for estimating mean function with GBM. the default value is 5.

cv.mu

tuning parameter the folds for cross-validation for estimating mean function with GBM. The default value is 5.

Value

a list of components

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n <- 1000; p <- 3
X <- as.data.frame(matrix(runif(n*p,-3,3),nrow=n,ncol=p)); set.seed(2223)
tau = 6*sin(2*X[,1])+3*(X[,2]+3)*X[,3]
p = 1/(1+exp(-X[,1]+X[,2]))
d = rbinom(n,1,p)
t = 2*d-1
y = 100+4*X[,1]+X[,2]-3*X[,3]+tau*t/2 + rnorm(n,0,1); set.seed(2223)
x_val = as.data.frame(matrix(rnorm(200*3,0,1),nrow=200,ncol=3))
tau_val = 6*sin(2*x_val[,1])+3*(x_val[,2]+3)*x_val[,3]

# Use MCM-EA transformation and GBM to estimate CATE
fit <- rcate.rf(X,y,d,method='DR',feature.frac = 0.8, minnodes = 3, n.trees.rf = 5)
y_pred <- predict(fit,x_val)$pred
plot(tau_val,y_pred);abline(0,1)

rhli-Hannah/RCATE documentation built on Aug. 26, 2020, 9:40 a.m.