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 |
When imputed values for and
are available
for each individual, we can use
EstGATE
to estimate the
group average treatment effects (GATE) defined by
for some for possible values of
.
EstGATE(Y1_Y0, Z, Zeval, h)
EstGATE(Y1_Y0, Z, Zeval, h)
Y1_Y0 |
A vector in which each element is a treatment effect for each individual. |
Z |
A subvector of the covariates |
Zeval |
Vector of evaluation points of |
h |
A smoothing parameter, bandwidth. |
The value of the corresponding GATE at different evaluation points.
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)
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)
Impute missing potential outcomes for each individual with matching.
match_y1y0(X, A, Y, K = 5, method = "euclidean")
match_y1y0(X, A, Y, K = 5, method = "euclidean")
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
|
Here are the implementation details for the imputation processes.
Denote and
as the imputed potential
outcomes for individual
. Without loss of generality, if
, then
, and
is the average of outcomes for the K units that are the most
similar to the individual
, i.e.,
where represents the set of
matched individuals
with
, that are the closest to the individual
in terms of
covariates similarity, and vice versa.
Returns a matrix of completed matches, where each row is the imputed
for each individual.
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)
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)
Impute missing potential outcomes for each individual with bias-corrected matching.
match_y1y0_bc(X, A, Y, miu1.hat, miu0.hat, K = 5, method = "euclidean")
match_y1y0_bc(X, A, Y, miu1.hat, miu0.hat, K = 5, method = "euclidean")
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 |
miu0.hat |
The estimated outcome regression function for |
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
|
Here are the implementation details for the imputation processes.
Denote and
as the imputed potential
outcomes for individual
. For example, if
, then
.
However, for obtaining
, we require to introduce an outcome
regression function
for
. Let
be the fitted value of
, then
is defined as follows,
where represents the set of
matched individuals
with
, that are the closest to the individual
in terms of
covariates similarity, and vice versa.
Returns a matrix of completed matches, where each row is the imputed
for each individual.
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)
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)