causalBoosting: Fit a causal boosting model

Description Usage Arguments Details Value Examples

Description

Fit a causal boosting model

Usage

1
2
3
4
causalBoosting(x, tx, y, num.trees = 500, maxleaves = 4, eps = 0.01,
  splitSpread = 0.1, x.est = NULL, tx.est = NULL, y.est = NULL,
  propensity = FALSE, stratum = NULL, stratum.est = NULL,
  isConstVar = TRUE)

Arguments

x

matrix of covariates

tx

vector of treatment indicators (0 or 1)

y

vector of response values

num.trees

number of shallow causal trees to build

maxleaves

maximum number of leaves per causal tree

eps

learning rate

splitSpread

how far apart should the candidate splits be for the causal trees? (e.g. splitSpread = 0.1) means we consider 10 quantile cutpoints as candidates for making split

x.est

optional matrix of estimation-set covariates used for honest re-estimation (ignored if tx.est = NULL or y.est = NULL)

tx.est

optional vector of estimation-set treatment indicators (ignored if x.est = NULL or y.est = NULL)

y.est

optional vector of estimation-set response values (ignored if x.est = NULL or y.est = NULL)

propensity

logical: should propensity score stratification be used?

stratum

optional vector giving propensity score stratum for each observation (only used if propensity = TRUE)

stratum.est

optional vector giving propensity score stratum for each estimation-set observation (ignored if x.est = NULL or tx.est = NULL or y.est = NULL)

isConstVar

logical: for the causal tree splitting criterion (T-statistc), should it be assumed that the noise variance is the same in treatment and control arms?

Details

This function exists primarily to be called by cv.causalBoosting because the num.trees parameter generally needs to be tuned via cross-validation.

Value

an object of class causalBoosting with attributes:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Randomized experiment example

n = 100 # number of training-set patients to simulate
p = 10  # number of features for each training-set patient

# Simulate data
x = matrix(rnorm(n * p), nrow = n, ncol = p) # simulate covariate matrix
tx_effect = x[, 1] + (x[, 2] > 0) # simple heterogeneous treatment effect
tx = rbinom(n, size = 1, p = 0.5) # random treatment assignment
y = rowMeans(x) + tx * tx_effect + rnorm(n, sd = 0.001) # simulate response

# Estimate causal boosting model
fit_cb = causalBoosting(x, tx, y, num.trees = 500)
pred_cb = predict(fit_cb, newx = x, num.trees = 500)

# Visualize results
plot(tx_effect, pred_cb, main = 'Causal boosting',
 xlab = 'True treatment effect', ylab = 'Estimated treatment effect')
abline(0, 1, lty = 2)

saberpowers/causalLearning documentation built on May 30, 2019, 8:26 a.m.