DDPRcomb: Double demeaning estimator with proxy regressions with...

View source: R/combFun.R

DDPRcombR Documentation

Double demeaning estimator with proxy regressions with treatment and outcome learners

Description

Double demeaning estimator with proxy regressions with treatment and outcome learners

Usage

DDPRcomb(
  Y,
  Z,
  X,
  interZ = formula(~1),
  ID,
  data,
  library = c("glm", "deeplearning"),
  crossFitting = FALSE,
  K = 5,
  mCrossFit = 100
)

Arguments

Y

continuous outcome variable

Z

binary treatment indicator, 1 - treatment, 0 - control

X

vector, matrix, or dataframe containing measured confounders

interZ

formula that contains the variables that "interact" with the treatment. "1" will be always added. The default is no interaction, i.e., formula = formula(~1).

ID

cluster identifier

data

dataframe containing the variables in the model

library

character vector of prediction algorithms. The available methods are glm, deeplearning, gbm, and randomForests. The default methods are glm and deeplearning. Three types of glm include: glm with cluster dummies, glm with cluster-constant components of individual-level covariates, and glmm with random effects of clusters.

crossFitting

whether to do cross fitting. The default is FALSE, and currently it is not available.

K

number of folds. The default is 5, and currently it is not available.

mCrossFit

number of cross fitting. The default is FALSE, and currently it is not available.

Value

An DDPRcomb with the following elements:

coef.ER

vector of the coefficients for prediction algorithms in the treatment model

coef.OR

vector of the coefficients for prediction algorithms in the outcome model

Estimate

estimates and standard errors of treatment effects

Z.hat

final weighted prediction for the treatment

Y1.hat

final weighted prediction for the outcome among treated units

Y0.hat

final weighted prediction for the outcome among control units

Z.hats

all the predictions for the treatment from prediction algorithms

Y1.hats

all the predictions for the outcome among treated units from prediction algorithms

Y0.hats

all the predictions for the outcome among control units from prediction algorithms

Examples

# two-level data
DDPRcomb.rlst <- DDPRcomb(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1),
 X=twolevel_data[, c("X1", "X2", "X3", "W1")], ID=twolevel_data$id,
 library="glm", data=twolevel_data)
summary(DDPRcomb.rlst)


# two-level data with default algorithms
DDPRcomb.rlst2 <- DDPRcomb(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1),
 X=twolevel_data[, c("X1", "X2", "X3", "W1")], ID=twolevel_data$id,
 library=c("glm", "deeplearning"), data=twolevel_data)
summary(DDPRcomb.rlst2)

# cross-classified data with default algorithms
DDPRcomb.rlst3 <- DDPRcomb(Y=crossclassified_data$Y, Z=crossclassified_data$Z, interZ=(~ W1),
 X=crossclassified_data[, c("X1", "X2", "X3", "W1", "Q1")], ID=crossclassified_data$f12id,
 library=c("glm", "deeplearning"), data=crossclassified_data)
summary(DDPRcomb.rlst3)


youmisuk/CURobustML documentation built on Sept. 11, 2022, 11:04 a.m.