Package 'MatchGATE'

Title: Estimate Group Average Treatment Effects with Matching
Description: Two novel matching-based methods for estimating group average treatment effects (GATEs). The match_y1y0() and match_y1y0_bc() functions are used for imputing the potential outcomes based on matching and bias-corrected matching techniques, respectively. The EstGATE() function is employed to estimate the GATE after imputing the potential outcomes.
Authors: Zhaoqing Tian [aut, cre, com] , Peng Wu [aut, ths] , Yilin Chen [dtc]
Maintainer: Zhaoqing Tian <[email protected]>
License: GPL-3
Version: 0.0.10
Built: 2024-12-05 06:53:12 UTC
Source: CRAN

Help Index


Estimating Group Average Treatment Effects

Description

When imputed values for Y1Y^1 and Y0Y^0 are available for each individual, we can use EstGATE to estimate the group average treatment effects (GATE) defined by

GATE(z)=E[Y1Y0Z=z]GATE(z) = E[Y^1 - Y^0 | Z=z]

for some for possible values zz of ZZ.

Usage

EstGATE(Y1_Y0, Z, Zeval, h)

Arguments

Y1_Y0

A vector in which each element is a treatment effect for each individual.

Z

A subvector of the covariates X, which is used to define the subgroup of interest.

Zeval

Vector of evaluation points of Z.

h

A smoothing parameter, bandwidth.

Value

The value of the corresponding GATE at different evaluation points.

Examples

set.seed(691)
n <- 2000
X1 <- runif(n, -0.5,0.5)
X2 <- rnorm(n, sd = 0.5)
X = cbind(X1, X2)
A = sample(c(0,1), n, TRUE)
Y0 <- X2 + X1*X2/2 + rnorm(n, sd = 0.25)
Y1 <- A * (2*X1^2) + X2 + X1*X2/2 + rnorm(n, sd = 0.25)
Y <- A * Y1 + (1-A)*Y0
res.match <- match_y1y0(X, A, Y, K = 5)
y1_y0 <- res.match$Y1 - res.match$Y0
Z <- X1
Zeval = seq(min(Z), max(Z), len = 101)
h <- 0.5 * n^(-1/5)
res <- EstGATE(Y1_Y0 = y1_y0, Z, Zeval, h = h)
plot(x = Zeval, y = 2*Zeval^2,
     type = "l", xlim = c(-0.6, 0.5),
     main = "Estimated value vs. true value",
     xlab = "Zeval", ylab = "GATE",
     col = "DeepPink", lwd = "2")
lines(x = res$Zeval, y = res$GATE,
      col="DarkTurquoise", lwd = "2")
legend('bottomleft', c("Estimated GATE","True GATE"),
       col=c("DarkTurquoise","DeepPink"),
       text.col=c("DarkTurquoise","DeepPink"), cex = 0.8)

Imputing Missing Potential Outcomes with Matching

Description

Impute missing potential outcomes for each individual with matching.

Usage

match_y1y0(X, A, Y, K = 5, method = "euclidean")

Arguments

X

A matrix representing covariates, where each row represents the value of a different covariates for an individual.

A

A vector representing the treatment received by each individual.

Y

A vector representing the observed outcome for each individual.

K

When imputing missing potential outcomes, the average number of similar individuals are taken based on covariates similarity.

method

The distance measure to be used. It is a argument embed in dist function.

Details

Here are the implementation details for the imputation processes. Denote Y^i0\hat{Y}^0_i and Y^i1\hat{Y}^1_i as the imputed potential outcomes for individual ii. Without loss of generality, if Ai=0A_i = 0, then Y^i0=Yi\hat{Y}^0_i = Y_i, and Y^i1\hat{Y}^1_i is the average of outcomes for the K units that are the most similar to the individual ii, i.e.,

Y^i0=1KjJK(i)Yj,\hat{Y}_i^0 = \frac 1 K \sum_{j\in\mathcal{J}_K(i)}Y_j,

where JK(i)\mathcal{J}_K(i) represents the set of KK matched individuals with Ai=1A_i = 1, that are the closest to the individual ii in terms of covariates similarity, and vice versa.

Value

Returns a matrix of completed matches, where each row is the imputed (Y1,Y0)(Y^1, Y^0) for each individual.

Examples

n <- 100
p <- 2
X <- matrix(rnorm(n*p), ncol = p)
A <- sample(c(0,1), n, TRUE)
Y <- A * (2*X[,1]) + X[,2]^2 + rnorm(n)
match_y1y0(X = X, A = A, Y = Y, K =5)

Imputing Missing Potential Outcomes with Bias-Corrected Matching

Description

Impute missing potential outcomes for each individual with bias-corrected matching.

Usage

match_y1y0_bc(X, A, Y, miu1.hat, miu0.hat, K = 5, method = "euclidean")

Arguments

X

A matrix representing covariates, where each row represents the value of a different covariates for an individual.

A

A vector representing the treatment received by each individual.

Y

A vector representing the observed outcome for each individual.

miu1.hat

The estimated outcome regression function for Y1Y^1.

miu0.hat

The estimated outcome regression function for Y0Y^0.

K

When imputing missing potential outcomes, the average number of similar individuals are taken based on covariates similarity.

method

The distance measure to be used. It is a argument embed in dist function.

Details

Here are the implementation details for the imputation processes. Denote Y^i0\hat{Y}^0_i and Y^i1\hat{Y}^1_i as the imputed potential outcomes for individual ii. For example, if Ai=0A_i = 0, then Y^i0=Yi0\hat{Y}^0_i = Y^0_i. However, for obtaining Y^i1\hat{Y}^1_i, we require to introduce an outcome regression function μ1(X)\mu_1(X) for Y1Y^1. Let μ^1(X)\hat{\mu}_1(X) be the fitted value of μ1(X)\mu_1(X), then Y^i1\hat{Y}^1_i is defined as follows,

Y^i1=1KjJK(i){Yj+μ^1(Xi)μ^1(Xj)},\hat{Y}_i^1 = \frac 1 K \sum_{j\in\mathcal{J}_K(i)}\{Y_j+ \hat{\mu}_1(X_i)-\hat{\mu}_1(X_j)\},

where JK(i)\mathcal{J}_K(i) represents the set of KK matched individuals with Ai=1A_i = 1, that are the closest to the individual ii in terms of covariates similarity, and vice versa.

Value

Returns a matrix of completed matches, where each row is the imputed (Y1,Y0)(Y^1, Y^0) for each individual.

Examples

n = 100
X1 <- runif(n, -0.5,0.5)
X2 <- sample(c(0,1,2), n, TRUE)
X = cbind(X1, X2)
A = sample(c(0,1), n, TRUE)
Y = A * (2*X1) + X1 + X2^2 + rnorm(n)
miu1_hat <- cbind(1,X) %*% as.matrix(lm(Y ~ X, subset = A==1)$coef)
miu0_hat <- cbind(1,X) %*% as.matrix(lm(Y ~ X, subset = A==0)$coef)
match_y1y0_bc(X = X, A = A, Y = Y, miu1.hat = miu1_hat,
              miu0.hat = miu0_hat, K = 5)