DD: Double demeaning estimator

View source: R/combFun.R

DDR Documentation

Double demeaning estimator

Description

Double demeaning estimator

Usage

DD(Y, Z, interZ = formula(~1), ID, Z.hat, Y0.hat, data)

Arguments

Y

continuous outcome variable

Z

binary treatment indicator, 1 - treatment, 0 - control

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

Z.hat

treatment prediction from DDcomb, DRPRcomb, or DDPRcomb

Y0.hat

outcome prediction among untreated units from DDcomb, DRPRcomb, or DDPRcomb

data

dataframe containing the variables in the model

Value

estimates and standard errors

Examples

DDcomb.rslt <- DDcomb(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) # the default algorithms are "glm" and "deeplearning".

# with final predictions
DD(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1), ID=twolevel_data$id,
 Z.hat=DDcomb.rslt$Z.hat, Y0.hat=DDcomb.rslt$Y0.hat, data=twolevel_data)


DDPRcomb.rslt <- DDPRcomb(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1),
 X=twolevel_data[, c("X1", "X2", "X3", "W1")], ID=twolevel_data$id, data=twolevel_data)

# with final predictions
DD(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1), ID=twolevel_data$id,
 Z.hat=DDPRcomb.rslt$Z.hat, Y0.hat=DDPRcomb.rslt$Y0.hat, data=twolevel_data)
# with predictions from glm with fixed effects of clusters
DD(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1), ID=twolevel_data$id,
 Z.hat=DDPRcomb.rslt$Z.hats$Ztest.hat_glm_1, Y0.hat=DDPRcomb.rslt$Y0.hats$Y0test.hat_glm_1,
 data=twolevel_data)
# with predictions from deep learning
DD(Y=twolevel_data$Y, Z=twolevel_data$Z, interZ=(~ W1), ID=twolevel_data$id,
 Z.hat=DDPRcomb.rslt$Z.hats$Ztest.hat_dl, Y0.hat=DDPRcomb.rslt$Y0.hats$Y0test.hat_dl,
 data=twolevel_data)


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