ate.glmnet: Average treatment effect estimation for randomized...

Description Usage Arguments Value Author(s) References Examples

Description

Use the cross estimation procedure with glmnet regularization to adjust covariates and estimate average treatment effects and confidence intervals

Usage

1
2
ate.glmnet(X, Y, W, alpha = 1, nfolds = NULL, method = c("joint", "separate"), 
  lambda.choice = c("lambda.1se", "lambda.min"), conf.level=0.9)

Arguments

X

Data matrix with covariates, one observation per row

Y

Outcome vector for assigned treatment for each observation

W

Treatment vector for each observation

alpha

Elastic net parameter. Default 1

nfolds

Number of folds

method

There are two methods, method = "joint" estimates coefficients from joint model and method = "separate" estimates coefficients for each treatment separately

lambda.choice

There are two cross validation choices, lambda.choice = "lambda.1se" uses the one standard deviation rule and lambda.choice = "lambda.min" uses the minimum

conf.level

Confidence level for intervals. Default 0.9

Value

Returns list containing the following

tau

Average treatment effect estimate

var

Variance estimate

conf.int

Confidence interval for true tau

conf.level

Confidence level

Author(s)

Stefan Wager, Wenfei Du, Jonathan Taylor, Rob Tibshirani

References

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

Examples

 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

swager/crossEstimation documentation built on May 30, 2019, 9:33 p.m.