Estimate the Average Treatment Effect
The main function for estimating the average treatment effect or the average treatment effect on the treated. This function creates an ATE
object which can be used as inputs for generic S3 plot
or summary
functions. This function uses a covariate balancing method which creates weights for each subject, without a need to specific a propensity score or an outcome regression model. The main function depends on a Newton-Raphson algorithm with backtracking. For details of the estimator see Chan et al. (2015).
ATE (Y, Ti, X, theta = 0, ATT = FALSE, verbose = FALSE, max.iter = 100, tol = 1e-10, initial.values = NULL, backtrack = TRUE, backtrack.alpha = 0.3, backtrack.beta = 0.5, ...)
Y |
The response vector of length n. This has to be a numeric vector. |
Ti |
The vector of treatment assignments of length n. Must be coded as \{0,1,… 0,1,... and must be binary vector when |
X |
A n x p-matrix of covariates |
theta |
A real scalar parameter for the Cressie-Read family of objective functions. The default is θ=0 (exponential tilting). Other popular examples are θ=-1 (exponential tilting) and θ=1 (quadratic loss). |
ATT |
A logical value indicating whether to estimate the treatment effect on the treated. |
verbose |
A logical value indicating whether to print the progress of the function. |
max.iter |
The maximum number of iterations for the Newton-Raphson methods. For most problems (e.g. with well-behaved functions ρ and u) convergence of Newton-Raphson should be fairly quick. |
tol |
The absolute tolerance used to determine a stopping criteria for the Newton-Raphson algorithm. |
initial.values |
A numeric vector or matrix of possible initial values for the Newton-Raphson algorithm. Must be a J x K matrix where J is the number of treatment arms. For |
backtrack |
A logical value indicating whether to use backtracking in the Newton-Raphson algorithm. |
backtrack.alpha |
A scalar parameter for backtracking with α in (0,0.5). |
backtrack.beta |
A scalar parameter for backtracking with β in (0,1). |
... |
Additional arguments. |
The function reruns an object of type "ATE", a list with the following elements
est |
The vector of point estimates for the average treatment effect. For a binary treatment it also contains the average difference of treatment effects. |
vcov |
The estimated variance covariance matrix for the estimates of the treatment effects for each treatment group. |
lam |
The resulting solution of the main optimization problems, hat{λ}, as described in Chan et al.(2015). In the case of a simple, binary treatment study, the object has |
weights |
The weights obtained by the balancing covariate method for each treatment group. In the case of |
gp |
A string specifying the type of study design. For binary treatment effect with |
conv |
A logical value indicating convergence of Newton-Raphson algorithm. |
X,Y, Ti |
The data which was used for estimation. |
rho, rho1, rho2 |
The Cressie-Read functions ρ used for estimation along with the first and second derivatives. |
FUNu |
A function that append a vector of constants to the covariates. Required to make sure that the weights sum to 1 in each group. |
J |
A scalar indicating the number of treatment arms. |
K |
A scalar indicating the one plus the dimension of the range space of X. |
call |
The matched call. |
Asad Haris, Gary Chan.
Chan, K. C. G. and Yam, S. C. P. and Zhang, Z. (2015). "Globally Efficient Nonparametric Inference of Average Treatment Effects by Empirical Balancing Calibration Weighting", under revision.
Haris, Asad and Chan, K. C. G. (2015). "ATE: An R
package for Nonparametric Inference of Average Treatment Effects ", under revision
library(ATE) #binary treatment set.seed(25) n <- 200 Z <- matrix(rnorm(4*n),ncol=4,nrow=n) prop <- 1 / (1 + exp(Z[,1] - 0.5 * Z[,2] + 0.25*Z[,3] + 0.1 * Z[,4])) treat <- rbinom(n, 1, prop) Y <- 200 + 10*treat+ (1.5*treat-0.5)*(27.4*Z[,1] + 13.7*Z[,2] + 13.7*Z[,3] + 13.7*Z[,4]) + rnorm(n) X <- cbind(exp(Z[,1])/2,Z[,2]/(1+exp(Z[,1])), (Z[,1]*Z[,3]/25+0.6)^3,(Z[,2]+Z[,4]+20)^2) #estimation of average treatment effects (ATE) fit1<-ATE(Y,treat,X) summary(fit1) #plot(fit1) #estimation of average treatment effects on treated (ATT) fit2<-ATE(Y,treat,X,ATT=TRUE) summary(fit2) #plot(fit2) #three treatment groups set.seed(25) n <- 200 Z <- matrix(rnorm(4*n),ncol=4,nrow=n) prop1 <- 1 / (1 + exp(1+Z[,1] - 0.5 * Z[,2] + 0.25*Z[,3] + 0.1 * Z[,4])) prop2 <- 1 / (1 + exp(Z[,1] - 0.5 * Z[,2] + 0.25*Z[,3] + 0.1 * Z[,4])) U <-runif(n) treat <- numeric(n) treat[U>(1-prop2)]=2 treat[U<(1-prop2)& U>(prop2-prop1)]=1 Y <- 210 + 10*treat +(27.4*Z[,1] + 13.7*Z[,2] + 13.7*Z[,3] + 13.7*Z[,4]) + rnorm(n) X <- cbind(exp(Z[,1])/2,Z[,2]/(1+exp(Z[,1])), (Z[,1]*Z[,3]/25+0.6)^3,(Z[,2]+Z[,4]+20)^2) fit3<-ATE(Y,treat,X) summary(fit3) #plot(fit3)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.