View source: R/hte_causalTree.R
| hte_causalTree | R Documentation | 
Estimate heterogeneous treatment effect via causal tree. In each leaf, the treatment effect is the difference of mean outcome in treatment group and control group.
hte_causalTree(
  outcomevariable,
  minsize = 20,
  crossvalidation = 20,
  data,
  treatment_indicator,
  ps_indicator,
  covariates,
  negative = FALSE,
  drawplot = TRUE,
  varlabel = NULL,
  maintitle = "Heterogeneous Treatment Effect Estimation",
  legend.x = 0.08,
  legend.y = 0.25,
  check = FALSE,
  ...
)
| outcomevariable | a character representing the column name of the outcome variable. | 
| minsize | the minimum number of observations in each leaf. The default is set as 20. | 
| crossvalidation | number of cross validations. The default is set as 20. | 
| data | a data frame containing the variables in the model. | 
| treatment_indicator | a character representing the column name of the treatment indicator. | 
| ps_indicator | a character representing the column name of the propensity score. | 
| covariates | a vector of column names of all covariates (linear terms andpropensity score). | 
| negative | a logical value indicating whether we expect the treatment effect to be negative. The default is set as FALSE. | 
| drawplot | a logical value indicating whether to plot the model as part of the output. The default is set as TRUE. | 
| varlabel | a named vector containing variable labels. | 
| maintitle | a character string indicating the main title displayed when plotting the tree and results. The default is set as "Heterogeneous Treatment Effect Estimation". | 
| legend.x,legend.y | x and y coordinate to position the legend. The default is set as (0.08, 0.25). | 
| check | if TRUE, generates 100 trees and outputs most common tree structures and their frequency | 
| ... | further arguments passed to or from other methods. | 
predicted treatment effect and the associated tree
library(rpart)
library(htetree)
hte_causalTree(outcomevariable="outcome",
    data=data.frame("confounder"=c(0, 1, 1, 0, 1, 1),
                    "treatment"=c(0,0,0,1,1,1),
                    "prop_score"=c(0.4, 0.4, 0.5, 0.6, 0.6, 0.7),
                    "outcome"=c(1, 2, 2, 1, 4, 4)),
   treatment_indicator = "treatment",
   ps_indicator = "prop_score",
   covariates = "confounder")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.