PTOforest: Fit a pollinated transformed outcome (PTO) forest model

Description Usage Arguments Value Examples

Description

Fit a pollinated transformed outcome (PTO) forest model

Usage

1
2
3
PTOforest(x, tx, y, pscore = rep(0.5, nrow(x)), num.trees = 500,
  mtry = ncol(x), min.node.size = max(25, nrow(x)/40), postprocess = TRUE,
  verbose = FALSE)

Arguments

x

matrix of covariates

tx

vector of treatment indicators (0 or 1)

y

vector of response values

pscore

vector of propensity scores

num.trees

number of trees for transformed outcome forest

mtry

number of variables to possibly split at in each node

min.node.size

minimum node size for transformed outcome forest

postprocess

logical: should optional post-processing random forest be fit at end?

verbose

logical: should progress be printed to console?

Value

an object of class PTOforest 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 PTO forest model
fit_pto = PTOforest(x, tx, y)
pred_pto = predict(fit_pto, newx = x)

# Visualize results
plot(tx_effect, pred_pto, main = 'PTO forest',
 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.