hte_causalTree {htetree}R Documentation

Estimate Heterogeneous Treatment Effect via Causal Tree

Description

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.

Usage

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,
  ...
)

Arguments

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.

Value

predicted treatment effect and the associated tree

Examples

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")

[Package htetree version 0.1.18 Index]