causalTree {htetree} | R Documentation |
Causal Effect Regression and Estimation Trees
Description
Fit a causalTree
model to get an rpart
object
Usage
causalTree(
formula,
data,
weights,
treatment,
subset,
na.action = na.causalTree,
split.Rule,
split.Honest,
HonestSampleSize,
split.Bucket,
bucketNum = 5,
bucketMax = 100,
cv.option,
cv.Honest,
minsize = 2L,
x = FALSE,
y = TRUE,
propensity,
control,
split.alpha = 0.5,
cv.alpha = 0.5,
cv.gamma = 0.5,
split.gamma = 0.5,
cost,
...
)
Arguments
formula |
a formula, with a response and features but
no interaction terms. If this a a data frome, that is taken as
the model frame (see |
data |
an optional data frame that includes the variables named in the formula. |
weights |
optional case weights. |
treatment |
a vector that indicates the treatment status of each observation. 1 represents treated and 0 represents control. Only binary treatment supported in this version. |
subset |
optional expression saying that only a subset of the rows of the data should be used in the fit. |
na.action |
the default action deletes all observations for which
|
split.Rule |
causalTree splitting options, one of |
split.Honest |
boolean option, |
HonestSampleSize |
number of observations anticipated to be used in honest re-estimation after building the tree. This enters the risk function used in both splitting and cross-validation. |
split.Bucket |
boolean option, |
bucketNum |
number of observations in each bucket when set
|
bucketMax |
Option to choose maximum number of buckets to use in
splitting when set |
cv.option |
cross validation options, one of |
cv.Honest |
boolean option, |
minsize |
in order to split, each leaf must have at least
|
x |
keep a copy of the |
y |
keep a copy of the dependent variable in the result. If
missing and |
propensity |
propensity score used in |
control |
a list of options that control details of the
|
split.alpha |
scale parameter between 0 and 1, used in splitting
risk evaluation function for |
cv.alpha |
scale paramter between 0 and 1, used in cross validation
risk evaluation function for |
cv.gamma , split.gamma |
optional parameters used in evaluating policies. |
cost |
a vector of non-negative costs, one for each variable in the model. Defaults to one for all variables. These are scalings to be applied when considering splits, so the improvement on splitting on a variable is divided by its cost in deciding which split to choose. |
... |
arguments to |
Details
CausalTree differs from rpart
function from rpart
package in splitting rules and cross validation methods. Please check
Athey and Imbens, Recursive Partitioning for Heterogeneous Causal
Effects (2016) for more details.
Value
An object of class rpart
. See rpart.object
.
References
Breiman L., Friedman J. H., Olshen R. A., and Stone, C. J. (1984) Classification and Regression Trees. Wadsworth.
Athey, S and G Imbens (2016) Recursive Partitioning for Heterogeneous Causal Effects. http://arxiv.org/abs/1504.01132
See Also
honest.causalTree
,
rpart.control
, rpart.object
,
summary.rpart
, rpart.plot
Examples
library("htetree")
library("rpart")
library("rpart.plot")
tree <- causalTree(y~ x1 + x2 + x3 + x4, data = simulation.1,
treatment = simulation.1$treatment,
split.Rule = "CT", cv.option = "CT", split.Honest = TRUE, cv.Honest = TRUE,
split.Bucket = FALSE, xval = 5,
cp = 0, minsize = 20, propensity = 0.5)
opcp <- tree$cptable[,1][which.min(tree$cptable[,4])]
opfit <- prune(tree, opcp)
rpart.plot(opfit)
fittree <- causalTree(y~ x1 + x2 + x3 + x4, data = simulation.1,
treatment = simulation.1$treatment,
split.Rule = "fit", cv.option = "fit",
split.Honest = TRUE, cv.Honest = TRUE, split.Bucket = TRUE,
bucketNum = 5,
bucketMax = 200, xval = 10,
cp = 0, minsize = 20, propensity = 0.5)
tstatstree <- causalTree(y~ x1 + x2 + x3 + x4, data = simulation.1,
treatment = simulation.1$treatment,
split.Rule = "tstats", cv.option = "CT",
cv.Honest = TRUE, split.Bucket = TRUE,
bucketNum = 10,
bucketMax = 200, xval = 5,
cp = 0, minsize = 20, propensity = 0.5)