Description Details Author(s) References Examples
Use cross estimation procedure to estimate average treatment effects and confidence intervals for randomized experiments. The 'glmnet' and 'randomForest' packages are used for estimation of the regression adjustments.
Package: | crossEstimation |
Type: | Package |
Version: | 0.0 |
Date: | 2016-12-13 |
Imports: | glmnet |
Stefan Wager, Wenfei Du
S Wager, W Du, J Taylor, and R Tibshirani. "High-dimensional regression adjustments in randomized experiments". PNAS, November 8, 2016 vol. 113 no. 45 12673-12678
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # simulation with Gaussian covariates based on Figure 1 in reference paper
set.seed(30)
n <- 50
p <- 100
xmean <- 1
xsigma <- 1
sigma <- .1
# set average treatment effect equal to one
ymean0 <- 4
ymean1 <- 3
# set no heterogeneous treatment effects
theta0 <- c(1, rep(0, p-1))
theta1 <- c(1, rep(0, p-1))
tau <- ymean1 - ymean0 + sum(xmean * theta1) - sum(xmean * theta0)
# run loop to calculate coverage
cover <- 0
for (i in 1:5) {
x <- matrix(rnorm(n * p, xmean, xsigma), n, p)
T <- (runif(n) < 0.2)
mu <- (ymean1 + x %*% theta1) * T + (ymean0 + x %*% theta0) * (1 - T)
epsC <- rnorm(n, 0, sigma)
epsT <- rnorm(n, 0, sigma)
eps <- epsT * T + epsC * (1 - T)
yobs <- mu + eps
res <- ate.glmnet(x, yobs, T, alpha = 1, nfolds = 10, method = "joint",
lambda.choice = "lambda.min")
cover <- cover + (res$conf.int[1] < tau & tau < res$conf.int[2])
}
cover
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.