hdMB: High-Dimensional Mahalanobis balancing

View source: R/hdMB.R

hdMBR Documentation

High-Dimensional Mahalanobis balancing

Description

High-Dimensional Mahalanobis balancing is a multivariate perspective of approximate covariate balancing method to estimate average treatment effect in causal inference. We use function hdMB to select variable then Mahalanobis balancing method will be applied to estimate ATE.

Usage

hdMB(
  x,
  treat,
  group1,
  group2 = NA,
  outcome,
  method = "MB",
  delta.space = c(0.1, 0.01, 0.001, 1e-04, 1e-05, 1e-06),
  GASMD.bound = 0.1,
  iterations = 1000
)

Arguments

x

covariates.

treat

treatment indicator vector.

group1

see Details.

group2

see Details, Default: NA.

outcome

outcome vector.

method

a string that takes values in "MB", "MB2", See Details, Default: 'MB'.

delta.space

a vector of candidate values for tuning parameter, See Details, Default: c(1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6).

GASMD.bound

An upper bound for choosing the variables, See Details, Default: 0.1.

iterations

iteration times in optimization problem, Default: 1000.

Details

group1,group2

  • To estimate E(Y (1)) (average treatment effect for group 1), you need to set group1 = 1 and ignore group2. Similarly, To estimate E(Y (0)) (average treatment effect for group 0), you need to set group1 = 0 and ignore group2.

  • To estimate average treatment effect on the control group E(Y (1) | T = 0), you need to set group1 = 1 and group2 = 0. Similarly, To estimate average treatment effect on the treated group E(Y (0) | T = 1), you need to set group1 = 0 and group2 = 1.

  • This function is feasible when there are more than two groups.

method can be a valid string, including

  • "MB": We choose the weighting matrix {W}_1=[diag(\hat{Σ})]^{-1} where \hat{Σ} denotes sample covariance matrix.

  • "MB2": We choose the weighting matrix {W}_2={[\hat{Σ}]^{-1}} where \hat{Σ} denotes sample covariance matrix.

delta.space grid of values for the tuning parameter, a vector of candidate values for the degree of approximate covariate balance. The default is c(1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6).

GASMD.bound GASMD is an imbalance measure. We first standardize our covariate, then GASMD_{a,k} = (X_{1,a,k} + ... + X_{n_a,a,k}) / n_a - mean_k where X_{a} denotes the covariate in group a, k denotes the k-th dimension of covariate and n_a denotes the sample size in group a. Note that GASMD is different from ASMD. In our paper, we suggest using ASMD to select the variable. However, when there are more than two groups, ASMD is unsuitable. Therefore, we use GASMD instead of ASMD to select the variable.

Value

a hdMB object with the following attributes:

  • GMIM: Generalized Multivariate Imbalance Measure that defines in our paper.

  • GASMD: Generalized Absolute Standardized Mean Difference, See Details.

Examples

#hdMB
##generating high-dimensional data
set.seed(0521)
data        <- si.data(sample.size = 200, dimension = 100)
dimension   <- dim(data$X)[2]

##estimating ATE##

##choosing variable
hdMB1       <- hdMB(x = data$X, treat = data$Tr, group1 = 1, outcome = data$Y, method = "MB")
hdMB1$GMIM
threshold   <- 24
index1      <- rank(hdMB1$GASMD) >= (dimension - threshold + 1)

##choosing variable
hdMB2       <- hdMB(x = data$X, treat = data$Tr, group1 = 0, outcome = data$Y, method = "MB")
hdMB2$GMIM
threshold   <- 25
index2      <- rank(hdMB2$GASMD) >= (dimension - threshold + 1)

##an estimate of ATE
result1     <- MB(x = data$X[,index1], treat = data$Tr, group1 = 1, outcome = data$Y)
result2     <- MB(x = data$X[,index2], treat = data$Tr, group1 = 0, outcome = data$Y)
result1$AT - result2$AT

##estimating ATC##
hdMB3       <- hdMB(x = data$X, treat = data$Tr, group1 = 1, group2 = 0, outcome = data$Y, method = "MB")
hdMB3$GMIM
threshold   <- 7
index3      <- rank(hdMB3$GASMD) >= (dimension - threshold + 1)
result3     <- MB(x = data$X[,index3], treat = data$Tr, group1 = 1, group2 = 0, outcome = data$Y)

##an estimate of ATC
result3$AT - mean(data$Y[data$Tr == 0])

yimindai0521/MBalance documentation built on May 9, 2022, 4:06 p.m.