Description Usage Arguments Value Examples
View source: R/build_MOTTE_forest.R
The function to fitting tree/trees
1 2 3 4 5 6 7 8 9 10 11 12 | build_MOTTE_forest(
x.b,
x.e,
treat,
y.b,
y.e,
nsplits = NULL,
nodesize = 2 * (ncol(x.b) + 1),
left.out = 0.1,
ntree = ifelse(is.null(nsplits), 1, 200),
nCore = ifelse(is.null(nsplits), 1, detectCores() - 1)
)
|
x.b |
Before treatment covariates, a n by p matrix |
x.e |
After treatment covariates, a n by p matrix |
treat |
Treatment received, a n by 1 vector |
y.b |
Before treatment outcomes, a n by q matrix |
y.e |
After treatment outcomes, a n by q matrix #@param method Method to use when choosing split value. Two options: "Exhaust" and "Random" |
nsplits |
The number of split condidate want to examine when constructing split rule |
nodesize |
Parameter to control the node size. When the number of observations in Node smaller than nodesize, stop splitting |
left.out |
left.out is ensure at least left.out*2 sample for either treated or untreated sample in the group |
ntree |
Number of trees want to construct. By default it is 1; however, when Random method used, recommand setting it as 200 |
nCore |
The number of cores use for forest contruction when doing parallel computation |
a list of data.tree. Even when only one tree construct, it is a list containing the single tree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #' set.seed(1)
B <- create.B(10)
Z <- create.Z(10, 3)
tmp.dat <- sim_MOTTE_data( n.train = 500, n.test = 200,
p = 10, q = 3, ratio = 0.5,
B = B, Z = Z)
train.dat <- tmp.dat$train
x.b <- scale(train.dat$x.b, center = FALSE, scale = TRUE)
x.e <- scale(train.dat$x.e, center = FALSE, scale = TRUE)
y.b <- scale(train.dat$y.b, center = FALSE, scale = TRUE)
y.e <- scale(train.dat$y.e, center = FALSE, scale = TRUE)
treat <- train.dat$trt
# with(train.dat,
build_MOTTE_forest(x.b, x.e, treat, y.b, y.e)
#)
nodesize=10
left.out=0.1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.