Learn R Programming

dipw (version 0.1.0)

dipw.mean: Estimation of E[Y(1)] or E[Y(0)] from observational data

Description

Estimation of E[Y(1)] or E[Y(0)] from observational data

Usage

dipw.mean(
  X,
  Y,
  W,
  Treated = TRUE,
  r = NULL,
  kappa = 0.5,
  splitting = c("1", "3", "random"),
  B = 1,
  ...
)

Arguments

X

the n by p input covariance matrix

Y

the n dimensional observed response

W

the n dimensional binary vector indicating treatment assignment

Treated

TRUE if we seek to estimate E[Y(1)], FALSE if we instead wish to estimate E[Y(0)]. The default is TRUE

r

optional n dimensional vector containing initial estimates of E[Y(Treated) | X_i] for i = 1, ..., n. The default is NULL

kappa

the weight parameter for quadratic programming. Default is 0.5

splitting

the options for splitting. "1" means B = 1 split, "3" means B = 3 splits, "random" means random splits.

B

the number of iterations for random splits, the default is 1. Only valid when splitting is set to "random".

additional arguments that can be passed to cv.glmnet

Value

the expectation E[Y(1)] or E[Y(0)]

References

Wang, Y., Shah, R. D. (2020) Debiased inverse propensity score weighting for estimation of average treatment effects with high-dimensional confounders https://arxiv.org/abs/2011.08661

Examples

Run this code
# NOT RUN {
# Estimating mean of the potential outcome with a toy data
# Notice that the external optimisation software \code{MOSEK}
# must be installed separately before running the example code.
# Without \code{MOSEK}, the example code is not executable.
# For how to install \code{MOSEK}, see documentation of \code{\link[Rmosek]{Rmosek}}.
set.seed(1)
n <- 100; p <- 200
X <- scale(matrix(rnorm(n*p), n, p))
W <- rbinom(n, 1, 1 / (1 + exp(-X[, 1])))
Y <- X[,1] + W * X[,2] + rnorm(n)
# Getting an estimate of potential outcome mean
(est <- dipw.mean(X, Y, W, Treated=TRUE))
# }

Run the code above in your browser using DataLab