TEstimator_wrapper {RCTrep}R Documentation

Estimating conditional average treatment effects

Description

Estimating conditional average treatment effects

Usage

TEstimator_wrapper(
  Estimator,
  data,
  vars_name,
  name = "",
  outcome_method = "glm",
  treatment_method = "glm",
  two_models = FALSE,
  outcome_formula = NULL,
  treatment_formula = NULL,
  data.public = TRUE,
  isTrial = FALSE,
  strata_cut = NULL,
  ...
)

Arguments

Estimator

A character specifying an estimator for conditional average treatment effects. The allowed estimators are: "G_computation", "IPW", and "DR".i The corresponding object wll be created by the function TEstimator_wrapper(). The default is "G_computation", which, along with outcome_method="glm" models the potential outcomes.

data

A data frame containing variables named in vars_name and possible other variables.

vars_name

A list containing four character vectors outcome_predictors, treatment_name, and outcome_name. outcome_predictors is a character vector containing the adjustment variables, which, along with TEstimator and the corresponding outcome_method or treatment_method to correct for confounding; outcome_name is a character vector of length one containing the name of outcome; treatment_name is a character vector of length one containing the name of treatment.

name

A character indicating the name of the output object

outcome_method

A character specifying a model for outcome. Possible values are found using names(getModelInfo()). See http://topepo.github.io/caret/train-models-by-tag.html. Default is "glm".

treatment_method

A character specifying a model for treatment. Possible values are found using names(getModelInfo()). See http://topepo.github.io/caret/train-models-by-tag.html. Default is "glm".

two_models

An optional logical indicating whether potential outcomes should be modeled separately when TEstimator="DR". Default is FALSE.

outcome_formula

An optional object of class formula describing the outcome model specification when Estimator="G_computation" or Estimator="DR".

treatment_formula

An optional object of class formula describing the treatment model specification when Estimator="IPW" or Estimator="DR"

data.public

An optional logical indicating whether individual-level data is public in the output object. Default is TRUE.

isTrial

An optional logical indicating whether the treatment assignment of data is random or unknown.

strata_cut

An optional list containing lists. Each component is a list with tag named by a variable in data to discretize, containing break which is a vector specifying the interval of range of the variable to divide, lable which is a character vector specifying how to code value in the variable according to which interval they fall. The leftmost interval corresponds to level one, the next leftmost to level two and so on. This parameter is useful in the case we concern the integrated treatment effect conditioning on variables with multiple levels (for instance, continuous variable or ordinal variable with multiple levels). Note that we first model based on these continuous variables, then we discretize these variables according to strata_cut. The variables in data of the output object are discretized.

...

An optional argument passed to the private function fit() of each class for model training and tuning. See https://topepo.github.io/caret/model-training-and-tuning.html for details.

Value

An object of class TEstimator.

Examples


data <- RCTrep::source.data[sample(dim(RCTrep::source.data)[1],500),]
vars_name <- list(outcome_predictors = c("x1","x2","x3","x4","x5","x6"),
                  treatment_name = c('z'),
                  outcome_name = c('y'))

obj <- TEstimator_wrapper(
 Estimator = "G_computation",
 data = data,
 vars_name = vars_name,
 name = "RCT",
 data.public = TRUE,
 isTrial = FALSE)



[Package RCTrep version 1.2.0 Index]