pattc_ensemble {DeepLearningCausal}R Documentation

PATT_C SL Ensemble

Description

pattc_ensemble estimates the Population Average Treatment Effect of the Treated from experimental data with noncompliers using the super learner ensemble that includes extreme gradient boosting, glmnet (elastic net regression), random forest and neural nets.

Usage

pattc_ensemble(
  response.formula,
  exp.data,
  pop.data,
  treat.var,
  compl.var,
  compl.SL.learners = c("SL.glmnet", "SL.xgboost", "SL.ranger", "SL.nnet", "SL.glm"),
  response.SL.learners = c("SL.glmnet", "SL.xgboost", "SL.ranger", "SL.nnet", "SL.glm"),
  ID = NULL,
  cluster = NULL,
  binary.outcome = FALSE,
  bootstrap = FALSE,
  nboot = 1000
)

Arguments

response.formula

formula for the effects of covariates on outcome variable (y ~ x).

exp.data

data.frame object for experimental data. Must include binary treatment and compliance variable.

pop.data

data.frame object for population data. Must include binary compliance variable.

treat.var

string for binary treatment variable.

compl.var

string for binary compliance variable.

compl.SL.learners

vector of names of ML algorithms used for compliance model.

response.SL.learners

vector of names of ML algorithms used for response model.

ID

string for name of identifier. (currently not used)

cluster

string for name of cluster variable. (currently not used)

binary.outcome

logical specifying predicted outcome variable will take binary values or proportions.

bootstrap

logical for bootstrapped PATT-C.

nboot

number of bootstrapped samples. Only used with bootstrap = FALSE

Value

pattc_ensemble object of results of t test as PATTC estimate.

Examples


# load datasets
data(exp_data_full) # full experimental data
data(exp_data) #experimental data
data(pop_data) #population data
#attach SuperLearner (model will not recognize learner if package is not loaded)
library(SuperLearner)
set.seed(123456)
#specify models and estimate PATTC
pattc <- pattc_ensemble(response.formula = support_war ~ age + income +
                                education + employed + job_loss,
                                exp.data = exp_data_full,
                                pop.data = pop_data,
                                treat.var = "strong_leader",
                                compl.var = "compliance",
                                compl.SL.learners = c("SL.glm", "SL.nnet"),
                                response.SL.learners = c("SL.glm", "SL.nnet"),
                                ID = NULL,
                                cluster = NULL,
                                binary.outcome = FALSE)

print(pattc)

pattc_boot <- pattc_ensemble(response.formula = support_war ~ age + income +
                                education + employed + job_loss,
                                exp.data = exp_data_full,
                                pop.data = pop_data,
                                treat.var = "strong_leader",
                                compl.var = "compliance",
                                compl.SL.learners = c("SL.glm", "SL.nnet"),
                                response.SL.learners = c("SL.glm", "SL.nnet"),
                                ID = NULL,
                                cluster = NULL,
                                binary.outcome = FALSE,
                                bootstrap = TRUE,
                                nboot = 1000)
print(pattc_boot)



[Package DeepLearningCausal version 0.0.104 Index]